Comp Sci 260 Midterm
This directive identifies the part of a program containing instructions
.CODE
The byte binary representation of decimal 10
00001010
This is the content of AL after the following instructions execute :::: mov al,11001111b***** and al,00101011b
00001011
This much memory can be addressed in Real-address mode
1 MB
This is the hexadecimal value of AX when this code executes mov esi, OFFSET word1 add esi,4 mov ax,[esi]
2
This flag is set when an unsigned value is too large to fit into a destination operand
Carry
This directive enables block-style comments
Comment
This internal bus uses binary signals to synchronize actions of all devices attached to the system
Control bus
T/F Adding 0FFh and 05h in an 8-bit register sets the Overflow flag.
False
T/F The DS register can be the destination operand of a MOV instruction
False
T/F The SAHF instruction copies the EFLAGS register into a 32-bit memory location
False
This code causes a 500 millisecond delay, using a library procedure
mov eax, 500 ***** call Delay
T/F This code sequence assigns the value 10h to EBX mov edx, 20h push edx mov ecx,10h push ecx pop ebx pop edx
true
After the loop executes these are the values at locations varY, varY+4, and varY+8
0,0,1
If line 9 were changed to mov [esi-4], eax this would be the final values at location varY, varY+4, and varY+8
0,1,2
For lines 2,3,5 and 6, indicate the values of the following Flags: ZF, CF, SF, OF 1. mov al,7Fh 2. add al,2 3. sub al,5 4. mov al,80h 5. add al, 80h 6. neg al
0011 0001 1101 1000
This linear addresses matches the segment-offset address 08F0:0200
09100h
The two registers containing: 1. an integer before calling WriteDec and 2. the starting address of data when calling DumpMem
1. EAX, 2. ESI
This is the content of AL after the following instructions execute :::: mov al,00111100b**** or al,82h
10111110
The hexadecimal representation of 16d
10h
The 8-bit two's complement of binary 00000010
11111110
The values of the following are (TYPE word1) (TYPE dword1) (LENGTHOF word1) (SIZEOF word1)
2,4,3,6
This is the valye of EAX when the following sequence of instructions has executed::::: push 5***** push 10***** push 20***** pop eax
20
In the following data definition, assume that List2 begins at offset 2000h. myValues WORD 3,4,5,6. What is the offset of the third value (5)?
2004h
This much memory can be addressed in Protected mode
4 GB
This is the value of EAX when the following sequence of instructions has executed push 5 push 10 pop ebx pop eax
5
After the loop executes, these will be the values in the last three positions (array elements) of varY
6,7,8
Indicate the hexadecimal value of the destination operand next to each instruction. Use the letter I to indicate that a particular instruction is invalid mov ax,[word3+2] eax,[dword1+4] mov al,[byte1+1] mov eax,[word3+4]
8000h 00000020h 1 invalid
This is the final hexadecimal value of AX when this code executes mov ebx,OFFSET dword1 sub ebx,2 mov ax,[ebx]
9000h
The basic parts of an instruction, in order from left to right, are: a. label, mnemonic, operand(s), comment b. comment, label, mnemonic, operand(s) c. label, mnemonic, comment d. mnemonic, operand(s), comment
A. label, mnemonic, operand(s), comment
This is where within the CPU, all calculations and logic operations take place inside
ALU (Arithmetic Logic Unit)
The expression NOT X AND X
Always false
The expression NOT X OR X
Always true
Given the following array definition, what is a valid constant declaration named ArrayCount that automatically calculates the number of elements in the array? newArray DWORD 10,20,30,40,50
ArrayCount = ($ - newArray)/4
This utility program reads an assembly language source file and produces an object file
Assembler
Which of the following are true about assembly language instructions and directives? a. a directive is executed at runtime b. an instruction is executed at runtime c. a directive is executed at assembly time d. an instruction is executed at assembly time
B and C
This byte=ordering scheme used by computers to store large integers in memory with the high-order byte at the lowest address is called
Big Endian
Which of the following will generate assembly errors? a. var1 BYTE 1101b, 22, 35 b. var2 BYTW "ABCDE",18 c. var3 BYTE '$','98778', d. var4 BYTE 256,19,40
C and D
The two types of real-number constants are: a. decimal, binary b. encoded, binary c. decimal, encoded d. BCD, ASCII
C. decimal, encoded
This high-speed memory reduces the frequency of access by the CPU to conventional memory
Cache memory
This is the value of ECX when the following sequence of instructions has executed::::: push 5**** push 10**** pop ebx**** pop eax**** pop ecx
Cannot be determined
These are the three types of buses connected to the CPU
DATA, ADDRESS, and CONTROL
This directive can be used in place of the BYTE directive for unsigned integers
DB
The name of the lowest 8 bits of the EDX register
DL
Indicate the hexadecimal value of the destination operand next to each instruction. Use the letter I to indicate that a particular instruction is illegal mov dx, word3 movsx eax, byte1 mov dh,al mov bx,dx
DX = 7FFFh EAX = FFFFFFFFh DH = FFh BX = FFFFh
These are two types of labels in assembly language programs
Data Labels and Code Labels
This register is known as a loop counter
ECX
This directive prevents a constant to be redefined in a program
EQU
This two 32-bit registers are known as extended index registers
ESI and EDI
word1 WORD 1000h,2000h,3000h,4000h,5000h dword1 DWORD 10000h,20000h,30000h,40000h This is the final value of AX after this code has executed mov esi, OFFSet word1 mov ecx,5 mov eax,100h L1: add ax,[esi] add ax,16 add esi,TYPE word1 Loop L1
F150h
If you were to multiply 1.5 by 2.6, you use this part of the CPU
FPU (floating point unit)
T/F The MOV instruction permits a move between two memory operands, as long as one operand uses the DWORD PTR operator
False
T/F The compiler decodes and executes one program statement at a time
False
T/F The following instruction will produce 1FFFFFFCh in EAX: movsx eax,-4
False
T/F The following instruction will set the CArry flag: mov al,0FEh sub al,2
False
T/F The following is a valid identifier: AB62-$
False
T/F The sum of all powers of 2 between 20 and 28 is 255
False
This procedure locates the cursor at a specific row and column on the screen
Gotoxy
A map file is produced by this utility programs
Linker
This program combines object files into an executable program.
Linker
This file contains a list of program symbols
Listing File
This defines a text macro named MESSAGE that contains "I'm good at this!",0
MESSAGE TEXTEQU <"I'm good at this!",0>
This instruction pops the stack into the FLAGS register
POPFD
This instruction pushes the 32 bit FLAGS registers on the stack
PUSHFD
If you wanted to find out whether an integer contained an even number of 1 bits, you set this status flag
Parity
Segment-offset addressing is used in this processor mode(s)
REAL ADDRESS MODE and VIRTUAL-8086
This directive is used when defining 64-bit IEEE long reals
REAL8
Write a procedure named Read10 that reads exactly ten characters from standard input into an array of BYTE named myString. Use the Loop instruction with indirect addressing, and call the ReadChar procedure from the book's link library. (ReadChar returns its value in AL.)
Read10 PROC**** MOV ECX, LENGHTOF myString**** MOV ESI, OFFSET myString**** L1: call ReadChar**** MOV [esi], AL**** INC ESI**** Loop L1**** RET Read10 ENDP
This is a word that has special meaning to the assembler and can only be used in its correct context.
Reserved Word
This component of an operating system is responsible for switching control between tasks
Scheduler
Write a procedure named ShowBinary that displays the following array as a sequence of binary bits, starting with the low-order value (00000010h). Include the use of the LEGNTHOF, OFFSET, and TYPE operators, and call the WriteBin procedure array DWORD 10h, 20h, 30h, 40h
ShowBinary PROC MOV ECX, LENGTHOF array MOV ESI, offset array L1: move eax, [esi] call WriteBin add esi,TYPE array Loop L! RET ShowBinary ENDP
This directive is used when defining 80-bit integers
TBYTE
T/F A virtual machine may be constructed from software
True
T/F Adding 5 to 0FBh in an 8-bit register sets the Zero flag
True
T/F Adding 7Fh and 05h in an 8-bit register sets the OVerflow flag.
True
T/F Operands can be constant or constant expression, register name, and variable name (memory)
True
T/F Suppose there is a virtual machine containing levels V1 and V2, where V2 is above V1 in the machine hierarchy. The programs written in language V2 can be executed by a program running at level V1
True
T/F The INC instruction does not affect the Carry flag
True
T/F The MOV instruction does not permit an immediate value to be moved to a segment register
True
T/F The MOVSX instruction sign-extends an integer into a larger operand.
True
T/F The following are both valid data definition statements: List1 BYTE 10,20 BYTE 30,40
True
T/F The following instructions will set the Sign flag: mov al,0FEh sub al,2
True
T/F The following is a valid data definition statement: prompt BYTE 'CSU EAST BAY', 0
True
T/F The following statement will assemble without errors mov WORD PTR [edx],1234h
True
This library procedure writes an unsigned 32-bit integer to standard output in hexadecimal format
WriteHex
For each of the following instructions, indicate whether it is valid (V) or invalid (I) a. move byte2,0FFh b move word1,byte2 c. mov word2,10000h mov si,word1
a. V b. I c. I d. V
This code writes a sequence of statements that read a signed integer from standard input and write the same integer to standard output. Us library procedures
call ReadInt call WriteInt
This instruction ( a function call ) writes the contents of EAX to standard output as a signed decimal integer?
call writeInt
T/F A WHILE loop can be constructed with a CMP instruction at the bottom of the loop, followed by a conditional jump instruction.
false
T/F The PUSH instruction increments the stack pointer (by 2 or 4) and copies the operand into the stack at the location pointed to by the stack pointer.
false
T/F The assembler knows the exact address of a library procedure
false
This file acts as a bridge between Irvine32.lib and kernel32.dll
kernel32.lib
This code uses library procedure to generate a single unsigned pseudorandom integer between 0 and 999 and write it to standard output
mov EAX, 1000 call RandomRange call WriteDec
Without modifying dword1, ECX, and EDX this is the implementation of the expression eax = -dword1 + (edx - ecx) + 1
mov eax,dword1 neg eax move ebx,edx sub ebx,ecx add eax,ebx inx eax
This code will display the following string to standard output str1 BYTE "Display this string",0
mov edx, offset str1 call WriteString
This code displays the following array in hexadecimal, using the DumpMem procedure from the link library:::::array DWORD 10h,20h,30h,40h
mov esi, offset array move ecx, lengtof array mov ebx, type array call dumpMem
This statement moves a video color constant to EAX. The constant should represent black text on a white background, (using the constants in the Irvine32.inc file)
move eax, black + (white*16)
This definition creates an array of unsigned bytes containing decimal 10,20, and 30, named myArray
myArray BYTE 10,20,30
This statement creates an array of 500 signed doublewords named myList and initializes each array element to the value -1.
myList SDWORD 500 DUP (-1)
This code a Proc declaration for a procedure named MySub. It uses the USES operator to preserve the EAX and EBX registers
mySub PROC USES EAX EBX