
If/Else
Quiz
•
Computers
•
9th - 12th Grade
•
Practice Problem
•
Hard
Used 161+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Analyze the following code:
boolean even = false;
if (even = true) {
System.out.println("It is even!");
}
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Suppose income is 4001, what is the output of the following code:
if (income > 3000) {
System.out.println("Income is greater than 3000");
}
else if (income > 4000) {
System.out.println("Income is greater than 4000");
}
No output
3.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Suppose you write the code to display "Cannot get a driver's license" if age is less than 16 and
"Can get a driver's license" if age is greater than or equal to 16.
Which of the following code is the best?
System.out.println("Cannot get a driver's license");
if (age >= 16)
System.out.println("Can get a driver's license");
System.out.println("Cannot get a driver's license");
else
System.out.println("Can get a driver's license");
System.out.println("Cannot get a driver's license");
else if (age >= 16)
System.out.println("Can get a driver's license");
System.out.println("Cannot get a driver's license");
else if (age > 16)
System.out.println("Can get a driver's license");
else if (age == 16)
System.out.println("Can get a driver's license");
4.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
The following code displays ___________.
double temperature = 50;
if (temperature >= 100)
System.out.println("too hot");
else if (temperature <= 40)
System.out.println("too cold");
else
System.out.println("just right");
5.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Assume x = 4 and y = 5, Which of the following is true?
6.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What is the output of the following code?
char ch = 'F';
if (ch >= 'A' && ch <= 'Z')
System.out.println(ch);
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Analyze the following program fragment:
int x;
double d = 1.5;
switch (d) {
case 1.0: x = 1;
case 1.5: x = 2;
case 2.0: x = 3;
}
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
15 questions
Q1 W1 M1 PRE-TEST
Quiz
•
10th Grade
11 questions
Creative iMedia: Strengths, Weaknesses and Improvements
Quiz
•
10th Grade
10 questions
Grade9-Sensors
Quiz
•
9th Grade
10 questions
Latihan Sistem Komputer
Quiz
•
10th Grade
10 questions
Initial Assessment - Cybersecurity Awareness
Quiz
•
9th Grade - Professio...
15 questions
Getting Started With PowerPoint
Quiz
•
9th Grade
10 questions
REMEDIAL DPK X TKJ
Quiz
•
10th Grade
9 questions
Name that OS
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
