Bird
0
0

What is wrong with this ARM code?

medium📝 Analysis Q7 of 15
ARM Architecture - Control Flow Instructions
What is wrong with this ARM code?
CMP r2, #0
BEQ end
MOV r3, #1
end:
ANo error, code is correct
BNo instruction after label 'end'
CMOV instruction is invalid
DBEQ cannot be used after CMP
Step-by-Step Solution
Solution:
  1. Step 1: Verify instruction syntax

    CMP r2, #0 sets flags correctly. BEQ end is valid conditional branch. MOV r3, #1 is correct.
  2. Step 2: Check label

    Label 'end:' has colon and is properly placed at the end; no instruction needed after if it's the program end.
  3. Final Answer:

    No error, code is correct -> Option A
  4. Quick Check:

    All syntax valid, label fine [OK]
Quick Trick: Code assembles without errors [OK]
Common Mistakes:
  • Thinking no instruction after label is error
  • Believing BEQ invalid after CMP
  • Claiming label missing colon

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes