FInal

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

17

. 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 8 5 3 17

511 words

. In a JSR instruction, what is the maximum offset you can jump to from the JSR instruction location: 511 words 1023 words 255 words 63 words

False

A single assembly language name for an opcode can be translated into two machine language codes(T/F)

assembly time

An LC-3 instruction ADD R6,R7,R8 produces an error. It will be caught at assembly time link time run time

False

Every assembly language instruction must contain a label(T/F)

True

In the LC-3, the JSRR instruction can jump to any memory location, from x0000 to xFFFF.(T/F)

False

The TRAP instruction performs exactly the same function as the JSR instruction.(T/F)

No instruction can restart the clock.

Which instruction in the LC-3 restarts the clock? TRAP x30 RESTART CLK_ST No instruction can restart the clock.

71

. A stack machine performs the following sequence of operations. What is the final result popped: push 5 push 3 add push 9 push 7 multiply add pop 71 128 31 24

True

A comment in the instruction never affects the translation of that instruction(T/F)

True

In the LC-3, the clock is stopped by invoking the HALT subroutine via the TRAP instruction.(T/F)

False

The "peek" subroutine returns the value of the topmost element of the stack without changing the stack. Thus, the only error checking we need to do is to check for overflow.(T/F)

9

A peek subroutine is defined as one that returns the value of the top of the stack without removing the element from the stack. After the following sequence of operations, what result is last popped off the stack? push 5 push 3 push 9 peek push 4 pop peek pop 5 3 9 4

True

A programmer usually finds that it takes longer to find the errors in a program so the program can execute correctly than it takes to write the program in the first place. (T/F)

147

A stack machine performs the following operations. The result after the pop is push 7 push 3 multiply push 4 push 3 add multiply pop 147 84 17 21

True

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.(T/F)

assembly time

An LC-3 instruction ADD R1,R2, #45 produces an error. It will be caught at assembly time link time run time

initialize

An important first step in any algorithm, or computer program, is to _________ all the variables, that is, to put each variable into a known state initialize conditional sequential

d, both a and b

An instruction requires a LABEL if a. it is the target of a branch b. it is the symbolic address of a data element that is referenced c. neither a nor b d, both a and b

x3FFE

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 x4002 x3FFF x3FFE 4001

True

Changing R7 without saving its contents during a service routine is problematic as it destroys the linkage back to the initiating program.(T/F)

True

Every assembly language instruction must contain an OPCODE(T/F)

9

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 3 5 2 9

x4000

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 x4002 x4001 x4000 x4003

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.(T/F)

R6 should be incremented, not decremented.

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

link time

If one module contains the pseudo-op .EXTERNAL A, and no module contains the label A, the error will be detected at assembly time link time run time No answer text provided.

False

In LC-3 Assembly Language, all opcodes must be aligned(T/F)

the decimal value one hundred and one

In LC-3 Assembly Language, the symbol #101 represents the decimal value five the decimal value one hundred and one the hex string 000100000001

False

In a stack with a capacity of 3 elements, three pushes followed by four pops results in an overflow.(T/F)

c. setting a breakpoint at the exit of that module, and executing the RUN command when we enter the module.

In debug mode, if we know for sure one particular module is working correctly, we can save time by: a. disabling all ST instructions in the module so it does not waste time writing to memory. b. single stepping through that module to verify that in fact the module is working correctly. c. setting a breakpoint at the exit of that module, and executing the RUN command when we enter the module.

d. All of the above

In debug mode, one can cause execution of one or more instructions by: a. RUN command b. set breakpoint command, followed by the RUN command c. Single step command d. All of the above

a. deposit command

In debug mode, to simulate external input activity of a program, we use the: a. deposit command b. display command c. clear breakpoint command

True

In debugging a program, one can simulate data entry from the keyboard by setting a breakpoint before the input instruction, and just depositing some value into a register as if it came from the keyboard.(T/F)

True

In finding an error in a program, it is often useful to break down the program execution into modules as a way of narrowing the region where the error must have occurred.(T/F)

g. all of the above

In order to process the instruction LD R1, A a. the location labeled A must appear in the program before the LD instruction b. the location labeled A can appear anywhere in the program c. the location labeled A may not appear in the program provided there is a pseudo-op .EXTERNAL A in the program d. none of the above e. a and c f. b and c g. all of the above

False

In structured programming, one must enter a processing box at exactly one entrance point, but can leave the processing box at up to 4 exit points, depending on the nature of the processing being performed. (T/F)

the ready bit and the interrupt-enable bit

