Bird
0
0

Given the ARM assembly snippet:

medium📝 Analysis Q13 of 15
ARM Architecture - Control Flow Instructions
Given the ARM assembly snippet:
CMP R0, #10
BEQ equal_label
MOV R1, #0
B end_label
equal_label:
MOV R1, #1
end_label:

What value will R1 hold if R0 equals 10?
A0
B10
CUndefined
D1
Step-by-Step Solution
Solution:
  1. Step 1: Analyze CMP and BEQ

    The CMP compares R0 with 10. If equal, BEQ jumps to equal_label.
  2. Step 2: Follow the branch logic

    If R0 is 10, execution jumps to equal_label where R1 is set to 1. Otherwise, R1 is set to 0 before jumping to end_label.
  3. Final Answer:

    1 -> Option D
  4. Quick Check:

    R0=10 triggers BEQ, sets R1=1 [OK]
Quick Trick: If equal, BEQ jumps to set R1=1 [OK]
Common Mistakes:
  • Assuming R1 stays 0
  • Ignoring the branch to equal_label
  • Confusing MOV targets

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes