Analyze the following code:
boolean even = false;
if (even = true) {
System.out.println("It is even!");
}

If/Else

Flashcard
•
Computers
•
9th - 12th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

10 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Back
The program runs and displays It is even!.
2.
FLASHCARD QUESTION
Front
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");
}
Back
Income is greater than 3000
3.
FLASHCARD QUESTION
Front
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? Options: if (age < 16)
System.out.println("Cannot get a driver's license");
if (age >= 16)
System.out.println("Can get a driver's license");, if (age < 16)
System.out.println("Cannot get a driver's license");
else
System.out.println("Can get a driver's license");, if (age < 16)
System.out.println("Cannot get a driver's license");
else if (age >= 16)
System.out.println("Can get a driver's license");, if (age < 16)
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");
Back
if (age < 16)
System.out.println("Cannot get a driver's license");
else
System.out.println("Can get a driver's license");
4.
FLASHCARD QUESTION
Front
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");
Back
just right
5.
FLASHCARD QUESTION
Front
Assume x = 4 and y = 5, Which of the following is true? Options: x < 5 && y < 5, x < 5 || y < 5, x > 5 && y > 5, x > 5 || y > 5
Back
x < 5 || y < 5
6.
FLASHCARD QUESTION
Front
What is the output of the following code?
char ch ='F';
if (ch >='A' && ch <='Z')
System.out.println(ch);
Back
F
7.
FLASHCARD QUESTION
Front
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;
}
Back
The switch control variable cannot be double.
Create a free account and access millions of resources
Similar Resources on Quizizz
5 questions
Java - Writing Methods

Flashcard
•
9th - 12th Grade
9 questions
24-25 Semester 1 FCS Nine Weeks Test

Flashcard
•
9th - 12th Grade
10 questions
IB Basic Probability

Flashcard
•
9th - 12th Grade
10 questions
Methods and conditional warm up 1

Flashcard
•
10th Grade
10 questions
Drive Right Chapter 1

Flashcard
•
9th - 11th Grade
10 questions
Pearson 1CP2 - 3.2 - Utility Programs

Flashcard
•
9th - 12th Grade
10 questions
Arrays

Flashcard
•
10th - 12th Grade
10 questions
❄⛄AP CSA - Unit 6 Review

Flashcard
•
9th - 12th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
25 questions
SS Combined Advisory Quiz

Quiz
•
6th - 8th Grade
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
15 questions
June Review Quiz

Quiz
•
Professional Development
20 questions
Congruent and Similar Triangles

Quiz
•
8th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade
Discover more resources for Computers
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade
10 questions
Right Triangles: Pythagorean Theorem and Trig

Quiz
•
11th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade
24 questions
LSO - Virus, Bacteria, Classification - sol review 2025

Quiz
•
9th Grade
65 questions
MegaQuiz v2 2025

Quiz
•
9th - 12th Grade