0
0
ARM Architectureknowledge~20 mins

Branch instruction (B) in ARM Architecture - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
ARM Branch Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the basic function of the B instruction
What is the primary purpose of the ARM B (Branch) instruction?
ATo perform an arithmetic operation
BTo load data from memory into a register
CTo store data from a register into memory
DTo jump to a different address unconditionally
Attempts:
2 left
💡 Hint
Think about what 'branch' means in programming.
📋 Factual
intermediate
2:00remaining
Range of the Branch instruction offset
What is the maximum range (in bytes) that the ARM B instruction can branch to using its 24-bit signed offset?
A±32 MB
B±16 MB
C±8 MB
D±4 MB
Attempts:
2 left
💡 Hint
Consider that the offset is 24 bits and is shifted left by 2 bits.
🔍 Analysis
advanced
2:00remaining
Effect of B instruction on the program counter
Given the ARM instruction B label, what happens to the program counter (PC) after this instruction executes?
APC is set to the address of <code>label</code>, and execution continues from there
BPC increments by 4 and continues sequentially
CPC is set to the address of <code>label</code> plus 4 bytes
DPC remains unchanged
Attempts:
2 left
💡 Hint
The branch instruction changes where the CPU fetches the next instruction.
Comparison
advanced
2:00remaining
Difference between B and BL instructions
Which statement correctly describes the difference between the ARM B and BL instructions?
AB branches unconditionally; BL branches conditionally
BB branches and saves return address; BL only branches
CB branches unconditionally; BL branches and saves return address in LR
DB branches conditionally; BL branches unconditionally
Attempts:
2 left
💡 Hint
Consider what 'BL' stands for and what it does with the link register.
Reasoning
expert
2:00remaining
Predicting the outcome of a branch with an invalid offset
If an ARM B instruction is encoded with an offset that exceeds its 24-bit signed range, what will happen when the CPU executes it?
AThe CPU will raise a hardware exception immediately
BThe CPU will branch to an incorrect address causing unpredictable behavior
CThe instruction will be ignored and execution continues sequentially
DThe CPU will branch to the nearest valid address within range
Attempts:
2 left
💡 Hint
Think about how the CPU interprets the offset bits in the instruction.