Home
MCQs
Java MCQs
Iterative Statements
Java MCQs

Java MCQs - Iterative Statements

Iteration is the process where statements are executed repeatedly for specified number and condition. Such statements are known as iterative statements

11. What is the correct output of this program ?

A. 1 2 3 4 5 6 7 8 9 10

B. 0 1 2 3 4 5 6 7 8 9 10

C. 1 2 3 4 5 6 7 8 9 10 11

D. None of above

Answer: A

12. What is the functionality of break statement?

A. To terminate current iteration

B. To continue current iteration

C. To terminate main flow

D. To continue main flow

Answer: A

13. What is the functionality of continue statement?

A. To terminate current iteration

B. To continue current iteration

C. To terminate main flow

D. To continue main flow

Answer: B

14. What is difference between do while loop and while loop in Java?

A. for loop runs once even conditional clause is false

B. while loop runs once even conditional clause is false

C. do while loop runs once even conditional clause is false

D. All of above

Answer: C

15. What is the correct output of this program ?

A. Run time Error

B. Compile time error

C. Infinite Loop

D. None of above

Answer: C

16. What is the correct output of this program ?

A. Run time Error

B. 1 2 3 4 5 6 7 8 9 10

C. Infinite Loop

D. 0 1 2 3 4 5 6 7 8 9 10

Answer: B

17. What is the correct output of this program ?

A. 1 2 3 4 5 6 7 8 9 10

B. None

C. 1 3 5 7 9

D. Infinite Loop

Answer: C

18. What is the correct output of this program ?

A. None

B. 13

C. 1 3 5 7 9

D. Infinite Loop

Answer: B

19. What is the correct output of this program ?

A. 2 4 6 8 10

B. Compile time error

C. Infinite Loop

D. None

Answer: A