CS 271 final
Which of the following postfix expressions corresponds to the given infix expression? 1 + 2 * (4 - 2) / 4 ^ (1 + 1)
1 2 4 2 - * 4 1 1 + ^ / +
Which of the following postfix expressions corresponds to the given infix expression? (1 + 4 / 2 + 1 + 2) * 3 / 2
1 4 2 / + 1 + 2 + 3 * 2 /
Please place the following components of the stack frame in the order in which they should be pushed (or room made for them) on the stack.
1. passed parameters 2. procedure return address 3. old EBP value 4. local variables 5. saved registers
The following instruction will increment the stack pointer ( ESP ) by how many bytes? ret 7
11
Which of the following postfix expressions corresponds to the given infix expression? (13 + 14 - 3 + 2) / 2 ^ 3
13 14 + 3 - 2 + 2 3 / ^
The following instruction will increment the stack pointer (ESP) by how many bytes? ret 11
15
Which of the following infix expressions corresponds to the given postfix expression? 2 3 ^ 5 4 * / 10 +
2 ^ 3 / (5 * 4) + 10
Which of the following infix expressions corresponds to the given postfix expression?
3 * 3 - 5 / (4 * 2)
Which of the following infix expressions corresponds to the given postfix expression? 3 5 4 2 3 6 / * - ^ +
3 + 5 ^ (4 - 2 * 3 / 6)
Which of the following infix expressions corresponds to the given postfix expression? 3 4 - 3 2 4 2 - + ^ -
3 - 4 - (3 ^ (2 + 4 - 2))
The RET instruction (without operands) will pop how many bytes off the stack?
4
Which of the following postfix expressions corresponds to the given infix expression? 56 / (42 * 4 * 2) + (256 / (128 - 64)) * 3 ^ 12
56 42 4 * 2 * / 256 128 64 - / 3 12 ^ * +
Given list, an array of WORDs, what element is addressed by list[8]?
5th Element
Suppose that you are given the following partial program. Inside someProcedure, what numerical operand should be used with the RET instruction? (e.g. RET n, what should n be? .data x DWORD 153461 y WORD 37 z WORD 90 .code main PROC PUSH x PUSH y PUSH z CALL someProcedure INC EAX MOV EBX, z XOR EAX, EBX exit main ENDP
8
Register Indirect addressing is defined as follows:
Accessing memory through an address stored in a register
The stack frame inside a procedure is also known as the ____________.
Activation Record
Another name for a stack frame is
Activation record
Which of the following are normally part of the stack frame?
Arguments Local variables Saved register values Return address
Which of the following string primitives will compare the BYTEs stored in the memory locations pointed to by EDI and ESI?
CMPSB
What is the purpose of the CLD instruction?
Clear direction flag - string primitives will increment ESI/EDI
The RET instruction pops the top of the stack into what register?
EIP
Which instruction is used to convert an integer value to float and push it onto the FPU stack?
FILD
Which instruction is used to initialize the FPU?
FINIT
An input/output parameter may be passed by value.
False
As the number of parallel processors goes to infinity, the runtime of any algorithm will approach 0.
False
High-level languages always pass arrays to subroutines by value
False
High-level languages always pass arrays to subroutines by value.
False
If the string direction flag is not set, string operations will move backward through the string.
False
PUSHF is used to preserve all general purpose register contents on the stack.
False
Simple parity checks can correct any single-bit errors
False
The IA-32 FPU FLD instruction can only load in REAL10 floats, not REAL4 or REAL8.
False
The IA-32 FPU is directly connected to the ALU via internal bus.
False
The REP prefix checks the value of ECX but will not modify it.
False
The REP prefixes may be used with most instructions (MOV, CMP, ADD, etc...).
False
The following two instructions are equivalent. 1. RET 2. RET 4
False
When an argument is passed by value, a copy of the address is pushed on the stack
False
When passing parameters to a procedure on the stack, it is usually okay to change the value of the EBP register within the procedure after building the stack frame.
False
Which of the following is true about the POP instruction?
It copies the data pointed to by the stack pointer into the operand, and then increments the stack pointer (by 2 or 4).
Which of the following is true about the PUSH instruction?
It decrements the stack pointer (by 2 or 4), and then copies the operand into the stack at the location pointed to by the stack pointer.
Which of the following string primitives will copy a BYTE from the memory location pointed to by ESI to the AL register?
LODSB
Given the following register states, and using Base+Offset Addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contains the address (OFFSET) of the first element of list. ESI register contains the address (OFFSET) of the eleventh element of list. EBX register contains the value 40.
MOV EAX, [EDX + EBX]
Given the following register states, and using Register Indirect addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contains the address (OFFSET) of the first element of list. ESI register contains the address (OFFSET) of the eleventh element of list. EBX register contains the value 40
MOV EAX, [ESI]
Given the following register states, and using Indexed Operands addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contains the address (OFFSET) of the first element of list. ESI register contains the address (OFFSET) of the eleventh element of list. EBX register contains the value 40.
MOV EAX, list[EBX]
Which of the following code sequences assigns the value 10 to EBX ?
MOV EDX, 20 PUSH EDX MOV ECX, 10 PUSH ECX POP EBX POP EDX
Which of the following string primitives will copy a BYTE from the memory location pointed to by ESI to the memory location pointed to by EDI?
MOVSB
Which of the following string primitives will modify the ESI register?
MOVSB CMPSB LODSB
Which structure is the following true for? For _________, arguments are substituted exactly as entered, without checking for memory, registers, or literals.
Macros
Which structure is the following true for? For _________, the entire code is substituted for each call.
Macros
The _________ operator returns the distance in bytes, of a label from the beginning of its enclosing segment, added to the segment register
OFFSET
The _________ operator overrides the default type of a label (variable), and can also be used to combine elements of a smaller data type and move them into a larger operand.
PTR
Which of the following instructions modify the ESP register?
PUSH CALL POP RET
What single instruction would I use to save all general purpose registers?
PUSHA PUSHAD
What instruction would I use to save the current value of the flags register?
PUSHFD PUSHFQ PUSHF
What parameter-passing method do most/all of Irvine's library procedures use?
Pass Parameters in Registers
Which structure is the following true for? _________ are translated only once, and can be called many times.
Procedures
Which structure is the following true for? _________ have a calling mechanism involving the EIP.
Procedures
Which structure is the following true for? _________ have a return mechanism involving the system stack.
Procedures
The CALL instruction functions similarly to which of the following?
Push, then Jump
In general, ______ instructions execute faster then _______ instructions
RISC CISC
The _________ operator returns a value that is equivalent to multiplying the number of elements in a single data declaration by the size, in bytes, of a single element of a data declaration.
SIZEOF
Which of the following string primitives will copy a BYTE from the AL register to the memory location pointed to by EDI?
STOSB
What is the purpose of the STD instruction?
Set direction flag - string primitives will decrement ESI/EDI
What advantages do stack parameters have over register parameters?
Stack parameters reduce code clutter because registers do not have to be saved and restored Stack parameters are compatible with high-level languages
The _________ operator returns the size, in bytes, of a single element of a data declaration
TYPE
A stack frame is _____
The area of the stack set aside for passed arguments, return address, local variables, and saved registers.
A subprocedure's stack frame contains the return address and its local variables
True
An argument passed by reference consists of a memory address offset
True
An input parameter may be passed by reference
True
In the IA32 architecture, ESP (the stack pointer) is incremented each time data is popped from the stack
True
Mechanically speaking, the CALL instruction pushes its return address on the stack and copies the called procedure's address into the instruction pointer.
True
Multiprocessor Parallelism usually has lower coordination overhead than Multicomputer Parallelism
True
One of the primary design principles of RISC is to avoid micro-programs and have instructions be directly executed.
True
Passing by reference requires accessing a parameter's offset from inside the called procedure.
True
Simple parity checks can detect any odd number of errors in a bit stream.
True
The REPNE prefix checks the value of the Zero flag but requires its operand-instruction (the instruction which follows it) to modify the flag.
True
What general types of parameters are passed on the stack?
Value parameters Reference parameters
If you reference a point beyond the end of an array in MASM (for example, the address of the what would be the 105th element of a 100-element array), what happens?
You attempt to access whatever data bytes are stored there.
Values passed to a subroutine by a calling program are called __________.
arguments
Arrays elements are stored in ____________ memory.
contiguous
Which of the following portions of a program can complicate the instruction-caching process?
decision structures, repetition structures, branching
An even parity system requires an ________ number of '1'-bits for parity
even
Assuming that all processor clock speeds are identical, executing a given software algorithm on a multicore processor is always faster than executing the same algorithm on a single-core processor
false
Given an even-parity system, the following data would be flagged as having an error. 1001 1111 0110 1010
false
One of CISC's major limitations is that the instructions cannot be broken down into fast micro-instructions.
false
One of the major limitations of CISC is that its data buses can never be wider than they are now.
false
One of the primary design principles of RISC is to prioritize multi-cycle instructions.
false
Software parallelism is currently much more developed than hardware parallelism.
false
Without error detection / correction, Wifi systems would almost never encounter bit errors
false
Backwards compatibility is where new devices continue to support ____________ operations.
legacy
In __________, each processor has its own individual (distributed) memory and communicate and coordinate through an interconnection network.
multicomputer parallelism
In _________, all processors access the same (shared) memory and communicate and coordinate through an interconnection network
multiprocessor parallelism
A/An ________ procedure call occurs when a called procedure calls another procedure before the first procedure returns.
nested
Which offers a more flexible approach, passing arguments to procedures in registers, or on the stack?
on the stack
When values are received by a called subroutine, they are called __________.
parameters
Select the proper syntax for establishing a subprocedure
procedureName PROC ;... ;... RET ;return to calling procedure procedureName ENDP
ESP always points to ______
the last value to be added to, or pushed on, the top of stack.
Given an odd-parity system, the following data would be flagged as having an error. 1111 1001 1011 1000
true
One cause of bit errors is signal noise.
true
RISC architectures generally have fewer, simpler instructions that run faster than CISC instruction.
true