Question Detail

COS 102 test topic Objective Question

Question

What output is produced by the pseudocode: `FOR k = 1 TO 5 STEP 2: PRINT k`?
Options
A 1, 3, 5
Correct Answer
B 1, 2, 3, 4, 5
C 2, 4
D 1, 3
Correct Answer

Option A is the correct answer.

Detailed Explanation

The loop initializes k at 1 and increments by 2 each cycle, outputting 1, 3, and 5 before stopping.

Hint

No hint available

Question Info