Bird
0
0

What will be the value in register R2 after executing this ARM assembly loop?

medium📝 Analysis Q5 of 15
ARM Architecture - Control Flow Instructions
What will be the value in register R2 after executing this ARM assembly loop?
MOV R2, #0
MOV R3, #3
loop:
ADD R2, R2, #2
SUBS R3, R3, #1
BNE loop
A3
B0
C6
D9
Step-by-Step Solution
Solution:
  1. Step 1: Understand loop iterations

    R3 starts at 3, loop runs 3 times.
  2. Step 2: Calculate R2 increments

    Each loop adds 2 to R2, so total is 2 * 3 = 6.
  3. Final Answer:

    6 -> Option C
  4. Quick Check:

    R2 = 2 * 3 loops = 6 [OK]
Quick Trick: Multiply increment by loop count for final value [OK]
Common Mistakes:
  • Adding only once
  • Confusing R3 with R2
  • Ignoring loop count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes