Computer Applications
Which of the following is an empty loop?
- for(i = 0; i < 5; i++);
- while (i < 5) i++;
- do {i++;} while (i < 5);
- All of these
Java Iterative Stmts
5 Likes
Answer
for(i = 0; i < 5; i++);
Reason — The statement for(i = 0; i < 5; i++); has a semicolon at its end. Thus, any statement following it will be treated as outside the for loop.
Answered By
1 Like
Related Questions
Which of the following is an invalid loop?
- repeat
- while
- do-while
- for
Which of the following statement causes complete termination of the loop?
- continue
- jump
- break
- terminate
Which of the following is not a jump statement in Java?
- return
- jump
- break
- continue
How many times will the following code print "Java"?
for (int i = 1; i <= 5; i ++); { System.out.println("Java"); }- 0
- 1
- 5
- 4