CS 271 Midterm
Which library procedure locates the cursor at a specific row and column on the screen?
Gotoxy
(T/F) When an argument is passed by value, a copy of the address is pushed on the stack.
False
A stack is also called a FIFO structure (First-In, First-Out) because the last value put into the stack is always the first valuetaken out.
False
Adding 0FFh and 05h in an 8-bit register sets the Overflow flag.
False
Code labels may only appear on lines with no instructions.
False
Given an odd-parity system which checks parity 16 bits at a time, the following data would be flagged as having an error. 1101 1011 0010 1010
False
If the LOOP instruction sets ECX to zero, a jump to the destination label does take place.
False
MASM is case-sensitive
False
System endianness will impact the ordering (indexing) of elements in an array.
False
The Stack Segment register always points to the top of the runtime stack.
False
An Assembly Language is defined by the
Instruction Set Architecture (ISA)
Which library procedure sets the Zero flag if the AL register contains the ASCII code for a decimal digit (0-9)?
IsDigit
JA
Jump if leftOP > rightOP (unsigned)
JE
Jump if zero
What does the END directive do? (Check all that apply)
Marks the end of the module, Sets the entry point (procedure) for the program
Arrays are passed by reference to avoid copying each element into the stack/registers.
True
By default, code labels are visible only within the procedure in which they are assigned (created).
True
Given an odd-parity system which checks parity 16 bits at a time, the following data would be flagged as having an error. 1111 1001 1011 1000
True
In a Von Neumann architecture, each instruction in a program may be individually addressed and accessed.
True
One cause of bit errors is signal noise.
True
When values are received by a called subroutine, they are called
parameters
In debugging mode, which of the following (when typed into the memory window's address bar) will directly jump to the first memory address of variable userName?
&userName
10110010 + 10100001
101,010,011
Complete the following Unsigned Binary Addition (answers should also be in Binary): 10110010 + 10100001
10101 0011
The stack frame inside a procedure is also known as the
Activation Record
Convert the following ASCII hex representation to a character string: 41 77 65 73 6F 6D 65
Awesome
Which of the following instructions always modify the ESP register? (Check all that apply)
CALL, RET, POP, PUSH
Which answer choice shows the correct values of the Carry, Zero, and Sign flags after the following instructions execute? mov al,00110011btest al,2
CF = 0, ZF = 0, SF = 0
Adding 5 to 0FBh in an 8-bit register sets the Zero flag.
True
Values passed to a subroutine by a calling program are called
arguments
The byte-ordering scheme which stores integers in memory with the most significant byte at the lowest address (first) is called:
big endian
System endianness affects:
byte-wise ordering
Which of the following CALL instructions writes the contents of EAX to standard output as a signed decimal integer?
call WriteInt
A loop which executes at least one time, and possibly more, is called a
post-test loop
the parity flag
set if the least-significant byte in the result contains an even number of 1 bits
the carry flag
set when an unsigned arithmetic operation generates a carry (or borrow) out of the most significant bit of the result
JG
Jump if leftOp > rightOp (signed)
(T/F) The linker combines object files into an executable file.
True
The MOVSX instruction sign-extends an integer into a larger operand.
True
Place the steps for a memory read in the correct order.
(1) Specify the memory address on the Address Bus via MAR. (2) Assert a Read (3) Wait until operation is complete (4) Move data to its destination
Convert the following signed SWORD to a decimal value. 1100 1101 0011 1100
-12,996
What is the range of decimal values for a signed BYTE?
-128 to 127
Convert the following signed SWORD to a decimal value. 1111 0000 0001 1001
-4,071
Which directive identifies the part of a program containing instructions? Use correct syntax.
.code
Write the syntax to set the size of the runtime stack to 2048 bytes.
.stack 2048
Which of the following binary values is equivalent to hexadecimal 7CBE?
0111 1100 1011 1110
11010010 - 01011100
01110110
Convert the following value from signed decimal to 8-bit binary: -33
1101 1111
What is the largest unsigned integer that may be stored in 24 bits?
16,777,215
What is the minimum size of a data type, in bytes, to be impacted by system endianness. (Whole numbers only)
2
The four-byte hexadecimal sequence 52 A5 8A 80 stored in consecutive memory cells in a little-endian architecture represents ___________ (decimal) when interpreted as a 32-bit unsigned integer.
2,156,569,938
In the following data definition, assume that List2 begins at offset 2000h. What is the offset of the third value (5)? List2 WORD 3,4,5,6,7
2004h
Which list contains the correct hexadecimal translation (in order) of the following unsigned decimal integers? 33, 95, 257
21, 5F, 101
What is the largest signed integer that may be stored in 32 bits?
2^31 - 1
How many bits long is a DWORD (doubleword) on x86 systems?
32
5568 - 1ADC
3A8C
How many bytes long is a DWORD (doubleword) on x86 systems?
4
The RET instruction (without operands) will pop how many bytes off the stack?
4
Convert the following unsigned WORD to a decimal value. 1011 0100 0101 0101
46,165
Convert the following string into its ASCII hex representation: MagicalDon't use 0x or h to represent the hex values.
4D 61 67 69 63 61 6C
The four-byte hexadecimal sequence 65 25 83 03 stored in consecutive memory cells in a little-endian architecture represents ___________ (decimal) when interpreted as a 32-bit signed integer.
58,926,437
Convert the following unsigned WORD to a decimal value. 1111 1010 0000 1111
64,015
Which list contains the correct hexadecimal translation (in order) of the following unsigned decimal integers? 33, 95, 257
6A, 5F, 101
How many bytes long is a QUADWORD on x86 systems?
8
How many bytes long is a SQWORD on x86 systems?
8
Complete the following Unsigned Hexadecimal Addition (answers should also be in Hexadecimal): 2C09 + 571B
8,324
Complete the following Unsigned Hexadecimal Addition (answers should also be in Hexadecimal): 2C17 + 572B
8,342
If you are using an integer constant in one of your CS271 programs, which constant method must you use?
=
An SDWORD storing the integer value -540,000 (FFF7C2A0h) is stored in memory on a little-endian system starting at memory address α. What Hex value is stored at each of the following memory addresses? (A, A+1, A+2, A+3)
A0, C2, F7, FF
What unit on a CPU chip is responsible for computing basic addition and subtraction operations?
ALU
Another name for a stack frame is
Activation record
Convert the following ASCII hex representation to a character string: 41 72 63 68 69 74 65 63 74
Architect
What mechanism is used to turn Assembly Language code to Machine Code?
Assembler
A --- Architecture's instructions are decoded to micro-programs which are executed by the CPU, whereas a --- Architecture's instructions are directly executed by the CPU.
CISC, RISC
Which flag is set when the result of an unsigned arithmetic operation is too large to fit into the destination?
Carry
Language Hierarchy: The purpose of a Compiler is to...
Convert High/Low level Program Code to Assembly/Machine Code
The ________ procedure advances the cursor to the beginning of the next line in the console window.
Crlf
When transferring instructions and data between the Main Memory Unit and the CPU, they will be placed on the Address Bus.
Data
Which library procedure displays the CPU flags and 32-bit registers?
DumpRegs
The ___ register holds the 32-bit address of the next instruction to be fed to the instruction execution cycle.
EIP
When branching, which register's value changes? (Enter the three-letter register abbreviation only)
EIP, IP
Language Hierarchy: Rank the following languages from low level (1) to high level (4).
English, Python, ARM Assembly, Machine Code
In debugging mode, which function key is will execute a library procedure, then stop on the next instruction after the procedure?
F10
In debugging mode, what is the keyboard shortcut to continue execution to the next breakpoint (or to the end of the program if no more breakpoints exist)?
F5
(T/F) Code labels may only appear on lines with no instructions.
False
(True/False) In debugging mode, the values of watched variables/registers may only be viewed in hexadecimal format.
False
High-level languages always pass arrays to subroutines by value.
False
If they did not have error detection/correction, WiFi systems would almost never send/receive signals containing bit errors.
False
The number 117.2 can be represented exactly in IA-32 Floating Point Unit 32-bit IEEE 754 format.
False
x86-64 systems default to big-endian byte ordering.
False
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.
JECXZ
Jump if the counter register is zero
Which of the following statements correct makes a constant integer defining a maximum integer value of 365?
MAXVAL = 365
Which of the following defines a text macro named MESSAGE that contains this string data? "I'm good at this!",0
MESSAGE TEXTEQU <"I'm good at this!",0>
What instruction (with any necessary operands) would pop the top 32 bits of the runtime stack into the EBP register?
POP EBP
What single instruction would I use to save all general purpose registers?
PUSHAD
What instruction would I use to save the current value of the flags register?
PUSHF
If you wanted to find out whether an 8-bit integer contained an even number of 1 bits, which status flag would be useful?
Parity
What would you call an ordered list of organized instructions existing somewhere in memory, and associated with a data structure for storage of data?
Program
The CALL instruction functions similarly to which of the following?
Push, then Jump
Which library procedure generates a 32-bit pseudorandom integer in a caller-specified range?
RandomRange
Which library procedure reads a 32-bit signed decimal integer from standard input?
ReadInt
Which of the following are normally part of the stack frame? (Select all that apply)
Saved Register Values, Arguments, Local Variables, Return Address
the overflow flag
Set when the result of a signed arithmetic operation is too large or too small to fit into the destination
Identify the sizes (in bits) of the sign, biased exponent, and normalized mantissa for a Single Precision x86 floating point value.
Sign: 1 bits, Biased Exponent: 8 bits, Normalized Mantissa: 23 bits
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.
A stack frame is
The area of the stack set aside for passed arguments, return address, local variables, and saved registers.
Match the Instruction Execution steps to the correct order and description.
The control unit (1) fetches the next instruction from queue, (2) increments instruction pointer (IP), (3) decodes the instructions function. (4) the instruction uses an input operand from memory, (5). ALU executes the instruction, (6) if output operand is in memory, the control unit uses write operation to store data
(T/F) In MASM all text following a semicolon (on the same line) is treated as a comment and ignored when the program is converted to machine code.
True
(T/F) The MOVSX instruction sign-extends an integer into a larger operand.
True
(True/False) Higher level languages are more likely to be portable than lower level languages.
True
A primary limitation on the speed of internal communication on a machine is the width of the internal bus.
True
A subprocedure's stack frame contains the return address and its local variables.
True
Adding 7Fh and 05h in an 8-bit register sets the Overflow flag.
True
An IEEE 754 Floating Point value contains three components: a sign, a normalized mantissa, and an biased exponent
True
An argument passed by reference consists of a memory address offset
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
In the IA32 architecture, ESP (the stack pointer) is incremented each time data is pushed onto the stack.
True
In the IA32 architecture, the top item on the stack will always have a lower memory address than the bottom item.
True
Passing by reference requires accessing a parameter's offset from inside the called procedure.
True
The following are both valid data definitions: List1 BYTE 10, 20 BYTE 30, 40
True
What general types of parameters are passed on the stack
Value parameters, Reference parameters
In debugging mode, a ----- is a point in the program where execution will be paused.
breakpoint
In debugging mode, a ___ is a point in the program where execution will be paused.
breakpoint
_____ branching means that we either branch or don't branch depending on the outcome of a logical condition. _____ branching means jumping to another location in the program without checking any conditions.
conditional branching / unconditional
Operands may be any of the following:
constant or constant expression, register name, variable name (memory)
The three types of buses connected to the CPU are
data, address, control
An even parity system requires an ________ number of '1'-bits for parity.
even
JC
jump if carry
JNZ
jump if not zero
The basic parts of an instruction, in order from left to right, are
label, mnemonic, operand(s), comment
A program that combines object files into an executable program is called a
linker
A signed integer stores the sign in
most significant bit (MSB)
Which of the following BYTE declarations are allowed in MASM? (Check all that apply) myByte2 BYTE 'Fancy' myByte1 BYTE "Hot ", 'Dog', 33, 0 myByte4 BYTE "nested 'quotes' " myByte5 BYTE 'W','o','r','s','t','!',0 myByte3 BYTE 'simple 'quotes' '
myByte2 BYTE 'Fancy' myByte1 BYTE "Hot ", 'Dog', 33, 0 myByte4 BYTE "nested 'quotes' "
A/An ________ procedure call occurs when a called procedure calls another procedure before the first procedure returns.
nested
the sign flag
set when the result of an arithmetic or logical operation generates a negative result
the zero flag
set when the result of an arithmetic or logical operation generates a result of zero.
Conditional jumps check flags in which register before jumping?
status register