MCQ Practice Single Best Answer Topic: ICSE Computer Application - Class X - Selection Examination - 2024-25 - MCQ - CALCUTTA PUBLIC SCHOOL

Q Give the output of the following code:

for (i = 5; i >= 1; i--) { 
    if (i % 2 == 1) 
        continue; 
    System.out.println(i + " ");
}

Question ID
#23878
Subchapter
ICSE Computer Application - Class X - Selection Examination - 2024-25 - MCQ - CALCUTTA PUBLIC SCHOOL
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A 4 2
  • B 5 3
  • C 10
  • D None of these
Correct Answer: A

Explanation

Explanation:

 

The loop starts at i = 5 and decrements by 1 each time.

The if (i % 2 == 1) condition checks if i is odd. If true, it skips the current iteration using continue.

Only even numbers (4 and 2) are printed.

Share This Question

Share this MCQ with your friends or study group.