CS271 Through Quiz 2
What are the values of the Carry, Zero, and Sign flags after the following operations: mov al,00110011b test al,2
0, 0, 0
What are the values of the Carry, Zero, and Sign flags after the following operations: mov al,6 cmp al,5
0, 0, 0
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
0, 0, 0
What is the value of the Carry flag after the following instructions? mov al,5h mov bl,10h mul bl
0, empty
What is the value of the Overflow flag after the following instructions? mov al,-4 mov bl,4 imul bl
0, empty
After executing the following instruction sequence, what is the value of AL, in binary: mov al,4Bh and al,6Ch
01001000
What is the value of the Carry flag after the following instructions? .data val1 WORD 2000h val2 WORD 0100h .code mov ax,val1 mul val2
1
What is the value of the Overflow flag after the following instructions? .data word1 SWORD 4 dword1 SDWORD 4 .code imul bx,word1,-16 imul ebx,dword1,-16 imul ebx,dword1,-2000000000
1
What are the values of the Carry, Zero, and Sign flags after the following operations: mov al,5 cmp al,7
1, 0, 1
What are the sizes for the sign bit, exponent, and significand for a DOUBLE precision x86 floating point number?
1, 11, 52
What are the sizes for the sign bit, exponent, and significand for a DOUBLE EXTENDED precision x86 floating point number?
1, 16, 63
1100 0010 1101 is an ODD parity 12 bit Hamming code that contains a single-bit error. What is the corresponding uncorrupted Hamming code?
1001 0010 1101
Select the correct ODD parity 12 bit Hamming code value for the unsigned integer value 137 1010 0001 1001 0111 0000 1001 1010 0000 1001 0111 0001 1001 0011 0000 1001 0010 0001 1001
1010 0001 1001
1010 0111 1010 is an EVEN parity 12 bit Hamming code that contains a single-bit error. What is the corresponding uncorrupted Hamming code? 1010 0101 1010 1011 0111 1010 1010 0111 0010 1110 0111 1010
1010 0111 0010
Select the correct EVEN parity 12 bit Hamming code value for the unsigned integer value 178 0011 0110 0010 0111 0110 0010 1010 0111 0010 1010 0110 0010 1110 0111 0010 0111 0111 0010
1010 0111 0010
After executing the following instruction sequence, what is the value of AL, in binary: mov al,00111100b or al,82h
10111110
After executing the following instruction sequence, what is the value of AL, in hexadecimal mov al,9Ch not al
63
What will be the hexadecimal value of AL after these instructions execute? mov al,94h xor al,37h
A3h
After executing the following instruction sequence, what is the value of AL, in hexadecimal mov al,86h or al,42h
C6h
After executing the following instruction sequence, what is the value of AL, in hexadecimal mov al,72h xor al,0A5h
D7h
In what register will the remainder of the following instruction be found? DIV BX
DX
Which library procedure displays the CPU flags and 32-bit registers? Correct!
DumpRegs
Which register contains an integer before calling WriteDec?
EAX
Where is the result of the following operation stored? MUL EBX
EDX:EAX
Which register contains the starting address of data when calling DumpMem?
ESI
A stack is also called a FIFO structure (First-In, First-Out) because the last value put into the stack is always the first value taken out.
False, LIFO
MASM has built-in range checking for effective addresses.
False. It does NOT range check, so be careful!
Identify which of the following are correct formats for the IMUL instruction. (Check all that apply)
IMUL reg16,reg/mem16 IMUL reg16,reg/mem16,imm8 IMUL reg16,imm16 IMUL reg32,reg/mem32,imm8 IMUL reg16,imm8 IMUL reg32,imm8 IMUL reg32,reg/mem32,imm32 IMUL reg32,reg/mem32 IMUL reg32,imm32 IMUL reg16,reg/mem16,imm16
Carry Flag
Indicates unsigned integer overflow
How does the PUSH instruction operate?
It decrements the stack pointer (by 2 or 4) and copies the operand into the stack at the location pointed to by the stack pointer.
The formal name of the LOOP instruction is
Loop According to ECX Counter
Which of the following is NOT a valid MOV operation? Table 4-1 might be helpful. (check any/all that apply) MOV reg,mem MOV mem,imm MOV mem,reg MOV imm,imm MOV mem,mem MOV reg,reg MOV reg,imm MOV imm,mem
MOV mem, mem (cannot move memory to memory), MOV imm, mem (cannot store anything else in an immutable immediate operand), MOV imm, imm (makes sense, because you can't change the value of immutables)
Identify which of the following are allowed formats for the MUL instruction. (Check all that apply)
MUL reg MUL mem8 MUL mem16 MUL mem32
A/An ________ procedure call occurs when a called procedure calls another procedure before the first procedure returns.
Nested
A procedure is declared using the _____ and ____ directives.
PROC and ENDP
The instructions used to manipulate the ESP register are
PUSH, POP, CALL, RET - because ESP is only used for the runtime stack, upon which only PUSH, POP, CALL, and RET operate
Which library procedure generates a 32-bit pseudorandom integer in a caller-specified range? Correct!
RandomRange
Which library procedure reads a 32-bit signed decimal integer from standard input?
ReadInt
Which library procedure reads a string from standard input?
ReadString
There are several important uses of runtime stacks in programs: When the CALL instruction executes, the CPU saves the current subroutine's return address on the stack. The stack provides temporary storage for local variables inside subroutines. A stack makes a convenient temporary save area for registers when they are used for more than one purpose. After they are modified, they can be restored to their original values. When calling a subroutine, you pass input values called arguments by pushing them on the stack.
See term card.
Which I/O device is used for standard input?
The keyboard
T or F? Mechanically speaking, the CALL instruction pushes its return address on the stack and copies the called procedure's address into the instruction pointer.
True
T or F? The USES operator, coupled with the PROC directive, lets you list the names of all registers modified within a procedure.
True
The MOVZX instruction is only used with unsigned integers.
True
The operand of the MUL (unsigned multiply) instruction can be different sizes.
True, multiplication can be done to different sized things
A common programming error is to inadvertently initialize ECX to zero before beginning a loop (when using the LOOP instruction).
True. Another is inadvertently updating ECX to zero towards the end of a loop and trying to loop again.
Adding 5 to 0FBh in an 8-bit register sets the Zero flag.
True. Be careful with arithmetic!
The MOVSX instruction sign-extends an integer into a larger operand.
True. That's why it's called "move sign extend."
The following instructions will set the Sign flag: mov al,0FEh sub al,2
True. the Sign flag assumes SIGNED numbers, so it registers 0FEh as -2. The result after subtraction is -4.
Which of the following are valid uses of the XCHG instruction? (check any/all that apply) XCHG reg,imm XCHG imm,reg XCHG imm,imm XCHG mem,reg XCHG reg,reg XCHG imm,reg XCHG reg,mem XCHG mem,mem
XCHG mem, reg, XCHG reg, reg, XCHG reg, mem. You cannot use XCHG with immediates, and you cannot use XCHG to move mem to mem.
Sign Flag
is a copy of the high bit of the destination operand, indicating negative if set
Overflow Flag
is set when an instructio generates a result that is out of the signed range of the destination operand
Parity flag
is set when an instruction generates and even number of 1 bits in the lower byte of the destination operand
Zero Flag
is set when the result of an operation equals zero
ESP always points to the ______
last value to be added to, or pushed on, the top of stack.
The Irvine32 library call GetMseconds returns
number of system milliseconds that have elapsed since midnight