ICS Quiz 5 - Chapters 9-10

Ace your homework & exams now with Quizwiz!

After the following operations, the contents of the stack, from the top to the bottom, are ____. push 5 push 3 push 9 pop push 8

835

The instruction TRAP x21 loads the PC with the contents stored in memory location _______--

(x0021)??!! Not sure graded inconstantly

Assume R6 is the stack pointer of a stack that grows towards zero. and initially contains the value x4200. After these operations push 7 push 6 pop push 3 pop the value of R6 is ______

x41FF

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 a. x4000 b. x4001 c. x4002 d. x4003

A.

In the LC-3, TRAP x25 halts the clock by: a. Calling the HALT subroutine which clears the RUN latch b. Calling the HALT subroutine which sets the RUN latch c. This instruction does not halt the clock. d. Stopping the clock itself.

A.

A stack implementation where the data entries move with each operation is referred to as a hardware stack. A stack implementation where the stack pointer is updated with each operation is referred to as a software stack. Why is the software stack more efficient than the hardware stack? a. There is no difference b. The data does not have to be copied each time an operation is performed on the software stack c. The hardware stack is more efficient.

B.

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 a. Nothing is wrong b. R6 should be incremented, not decremented c. The value of R6 is written to R0, not the contents of the memory location pointed to by R6 d. R6 should be incremented twice, not once

B.

What does the PC contain on executing JSR FOO in the following code fragment: .ORIG x3000 JSR FOO ADD R0,R4,R2 FOO ADD R0,R0,#1 RET a. x3001 b. x3002 c. x2fff d. x3003

B.

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 a. x4002 b. x3FFF c. x3FFE d. x4001

C.

If R3 contains x5000 and the JSRR instruction is stored in x4000, the value of the PC after execution of JSRR R3 is: a. x4000 b. The contents of memory location x5000 c. x5000 d. The contents of memory location x4000

C.

Given an empty stack and the 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 a. 3 b. 5 c. 2 d. 9

D.

If R4 contains x5000 and the JSRR instruction is stored in x4002, the execution of JSRR R4 causes R7 to be loaded with: a. x5000 b. x5001 c. x4001 d. x4003

D.

What instruction performs the exact same function as JMP a. BRnz b. BRnp c. BRnzp d. None

D.

(T/F) The TRAP instruction stores the address of the instruction following the TRAP instruction in R0 before loading the PC with the starting address of the service routine.

False

(T/F) The instruction TRAP x23 branches off to an address stored in memory location x2300

False

(T/F) To display a number on the monitor, it needs to be converted from an ASCII string to a two's complement integer.

False

(T/F) To perform an add operation on a stack machine, the following steps are taken: two pops, an add and another pop.

False

A _____ is a collection of programs/functions that can be used by application programmers to perform frequent tasks

Library

(T/F) A data structure where the elements are inserted at the top and removed from the bottom is known as a First in First out (FIFO) data structure.

True

(T/F) In the LC-3, the operating system uses the RET instruction to return control to the user program.

True

(T/F) In the LC-3, the user program invokes the OS to perform an I/O operation using the TRAP command.

True

(T/F) The System Control Block or the Trap Vector Table is a set of memory locations which contain the starting addresses of the service routines.

True

(T/F) The calculator uses a stack for arithmetic operations. During an add operation, if the result is beyond the range of representable values, the stack pointer needs to be incremented twice to return the stack to the condition it was in before the add was attempted.

True

(T/F) These are the only two instances that can prevent an add operation on a stack machine from completing successfully: either of the two pops result in an underflow, or the addition is out of range.

True


Related study sets

Intro to C# Programming Lesson 7 Chapter 2

View Set

Texas Principles of Real Estate I - Ch 5

View Set