
Java Control Statements MCQs

Quiz
•
Computers
•
University
•
Hard
Mohd. Khan
Used 1+ times
FREE Resource
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int x = 5; if (x > 2) if (x < 10) System.out.println("A"); else System.out.println("B");
A
B
Compilation error
No output
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int i = 0; while (i < 3) { System.out.print(i + " "); i++; }
0 1 2
1 2 3
0 1 2 3
Infinite loop
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int a = 10; do { System.out.print(a + " "); a -= 3; } while (a > 0);
10 7 4 1
10 7 4
10 7
Infinite loop
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
for (int i = 1; i <= 5; i++) { if (i == 3) break; System.out.print(i + " "); }
1 2 3
1 2
1 2 3 4 5
3
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
for (int i = 1; i <= 3; i++) { for (int j = 1; j <= 2; j++) { System.out.print(i * j + " "); } }
1 2 2 4 3 6
1 2 4 8 12
1 2 2 3 3 4
1 1 2 2 3 3
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int x = 4; switch (x) { case 1: System.out.println("One"); case 2: System.out.println("Two"); default: System.out.println("Default"); }
One
Default
Two Default
Default only
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int i = 1; while (i <= 5) { if (i == 3) continue; System.out.print(i + " "); i++; }
1 2 3 4 5
1 2 4 5
Infinite loop
1 2 3 4
Create a free account and access millions of resources
Similar Resources on Wayground
30 questions
Roll-a-coaster

Quiz
•
University
25 questions
C PROGRAMMING

Quiz
•
University
35 questions
IT-OOPRGO21 PRELIM

Quiz
•
University
31 questions
Java Basics

Quiz
•
University
25 questions
BASIC PROGRAMMING

Quiz
•
University
30 questions
Quiz on C

Quiz
•
University
30 questions
Coding Club_SNSCE Quiz (28-04-2023)

Quiz
•
University
25 questions
Arduino coding language

Quiz
•
9th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

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

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University