Quiz - Chapter 8 - Data Structures
. In a FIFO data structure, the elements are inserted at the top and removed from the bottom. What is the last value removed after execution of the following: insert 5 insert 3 insert 17 insert 8 remove remove insert 8 remove
17
. In a JSR instruction, what is the maximum offset you can jump to from the JSR instruction location:
511 words
Given an empty stack and this sequence of operations performed on the stack, what is the last value popped? push 5 push 3 push 2 pop push 9 push 3 pop pop
9
In the LC-3, the JSRR instruction can jump to any memory location, from x0000 to xFFFF.
True
Which instruction performs the exact same function as JMP:
none
Assume that the stack grows towards zero, the stack pointer is R6 and contains x4000. What are the contents of R6 after the following operations: push 5 push 4 push 3 push 2 pop pop
x3FFE
If R6 is the stack pointer and contains the value x4001, and R0 contains the value to be pushed onto the stack, what will be the contents of R6 after this push routine: PUSH ADD R6, R6,#-1 STR R0, R6,#0
x4000
In a stack with a capacity of 3 elements, three pushes followed by four pops results in an overflow.
False
The bits [11:0] of the RET instruction specify the address to return to.
False
If R6 is the stack pointer, and the stack grows towards zero, what is wrong with the following pop routine: POP LDR R0,R6,#0 ADD R6,R6,#-1
R6 should be incremented, not decremented.
R6 is the stack pointer. What are the contents of R0 after this operation: LDR R0, R6, #0
The value of the top of the stack
A stack where the stack pointer is updated with every operation is more efficient than a stack where the data moves after each operation since the cost of changing the contents of the stack pointer is much less than the cost of moving all the data.
True
Changing R7 without saving its contents during a service routine is problematic as it destroys the linkage back to the initiating program.
True
If R6 is the stack pointer and each element in the stack occupies two memory locations, a push operation on the stack requires that R6 be decremented by 2.
True
The only difference between JSR and JSRR is the addressing mode used for evaluating the starting address of the subroutine.
True