NEW
Font size
WorksheetsARM Instructions Set Quiz
Total questions: 30
Worksheet time: 34mins
Which of the following is a conditional branch instruction?
BX
BNE
BL
SWI
Which of the following best describes the role of the Program Counter (PC) in an ARM processor?
It stores the result of arithmetic operations
It holds the current status flags (N, Z, C, V)
It contains the memory address of the next instruction to execute
It is used to perform logical AND operations
What must be done before calling another subroutine to preserve the Link Register?
Push LR to the stack
Pop LR from the stack
Reset LR to zero
Store LR in a general-purpose register
What is a unique feature of the ARM instruction set regarding execution?
Only branch instructions can be conditional
Instructions cannot be executed in parallel
All instructions are executed unconditionally
Instructions can be made conditional
What does the SWI instruction do in ARM?
Stores data in memory
Executes a conditional jump
Branches to a subroutine
Performs a software interrupt
In the context of ARM, what does the term 'nested subroutines' refer to?
Subroutines that execute in parallel
Subroutines that call other subroutines
Subroutines that call themselves
Subroutines that do not return
What is the result of the instruction 'ADDEQ r3,r2,r4' if the condition is not met?
r3 is set to zero
r3 is set to r2 - r4
r3 remains unchanged
r3 is set to r2 + r4
Which instruction is used to return from a subroutine in ARM?
SWI
BL
BNE
BX LR
Which of the following conditions can be checked using conditional branch instructions?
Greater Than
Less Than or Equal To
Not Equal
All of the above
What is the effect of using 'PUSH {LR}' before calling another subroutine?
It branches to the subroutine
It loads a new value into LR
It clears the LR register
It saves the current value of LR to the stack
What does the instruction 'MLA r3,r4,r2,r8' do?
Multiplies r4 and r2, then adds r8
Branches to a label
Adds r4 and r2, then multiplies by r8
Loads a value into r3
CMP r1, r2
BEQ equal_label
What happens if r1 == r2?
It skips the next instruction
It branches to equal_label
It stops execution
It stores r1 in r2
What does the following program compute if r2 = 0 and r4 = 0?
CMP r2, #0
BNE S1
S1: CMP r4, #0
ADDEQ r3, r2, r4
ADDEQ r3, #12
r3 = 12
r3 = r2 + r4 + 12
r3 = r2 - r4
r3 = 0
What is the function of CMP r2, #0 followed by BEQ label?
Branch to label if r2 > 0
Branch to label if r2 == 0
Always branch to label
Compare and jump if negative
In this code:
CMP r2, r4
BNE S1
S1: CMP r4, r7
MLA r3, r4, r2, r8
What condition ensures execution of MLA?
r2 != r4
r4 == r7
r4 != r7
r2 == r7
Consider this logic:
CMP r2, #0
CMPEQ r4, #0
ADDEQ r3, r2, r4
SUBEQ r3, #12
When will SUBEQ execute?
When r2 == 0 only
When r4 == 0 only
When both r2 and r4 == 0
Never
What is the content of LR after executing BL func?
MOV r0, #1
BL func
MOV r1, #2
func:
ADD r0, r0, #1
BX LR
Address of func
Address of BX LR
Address of instruction after BL func
0x00000000
Which is the correct way to preserve the return address in a nested subroutine call?
MOV LR, PC
LDR LR, [SP]
PUSH {LR} before next BL
No need to preserve
What will happen in this sequence?
BL func1
BL func2
func1:
ADD r0, r0, #1
BX LR
func2:
SUB r0, r0, #1
BX LR
Only func1 executes
func2 overwrites LR; return address lost from func1
func1 and func2 execute properly
func1 doesn’t return
MOV R0, #5
MOV R1, #0x2000
STR R0, [R1]
LDR R2, [R1]
What will be the value stored in R2?
5
0x2000
0
10
MOV R0, #0x3000
MOV R1, #10
STR R1, [R0], #4
LDR R2, [R0]
Assume memory at 0x3004 contains 0x12345678.
What is the value of R2 after execution?
10
0x3004
0x12345678
0
MOV R0, #0x4000
LDMIA R0, {R1, R2, R3}
Assume memory:
0x4000 = 0xAAAA0001
0x4004 = 0xBBBB0002
0x4008 = 0xCCCC0003
What will be the values of R1, R2, and R3 after execution?
R1=0xAAAA0001, R2=0xBBBB0002, R3=0xCCCC0003
R1=0x4000, R2=0x4004, R3=0x4008
R1=0x00000001, R2=0x00000002, R3=0x00000003
All registers remain unchanged
MOV R0, #0xF0
MVN R1, R0
What value is stored in R1?
0xF0
0xFFFFFF0F
0x0000000F
0xFFFFFFF0
MOV R1, #0x80
LSR R2, R1, #2
What is the result in R2?
0x20
0x40
0x08
0x10
MOV R0, #15
MOV R1, #5
SUB R2, R0, R1
ADD R3, R1, R2
What is the value in R3 after execution?
15
10
5
20
MOV R1, #0x0F
MOV R2, #0xF0
AND R3, R1, R2
ORR R4, R1, R2
What will be the values in R3 and R4?
R3 = 0xF0, R4 = 0x0F
R3 = 0x00, R4 = 0xFF
R3 = 0xFF, R4 = 0x00
R3 = 0xF0, R4 = 0xFF
MOV R0, #10
MOV R1, #5
ADD R2, R0, R1
MOV R3, #0x2000
STR R2, [R3]
LDR R4, [R3]
What is the final value stored in R4?
10
5
15
0x2000
MOV R0, #3
MOV R1, #4
BL multiply
MOV R4, R2
multiply:
MUL R2, R0, R1
BX LR
What is the value of R4 after execution?
7
12
0
1
MOV R1, #2
LSL R2, R1, #2
ADD R3, R2, #1
What is the final value in R3?
9
10
8
7
MOV R1, #10
MOV R2, #15
CMP R1, R2
BGT greater
MOV R3, #0
B end
greater:
MOV R3, #1
end:
What is the value in R3 after execution?
0
15
1
10
