
If/Else

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

10 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Analyze the following code:
boolean even = false;
if (even = true) {
System.out.println("It is even!");
}
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 Wayground
11 questions
Creative commons and Copyright

Flashcard
•
7th - 12th Grade
11 questions
Java ArrayLists

Flashcard
•
10th Grade
10 questions
VA Licensing Review

Flashcard
•
10th Grade
12 questions
sentence wisdome at 3

Flashcard
•
9th - 12th Grade
5 questions
Enhanced For Loops

Flashcard
•
10th - 12th Grade
10 questions
Unit 1 TED Vocab

Flashcard
•
9th - 12th Grade
9 questions
Handbook

Flashcard
•
KG - University
9 questions
PMHS Future Focus Day Real Estate

Flashcard
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
30 questions
Introduction to Computers

Quiz
•
8th - 9th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade