
Chapter 4 Conditional Execution Test Review
Authored by ARTHUR DAVIS
Computers
9th - 12th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code print when x has been set to 187?
if (x < 0)
{
System.out.println("x is negative");
}
else if (x == 0)
{
System.out.println("x is zero");
}
else
{
System.out.println("x is positive");
}
x is negative
x is zero
x is positive
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is printed when the following code executes and x equals 4 and y equals 3?
if (!(x < 3 || y > 2))
System.out.println("first case");
else
System.out.println("second case");
first case
second case
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the value of grade when the following code executes and score is 80?
if (score >= 90) grade = "A";
if (score >= 80) grade = "B";
if (score >= 70) grade = "C";
if (score >= 60) grade = "D";
else grade = "E";
A
B
C
D
E
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is printed when the following code executes and x has been set to zero and y is set to 3?
if (x > 0 || (y / x) == 3)
System.out.println("first case");
else
System.out.println("second case");
first case
second case
You will get a error because you can't divide by zero.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following expressions is equivalent to !(c || d)?
(!c) && (!d)
(c && d)
!(c && d)
(!c) || (!d)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is equivalent to the code segment below?
if (x > 2)
x = x * 2;
if (x > 4)
x = 0;
x = 0;
if (x > 2) x *= 2;
if (x > 2) x = 0;
if (x > 2) x = 0; else x *= 2;
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is equivalent to the code segment below?
if (x > 0)
x = -x;
if (x < 0)
x = 0;
x = 0;
if (x > 0) x = 0;
if (x > 0) x = -x; else x = 0;
if (x < 0) x = 0; else x = -1;
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Alapismeretek
Quiz
•
7th - 12th Grade
13 questions
WJEC GCSE ICT Unit 1 E-Mail
Quiz
•
9th - 10th Grade
10 questions
What is a program slides(6:16)
Quiz
•
8th - 12th Grade
10 questions
ExamenHojasdecalculo
Quiz
•
10th Grade
15 questions
Cyber Security KS4
Quiz
•
8th - 12th Grade
10 questions
BÀI KIỂM TRA GIỮA KÌ 2 - LỚP 3
Quiz
•
1st - 10th Grade
15 questions
LA1.C1: Introduction to Small Basic
Quiz
•
9th Grade
13 questions
Melody Tone
Quiz
•
9th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade