Multiple choice technology mainframe

A = 0, B = 9….. Perform until a > b Add 2 to a End-perform How many additions are performed?

  1. 5

  2. 4

  3. 3

  4. 6

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Starting with a = 0 and incrementing by 2 each loop, the loop continues while a ≤ b (b = 9). The values of a become 2, 4, 6, 8, and 10; after the fifth addition a exceeds b and the loop stops. Therefore five additions are performed.