Bird
0
0

Given the following ARM assembly code snippet, what will be the value in register r0 after execution?

medium📝 Analysis Q13 of 15
ARM Architecture - Control Flow Instructions
Given the following ARM assembly code snippet, what will be the value in register r0 after execution?
B skip
MOV r0, #1
skip:
MOV r0, #5
A5
B1
C0
DUndefined
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the branch instruction

    The instruction B skip jumps over the MOV r0, #1 line directly to the label skip.
  2. Step 2: Determine which MOV executes

    Since the jump skips the first MOV, only MOV r0, #5 runs, setting r0 to 5.
  3. Final Answer:

    5 -> Option A
  4. Quick Check:

    Branch skips first MOV, r0 = 5 [OK]
Quick Trick: Branch skips code, so last MOV sets r0 [OK]
Common Mistakes:
  • Ignoring the branch and thinking both MOV run
  • Assuming r0 stays 0 by default
  • Confusing label position

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes