CS271 Full
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
Convert the following signed SWORD to a decimal value. 1111 1111 0000 1010
-246
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
Complete the following Unsigned Binary Addition (answers should also be in Binary): NOTE: Canvas may add thousands place commas (for example 11001100 may appear as 11,001,100) ... Please ignore these. 10110010 + 00100001 ----------
11,010,011
Complete the following Unsigned Binary Addition (answers should also be in Binary): NOTE: Canvas may add thousands place commas (for example 11001100 may appear as 11,001,100) ... Please ignore these. 10110011 + 00110001 ----------
11,010,011
Complete the following unsigned Binary Subtraction: 10010110 - 01111001 ----------
11101
Complete the following unsigned Binary Subtraction: 01011110 - 01001111 ---------- NOTE: Represent answer as an 8-bit value, with no spaces or characters other than 0s and 1s.
1111
The following data segment starts at memory address 1100h (hexadecimal) .data printString BYTE "MASM is fun",0 moreBytes BYTE 48 DUP(0) dateIssued DWORD ? dueDate DWORD ? elapsedTime WORD ? What is the hexadecimal address of dueDate?
1140h
How many binary digits are represented by a series of 3 hexadecimal characters?
12
Suppose that result is declared as DWORD, and the following MASM code is executed: MOV EAX, 23 MOV EBX, 14 MOV ECX, 6 _label5: ADD EAX, EBX ADD EBX, 2 LOOP _label5 MOV result, EAX What is the value stored in the memory location named result?
137
How many binary digits are represented by a series of 4 hexadecimal characters?
16
WORD
16 bit unsigned integer
What is the largest unsigned integer that may be stored in 24 bits?
16,777,215
SWORD
16-bit signed integer
The following data segment starts at memory address 1700h (hexadecimal) .data printString BYTE "Assembly is fun",0 moreBytes BYTE 19 DUP(0) dateIssued DWORD ? dueDate DWORD ? elapsedTime WORD ? What is the hexadecimal address of dueDate?
1727h
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
Convert the following signed SWORD to a decimal value. 0111 0101 1010 1011
30,123
How many bits long is a DWORD (doubleword) on x86 systems?
32
REAL4
32-bit (4-byte) IEEE short real
SDWORD
32-bit signed integer
DWORD
32-bit unsigned integer
Complete the following unsigned Hexadecimal Subtraction: 83AA - 47AB ------ NOTE: Represent answer as a 16-bit hex (four character) value, with no spaces or characters other than 0-9, A-F.
3BFF
How many bytes long is a DWORD (doubleword) on x86 systems?
4
Convert the following string into its ASCII hex representation: Architect Don't use 0x or h to represent the hex values. For example, the ASCII hex representation for "1+z" is 31 2B 7A
41 72 63 68 69 74 65 63 74
Convert the following string into its ASCII hex representation: Floating Don't use 0x or h to represent the hex values. For example, the ASCII hex representation for "1+z" is 31 2B 7A
46 6C 6F 61 74 69 6E 67
Convert the following unsigned WORD to a decimal value. 1011 0100 0101 0101
46,165
Convert the following unsigned WORD to a decimal value. 1011 1110 0100 1011
48,71
Complete the following unsigned Hexadecimal Subtraction: 6A6F - 1F89 ------
4AE6
REAL8
64-bit (8-byte) IEEE long real
How many bytes long is a QUADWORD on x86 systems
8
BYTE
8 bit unsigned integer
Complete the following Unsigned Hexadecimal Addition (answers should also be in Hexadecimal): NOTE: Canvas may add thousands place commas (for example 9C4B may appear as 9,C4B) ... Please ignore these. 2C37 + 571B ------
8,352
Complete the following Unsigned Hexadecimal Addition (answers should also be in Hexadecimal): NOTE: Canvas may add thousands place commas (for example 9C4B may appear as 9,C4B) ... Please ignore these. 2C17 + 574B ------
8,362
What unit on a CPU chip is responsible for computing basic addition and subtraction operations?
ALU
What mechanism is used to turn Assembly Language code to Machine Code?
Assembler
Which answer choice shows the correct values of the Carry, Zero, and Sign flags after the following instructions execute? mov al,6 cmp al,5
CF = 0, ZF = 0, SF = 0
In the IA-32 architecture, which of the following are valid 16-bit register references?
CX SS SP
Convert the following ASCII hex representation to a character string: 43 61 63 68 65 Do not add any spaces. For example, the hex 31 2B 7A represents the string: 1+z
Cache
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
What is the name of the lowest 8 bits of the EDX register?
DL
Which library procedure displays the CPU flags and 32-bit registers?
DumpRegs
After the following MASM code is executed: MOV EAX, 212 MOV EBX, 17 MOV EDX, 0 DIV EBX What is the value in the EAX register (in decimal)? What is the value in the EBX register (in decimal)? What is the value in the EDX register (in decimal)?
EAX: 12 EBX: 17 ECX: 4
After the following MASM code is executed: MOV EAX, 57 MOV EBX, 50 MOV ECX, 50 ADD EAX, EBX SUB EAX, ECX What is the decimal value in the EAX register? What is the decimal value in the EBX register? What is the decimal value in the ECX register?
EAX: 57 EBX: 50 ECX: 50
When branching, which register's value changes? (Enter the three-letter register abbreviation only)
EIP
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
(True/False) Assembly Languages are portable.
False
Adding 0FFh and 05h in an 8-bit register sets the Overflow flag.
False
Changes made to the AL register will not modify the contents of the EAX register.
False
Code labels may only appear on lines with no instructions.
False
If the LOOP instruction sets ECX to zero, a jump to the destination label does take place.
False
MASM is case-sensitive
False
The ASCII code values for alphabetic letters (e.g. 'a') are smaller than for decimal digits (e.g. '1').
False
Please place the following steps of the instruction execution cycle in their proper order.
Fetch the instruction at the address in the instruction pointer into the instruction register Increment the instruction pointer to point to next instruction decode the instruction in the instruction register if the instruction requires memory access, determine the memory access, and fetch the operand from memory into a CPU register, or send operand from a CPU register to memory Execute instruction If output operand is in memory, the control unit uses a write operation to store the data
Compared to higher-level languages, which of the following are benefits of Assembly Language programming? (Check all that apply)
Hands-on Code Optimization Direct Manipulation of Memory
What component is responsible for communication among the various internal CPU components?
Internal Bus
Which library procedure sets the Zero flag if the AL register contains the ASCII code for a decimal digit (0-9)?
IsDigit
Match the Conditional Jump instruction to its operation. JA JG JNZ JE JC JECXZ
JA: Jump if leftOp > rightOp unsigned JG: Jump if leftOp > rightOp signed JNZ: Jump if result is non-zero JE: Jump if result is zero JC: Jump if carry flag is set JECXZ: Jump if the counter register is zero
Given the following partial data segment (lines numbered for convenience), select all line numbers that contain invalid data definitions. Check all that apply. 1 real4 DWORD 5 2 one2? BYTE "step",0 3 Intro BYTE "You can call me "Stevoh"",0 4 1two? BYTE "punch",0 5 One_two BYTE "three o-clock",0
Line 1 Line 3 Line 4
Given the following data declarations and code (within main), what is printed to the console window? (Do not include "quotations" or "Press any key to continue", simply write anything printed with WriteString) .data yes BYTE "Yes",0 no BYTE "No",0 .code MOV EAX, -10 CMP EAX, 4 JG _printYes MOV EDX, OFFSET no JMP _finished _printYes: MOV EDX, OFFSET yes _finished: CALL WriteString
No
Given the following data declarations and code (within main), what is printed to the console window? (Do not include "quotations" or "Press any key to continue", simply write out anything printed with WriteString) .data yes BYTE "Yes",0 no BYTE "No",0 maybe BYTE "Maybe: ",0 .code MOV EAX, 5 CMP EAX, 10 JG _printMaybe _printNo: MOV EDX, OFFSET no JMP _finished _printYes: MOV EDX, OFFSET yes JMP _finished _printMaybe: MOV EDX, OFFSET maybe CALL WriteString CMP EAX, 15 JL _printYes JMP _printNo _finished: CALL WriteString
No
Which directive is used when defining 64-bit IEEE long reals?
REAL8
Which library procedure reads a 32-bit signed decimal integer from standard input?
ReadInt
What storage unit is the closest/fastest on the chip?
Registers
Convert the following ASCII hex representation to a character string: 53 63 69 65 6E 63 65 Do not add any spaces. For example, the hex 31 2B 7A represents the string: 1+z
Science
The Parity Flag
Set if the least-significant byte in the result contains an even number of 1 bits.
The Overflow Flag
Set when the result of a signed arithmetic operation is too large or too small to fit into the destination
The Sign Flag
Set when the result of an arithmetic or logical operation generates a negative result
What does the END directive do? (Check all that apply)
Sets the entry point (procedure) for the program Marks the end of the module
Place the steps for a memory read in the correct order.
Specify the memory address on the Address Bus via MAR Assert a Read Wait until operation is complete. Move data to its destination.
Match the Instruction Execution steps to the correct order and description.
The control unit fetches the next instruction from the instruction queue The control unit increments the instruction pointer The control unit decodes the instructions function to determine what it will do If the instruction uses an input operand located in memory, the control unit uses a read operation to retrieve the operand and copy it into internal registers The ALU executes the instruction using the named registers and internal registers as operands If the output operand is in memory, the control unit uses a write operation to store the data
When using the LOOP instruction, one should be wary of which common issues/problems? (Check all that apply)
Too many instructions in the loop body Overwriting ECX's original value in a nested loop body without preserving its outer loop counter value. Modifying ECX directly within the loop body. Initializing ECX to a value less than or equal to zero.
(True/False) In debugging mode, the contents of internal memory and registers can be viewed when a breakpoint is encountered.
True
By default, code labels are visible only within the procedure in which they are assigned (created).
True
The MOVSX instruction sign-extends an integer into a larger operand.
True
Which library procedure writes an unsigned 32-bit integer to standard output in hexadecimal format?
WriteHex
Given the following data declarations and code (within main), what is printed to the console window? (Do not include "quotations" or "Press any key to continue", simply write anything printed with WriteString) .data yes BYTE "Yes",0 no BYTE "No",0 .code MOV EAX, 10 CMP EAX, 15 JS _printYes MOV EDX, OFFSET no JMP _finished _printYes: MOV EDX, OFFSET yes _finished: CALL WriteString
Yes
Which utility program reads an assembly language source file and produces an object file?
assembler
In debugging mode, a ________ is a point in the program where execution will be paused.
breakpoint
A _______ is a set of parallel wires used to conduct a group of electrical signals simultaneously.
bus
A program is considered portable if it . . .
can be executed on multiple platforms.
Select the pseudo-code that most closely corresponds to the following assembly code. Assume that the variables a, b, c, and d are initialized elsewhere in the program. Pay close attention to the conditional jumps, the corresponding pseudo code may surprise you! Select the pseudo-code that corresponds to the following assembly code. .data ; General purpose variables a SDWORD ? b SDWORD ? c SBYTE ? d SBYTE ? upperLevel SDWORD 18 lowerLevel SDWORD 3 ; Strings yes BYTE "Yes",0 no BYTE "No",0 maybe BYTE "Maybe",0 .code main PROC MOV EAX, a CMP EAX, b JLE option1 JE option2 JMP option3 option1: MOV EDX, OFFSET yes CALL WriteString JMP endOfProgram option2: MOV EDX, OFFSET no CALL WriteString JMP endOfProgram option3: MOV EDX, OFFSET maybe CALL WriteString endOfProgram: exit main ENDP END main
if (a < b) OR (a == b): print (yes) else: print (maybe) Note that the "jle" instruction jumps if the comparison is less than or equal, so the "je" (jump if equal) instruction never jumps
A program that combines object files into an executable program is called a
linker
Select the answer choice that best implements the following expression. Do not permit dword1, ECX, or EDX to be modified: For reference, NEG EAX will replace the value in EAX with its two's complement (e.g. 14d becomes -14d, or -20d becomes 20d). eax = -dword1 + (edx - ecx) + 1
mov eax,dword1 neg eax mov ebx,edx sub ebx,ecx add eax,ebx inc eax
Which of the following BYTE declarations are allowed in MASM? (Check all that apply)
myByte4 BYTE "nested 'quotes' " myByte2 BYTE 'Fancy' myByte1 BYTE "Hot ", 'Dog', 33, 0 myByte5 BYTE 'W','o','r','s','t','!',0
Select a data definition statement that creates an array of 500 signed doublewords named myList and initializes each array element to the value -1.
myList SDWORD 500 DUP (-1)
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
A ______ is a container for data which resides on the CPU chip.
register
The two's complement of an binary value is formed by which process?
reversing (inverting) the bits and adding 1
The Carry Flag
set when an unsigned arithmetic operation generates a carry (or borrow) out of the most significant bit of the 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
The MASM assembler is used for locating ________ errors, but the debugging system is used for locating __________ errors.
syntax logic, run-time, or execution
A primary limitation on the speed of internal communication on a machine is the width of the internal bus.
true
The linker combines object files into an executable file.
true
The status flags are implemented as individual bits within the Status & Control Register.
true