Multiple choice technology mainframe

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

  1. 3

  2. 4

  3. 5

  4. 6

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

The loop executes while a <= b. Initially, a=0, b=9. Additions occur at a=0 (becomes 2), a=2 (becomes 4), a=4 (becomes 6), a=6 (becomes 8), and a=8 (becomes 10). When a becomes 10, a > b (10 > 9) is true, so the loop terminates. Exactly 5 additions are performed.