Select the infinite loop:

ICSE Class 10 Computer Applications PYQ · 2025 Paper · Section A

1(vii)1 Mark · 2025 · Section A · 2025 Paper

Select the infinite loop:

Show SolutionHide Solution↓

for(int i = 2; i != 0; i -= 3)

Reason — The loop for(int i = 2; i != 0; i -= 3) is an infinite loop because the value of i starts at 2 and decreases by 3 in every iteration. Since i will never become 0 (it will take values like 2, -1, -4, -7, etc.), the condition i != 0 will always be true. Therefore, the loop will continue to run forever.

← Previous questionNext question →

Browse the free Computer Applications sample bank