Java_Loops_MCQs
Java_Loops_MCQs
a) for loop
b) while loop
c) do-while loop
d) foreach loop
a) 012
b) 123
c) 345
d) Error
a) 01
b) 02
c) 012
d) 02
10. Which loop is ideal for situations where the number of iterations is known?
a) while loop
b) do-while loop
c) for loop
d) None of the above
a) 54321
b) 12345
c) 55555
d) Error
a) Yes
b) No
13. What is the correct way to write an infinite loop using a while statement?
a) while (true) { }
b) while (false) { }
c) while (1) { }
d) while (0) { }
a) for loop
b) while loop
c) do-while loop
d) None of the above
a) 0123
b) 012
c) 01
d) 0
int count = 0;
count++;
System.out.println(count);
a) 10
b) 15
c) 20
d) 25
a) 123
b) 012
c) 345
d) Error