Module 3 - Summary Exercises
Suppose that result is declared as DWORD, and the following MASM code is executed: MOV EAX, 16 MOV EBX, 8 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?
94
In debugging mode, a ____________ is a point in the program where execution will be paused.
A breakpoint
When branching, which register's value changes? (Enter the three-letter register abbreviation only)
EIP
In debugging mode, which function key is will execute a library procedure, then stop on the next instruction after the procedure? F10 F11 F5 F9
F5
If the LOOP instruction sets ECX to zero, a jump to the destination label does take place.
False
(True/False) In debugging mode, the values of watched variables/registers may only be viewed in hexadecimal format.
False It can also be viewed in decimal format
Match the Conditional Jump instruction to its operation. JA JG JNZ JE JC JECXZ - Jump if result is zero - Jump if leftOp > rightOp (unsigned) - Jump if the counter register is zero - Jump if carry flag set - Jump if result is nonzero - Jump if leftOp > rightOp (signed)
JA - Jump if leftOp > rightOp (unsigned) JG - Jump if leftOp > rightOp (signed) JNZ - Jump if result is nonzero JE - Jump if result is zero JC - Jump if carry flag set JECXZ - Jump if the counter register is zero
Given the following data declarations and code (within main), what is printed to the console window? .data yes BYTE "Yes",0 no BYTE "No",0 maybe BYTE "Maybe: ",0 .code MOV EAX, 20 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
Maybe: No - Be careful the the semi colons and the spaces. Might be wise to copy paste these
Given the following data declarations and code (within main), what is printed to the console window? .data yes BYTE "Yes",0 no BYTE "No",0 .code MOV EAX, 5 CMP EAX, 5 JG _print Yes MOV EDX, OFFSET no JMP _finished _printYes: MOV EDX, OFFSET yes _finished: CALL WriteString
No
Correctly match the status flags to their description. 1.) The Carry flag 2.) The Overflow flag 3.) destination 4.) The Sign flag 5.) The Zero flag 6.) The Parity flag -set when the result of a signed arithmetic operation is too large or too small to fit into the -set when the result of an arithmetic or logical operation generates a negative result. -set when the result of an arithmetic or logical operation generates a result of zero. -set if the least-significant byte in the result contains an even number of 1 bits. -set when an unsigned arithmetic operation generates a carry (or borrow) out of the most significant bit of the result
The Carry flag - set when an unsigned arithmetic operation generates a carry (or borrow) out of the most significant bit of the result 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. -The Zero flag set when the result of an arithmetic or logical operation generates a result of zero. The Parity flag -set if the least-significant byte in the result contains an even number of 1 bits.
(True/False) In debugging mode, the contents of internal memory and registers can be viewed when a breakpoint is encountered.
True
Conditional jumps check flags in which register before jumping? a.) branch register b.) status register c.) address register d.) control register
b.) status register
A loop which executes at least one time, and possibly more, is called a... once-or-more loop pre-test loop multiples loop post-test loop
post-test loop