In the KBSR, an interrupt signal is generated by the AND of: the start and stop bits the ready bit and the interrupt-enable bit the ready bit and the start bit the start bit and the interrupt-enable bit

the instruction TRAP x25

In the LC-3, the clock is stopped by: the STOP instruction the instruction TRAP x25 the instruction TRAP x23 the END instruction

Processor

In the LC-3, the decision to opt for polling or interrupt driven I/O is made by the: I/O device Processor Both of them None of them

True

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

False

In the LC-3, when a key on the keyboard is pressed, KBDR holds the 2's complement representation of that key.(T/F)

False

It is more difficult to remember the assembly language name for an opcode than the machine language name for the same opcode(T/F)

To strip off the ascii template, we need to add xFFD0 which is the negative of x0030 (ascii code for 0)

On execution of this program, the user inputs two numbers. Why do we need to add the value ASCII (xFFD0) to the numbers before adding them? .ORIG x3000 TRAP x23 LD R2, ASCII ADD R1, R2, R0 TRAP x23 ADD R0, R0, R2 ADD R0, R0, R1 ASCII .FILL xFFD0 .END To strip off the ascii template, we need to add xFFD0 which is the negative of x0030 (ascii code for 0) The program is wrong. It does not add correctly To convert from hexadecimal to binary The numbers are in 2's complement form

True

One must NEVER use a value stored in a register that one hasn't written to earlier in the execution of the program. (T/F)

The value of the top of the stack

R6 is the stack pointer. What are the contents of R0 after this operation: LDR R0, R6, #0 The stack pointer The value of the top of the stack The value of the bottom of the stack 0

False

Single stepping a segment of a program's execution is almost never useful because it is so tedious and time consuming.(T/F)

x00

The .stringz pseudo-op translates to a sequence of ASCII codes. The last code in the sequence is the ASCII code for the last character in the string the ASCII code of the end of text character No answer text provided. x00

True

The OpNeg subroutine forms the 2's complement negative value of the top value on the stack. It is accomplished by the following sequence of operations: pop the top of the stack, perform the bitwise NOT of this value, add the value 1, push the result on the stack.(T/F)

True

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

False

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.(T/F)

iterative

The ____________ construct is appropriate when a task is repeated again and again until some test says otherwise. iterative sequential conditional

False

The bits [11:0] of the RET instruction specify the address to return to.(T/F)

True

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.(T/F)

False

The data accessed by an assembly language program must be part of the same module that contains the instructions that specify the accesses(T/F)

Number of cycles required to execute the instruction

The following is not a part of an assembly language instruction LABEL OPCODE OPERANDS COMMENT Number of cycles required to execute the instruction

x4233

The instruction TRAP x23 at location x4232, causes R7 to be loaded with: x4232 x4233 contents of x4232 contents of x4233

False

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

the contents of x0025

The instruction TRAP x25 causes the PC to be loaded with the memory address: x0025 x2500 the contents of x0025 x0250

True

The only difference between JSR and JSRR is the addressing mode used for evaluating the starting address of the subroutine(T/F).

a. sequential

The structured programming construct that executes one part of a task completely before moving to the next part of the task and never returns to the first part is: a. sequential b. conditional c. iterative

c. iterative

The structured programming construct that executes the same sequence again and again until told not to is: a. sequential b. conditional c. iterative

sequential, conditional, and iterative

The three constructs of structured programming are sequential, conditional, and iterative Read, Write, Jump Load, Restore and Execution

True

These are the only 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.(T/F)

False

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

False

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

display

To test to see if the program actually computed a result correctly and stored that result in a particular register or memory location we use the __________ command. display deposit command clear breakpoint command

We are modifying the contents of register R7. This destroys the linkage back to the calling program.

What is wrong with the code fragment: .ORIG x3000 AND R0,R0, #0 AND R2,R2, #0 ADD R2,R2, #7 JSR SUB ADD R2,R2, ASCII ADD R0,R2,#0 TRAP x21 SUB ADD R2,R2,#9 ADD R7,R7,#1 RET ASCII .FILL x0030 .END Nothing is wrong, the program outputs 16 We are modifying the contents of register R7. This destroys the linkage back to the calling program. We are adding the x0030 (ascii code for 0), which is unnecessary. TRAP x21 will not work after a subroutine call.

none

Which instruction performs the exact same function as JMP: BRnz BRnp BRnzp none


Set pelajaran terkait

Investment Planning: Portfolio Management & Measures (Module 9)

View Set

Module 4 Ch 8 The Flow of Food: Preparation

View Set

Somatosensory Nervous System (touch, pain, temperature)

View Set