
Learning-Focused MCQs on Java if-else
Authored by Dina Sharawy
Education
11th Grade
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main purpose of an if statement in Java?
To repeat a block of code multiple times.
To check a condition and execute code only if it's true.
To execute a block of code without any conditions.
To sort data in a specific order.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will this code print if int x = 10;?
if (x > 5) {
System.out.println("x is greater than 5");
}
x is greater than 5
x is less than 5
Nothing will print
x is equal to 5
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When would you use an else statement in Java?
To execute code if the if condition is true.
To execute code if the if condition is false.
To stop the program entirely.
To skip over a condition without checking it.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will this code output if int age = 17;?
if (age >= 18) {
System.out.println("Adult"); }
else {
System.out.println("Minor"); }
Adult
Minor
Nothing
Error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In an if-else ladder, what happens if the first if condition is true?
All following conditions are also checked.
Only the else statement runs.
The program skips all following else if and else conditions.
None of the statements execute.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this code snippet print if int score = 75;?
if (score >= 90)
{ System.out.println("Grade A");}
else if (score >= 80)
{ System.out.println("Grade B");}
else if (score >= 70)
{System.out.println("Grade C");}
else
{System.out.println("Grade D or below");}
Grade A
Grade B
Grade C
Grade D or below
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly describes nested if statements?
if statements placed one after another.
An if statement with no else condition.
An if statement inside another if or else block.
Multiple else statements in a row.
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
20 questions
seleksi OSN IPA
Quiz
•
11th Grade
20 questions
Schoology
Quiz
•
10th - 12th Grade
15 questions
W!SE Vocabulary Part 1
Quiz
•
9th - 12th Grade
15 questions
Module 10: Stratification Systems
Quiz
•
11th - 12th Grade
15 questions
QUIZ 4 : ACCOUNTING CYCLE
Quiz
•
1st Grade - University
20 questions
Module 8: State and Non-state Institutions
Quiz
•
11th Grade - University
18 questions
Spanish subject pronouns
Quiz
•
9th - 12th Grade
20 questions
Infant Development
Quiz
•
10th - 12th 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
Discover more resources for Education
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
15 questions
Main Idea and Supporting Details.
Quiz
•
4th - 11th Grade
12 questions
Add and Subtract Polynomials
Quiz
•
9th - 12th Grade
13 questions
Model Exponential Growth and Decay Scenarios
Quiz
•
9th - 12th Grade
27 questions
7.2.3 Quadrilateral Properties
Quiz
•
9th - 12th Grade
7 questions
Amoeba Sisters Dihybrid Cross Punnett Square
Interactive video
•
9th - 12th Grade
10 questions
The Holocaust: Historical Overview
Interactive video
•
9th - 12th Grade
10 questions
Key Features of Quadratic Functions
Interactive video
•
8th - 12th Grade