Accenture Accenture Primer Practice Question
Predict the output for the given pseudo code snippet. SET count = 1 While count less than or equal to 5 Print “Hello, world” Count = count + 1 END WHILEAnswer options
A
Prints” Hello, world” 5 times
B
Prints “Hello, world” 6 times
C
loop goes on infinitely
D
Prints “Hello, world” 4 times
Correct answer: Prints” Hello, world” 5 times
Explanation
count starts at 1 and increments to 6 before the condition (count <= 5) fails. The loop body executes for count = 1, 2, 3, 4, 5 — exactly 5 times.