CS271 MidTerm

¡Supera tus tareas y exámenes ahora con Quizwiz!

What is the largest signed integer that may be stored in 32 bits?

(2^31 )- 1

three hexadecimal digits can be used to represent 12 binary bits. (t/f)

(True)

Convert the following binary number into a signed decimal value. 1011 1110 0100 1011

-16,821 (with margin: 0)

Convert the following binary number into a signed decimal value. 1011 1001 0101 0000

-18,096

evaluate the following postfix expression: 7 4 7 * - 1 / 4 2 - +

-19.0

Convert the following binary number into a signed decimal value. 1101 1100 0010 1101

-9,171 (with margin: 0)

What is the value of the Overflow flag after the following instructions? mov ax,48 mov bx,4 imul bx

0

What is the value of the Overflow flag after the following instructions? mov eax,+4823424 mov ebx,-423 imul ebx

0

The integer range of standard ASCII codes is

0 to 127

After executing the following instruction sequence, what is the value of AL, in binary: mov al,4Bh and al,6Ch

0100 1000

Which of the following binary values is equivalent to hexadecimal 4A2B?

0100 1010 0010 1011

After executing the following instruction sequence, what is the value of AL, in hexadecimal mov al,4Bh and al,74h

040h

For this problem, suppose that you are working with the partial data segment given below. Assume that the memory address of balance is 0x44. What hexadecimal address belongs to the last item in history? HISTLIMIT = 100 .data balance DWORD 0 account WORD ? history WORD HISTLIMIT DUP(?) isValid BYTE 0

0x110

The following data segment starts at memory address 0x1300 (hexadecimal) .data printString BYTE "MASM is fun",0 moreBytes BYTE 32 DUP(0) dateIssued DWORD ? dueDate DWORD ? elapsedTime WORD ? What is the hexadecimal address of dueDate?

0x1330

The following data segment starts at memory address 0x1700 (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?

0x1727

The following data segment starts at memory address 0x2300 (hexadecimal) .data printString BYTE "Assembly is fun",0 moreBytes BYTE 48 DUP(0) dateIssued DWORD ? dueDate DWORD ? elapsedTime WORD ? What is hexadecimal address of dueDate?

0x2344

Suppose that you are given the following program (with memory addresses shown on the left). What hexadecimal value does EIP hold immediately after "inc EAX" has executed? .data 0x100 x DWORD 153461 0x104 y WORD 37 0x105 z WORD 90 .code main PROC 0x12 push x 0x17 mov AX, y 0x1C sh1 AX, 16 0x1C mov AX, z 0x21 call someProcedure 0x26 inc EAX 0x2B mov EBX, z 0x30 xor EAX, EBX 0x35 exit main ENDP END MAIN

0x2B

The following data segment starts at memory address 0x4100 (hexadecimal) .data printString BYTE "Do not add decimal to hex",0 someBytes WORD 36 DUP(0) moreBytes BYTE 10, 20, 30, 40, 50, 60, 70, 80, 90 questionAddr DWORD ? ignoreMe WORD ? What is the hexadecimal address of questionAddr?

0x416B

What is the value of the Overflow flag after the following instructions? mov ax,-32000 imul ax,2

1

How much memory can be addressed in Real-address mode?

1 MB

If a clock oscillates 10 billion times per second, what is the duration of a single clock cycle?

1 x 10^-10 seconds

Identify the sizes of the sign __ , exponent ___ , and significand ___ for a Single Precision x86 floating point number.

1, 8, 23

The four-byte sequence 0xA0 0x8C 0x8C 0x6B stored in consecutive memory cells in a little-endian architecture represents ___________ (decimal) when interpreted as a 32-bit signed integer.

1,804,373,152

What is the Instruction Execution Cycle?

1. Fetch next instruction (at address in IP) into IR. 2. Increment IP to point to next instruction. 3. Decode instruction in IR. 4. In instruction requires memory access: a. Determine memory address. b. fetch operand from memory into a CPU register, or send operand from a CPU register to memory. 5. Execute micro-program for instruction. 6. Go to step 1 (unless the 'halt ' instruction has been executed). (default execution is sequential)

Please place the following steps of the instruction execution cycle in their proper order.

1. Fetch the instruction at the address in the instruction pointer into the instruction register. 2. Increment the instruction pointer to point to next instruction. 3. Decode the instruction in the instruction register. 4. If the instruction requires memory access, determine the memory address, and fetch the operand from the memory into a CPU register or send the operand from 5. execute the instruction 6. if the output operand is in memory, the control unit uses a write operation to store the data

Consider the virtual machine levels. Suppose the interpreters at each level generate n instructions in order to represent one instruction from the level above. Suppose that each level-0 instruction executes in c nanoseconds. 1. How long does it take to execute a Level-3 instruction? 2. How long does it take to execute a level-5 instruction?

1. cn^2 ns . going from level 3 to level 2 creates n instructions. For each of those n instructions, going from level 2 to level 1 creates n instructions, so there will be n^2 micro-instructions ,each of which requires c nano-seconds to execute. 2. cn^4 ns

Select the correct ODD parity 12 bit Hamming code value for the unsigned integer value 137

1010 0001 1001

After executing the following instruction sequence, what is the value of AL, in binary: mov al,94h xor al,37h

1010 0011

Select the correct ODD parity 12 bit Hamming code value for the unsigned integer value 55

1100 0110 0111

1100 0010 1101 is an ODD parity 12 bit Hamming code that contains a single-bit error. What is the corresponding uncorrupted Hamming code?

1101 0010 1101

1100 0010 1101 is an ODD parity 12 bit Hamming code that contains a single-bit error.What is the corresponding uncorrupted Hamming code?

1101 0010 1101

1001 0101 0101 is an ODD parity 12 bit Hamming code that contains a single-bit error.What is the corresponding uncorrupted Hamming code?

1101 0101 0101

Which of the following is the binary translation of signed decimal -33?

1101 1111

Select the correct ODD parity 12 bit Hamming code value for the unsigned integer value 202

1110 1001 1010

Suppose that result is declared as DWORD, and the following MASM code is executed: mov eax,17 mov ebx,13 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?

125 (with margin: 0)

which of the following postfix expressions corresponds to the given infix expression? (1+4/2+1+2)*3/2

142/+1+2+3*2/

Given the following partial data segment, what value would I put in the brackets in list[n] to access the 5th element of list? (Ignore the .0000 that Canvas may append to your answer). .MAX = 50 .data list DWORD MAX DUP(0) a DWORD 25 b DWORD 15

16

How many bits are used by Unicode characters in MS-Windows?

16

The following instruction will increment the stack pointer (ESP) by how many bytes? (Ignore the .0 after the number. Canvas insists on pushing decimals even when kindly asked not to). ret 12

16

What is the largest unsigned integer that may be stored in 24 bits?

16,777,215

IA-32 integrates how many processors? what are they?

2 processors in one: Integer unit and floating point unit, implemented by separate ALUs (implies both processors can work simultaneously)

The four-byte sequence 0xB2 0xAD 0x8A 0x86 stored in consecutive memory cells in a little-endian architecture represents ___________ (decimal) when interpreted as a 32-bit unsigned integer.

2,257,235,378

An algorithm takes 6.3 seconds to execute on a single 3.4 GHz processor. 29% of the algorithm is sequential. Assume that there is zero latency and that the remaining code exhibits perfect parallelism. How long (in seconds) should the algorithm take to execute on a parallel machine made of 5 3.4 GHz processors? Round answers to one decimal place.

2.7 (29 * 6.3/100) + ( (71/5) * (6.3/100))

What will be the value of EAX when the following sequence of instructions has executed? push 5 push 10 push 20 pop eax

20 (with margin: 0)

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

Suppose that you are working with a CISC machine using a 2.1 GHz clock (i.e., the clock ticks 2.1 billion times per second). This particular computer uses MASM-like instructions with the following timings: add reg, mem 9 clock cycles (i.e., ADD micro-program has 9 instructions) add reg, immed 4 clock cycles loop label 7 clock cycles Suppose that the following code fragment is used to sum elements of a numeric array. For this problem assume that memory limitations are non-existent and that there is no limit to the size of the array. mov bx, 0 ;initialize sum mov ecx, MAX_SIZE ; initialize loop counter mov esi, OFFSET list ; initialize array pointer more: add bx, [esi] ;add current list element add esi, 2 ; move array pointer to next element loop more ; auto- decrement ecx, jump to more if ecx not = 0 After initialization, how many array elements can be processed in 2.2 ms? Round answer to nearest integer. Note that 1 ms = 0.001 second

231000 (2.1*10^9) * 0.0022ms = 4,620,000 5950000/ (9+4+7) = 231000

which of the following infix expressions corresponds to the given postfix expression? 3 5 4 2 3 6 / * - ^ +

3+5^(4-2*3/6)

After the following MASM code is executed: mov eax,25 mov ebx,7 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)?

3,7,4

Given the following partial data segment, what value would I put in the brackets in list[n] to access the 9th element of list? (ignore the .0000 that Canvas may append to your answer). .MAX = 50 .data list DWORD MAX DUP(0) a DWORD 25 b DWORD 15

32

What is the size of the general-purpose registers

32 bits

What is the width of the internal bus?

32 bits

In integer unit, internal and memory buses are ___ bits

32-bit

How many bits in 35 MiB?

35 x 2^20 (Bytes) x 8 (bits per Byte) = 293 601 280 bits

Suppose that you are working with a CISC machine using a 1.7 GHz clock (i.e., the clock ticks 1.7 billion times per second). This particular computer uses MASM-like instructions with the following timings: add reg, mem 7 clock cycles (i.e., ADD micro-program has 9 instructions) add reg, immed 3 clock cycles loop label 5 clock cycles Suppose that the following code fragment is used to sum elements of a numeric array. For this problem assume that memory limitations are non-existent and that there is no limit to the size of the array. mov bx, 0 ;initialize sum mov ecx, MAX_SIZE ; initialize loop counter mov esi, OFFSET list ; initialize array pointer more: add bx, [esi] ;add current list element add esi, 2 ; move array pointer to next element loop more ; auto- decrement ecx, jump to more if ecx not = 0 After initialization, how many array elements can be processed in 3.5 ms? Round answer to nearest integer. Note that 1 ms = 0.001 second

396,666 (1.7*10^9) * 0.0035ms = 5,950,000 5950000/ (7+5+3) = 396,666.67

Suppose that you are given the following program. Inside someProcedure, what numerical operand should be used with the RET instruction? .data x DWORD 153461 y WORD 37 z WORD 90 .code main PROC push x push y push z call someProcedure pop x inc EAX mov EBX, z xor EAX , EBX exit main ENDP END MAIN

4

The RET instruction (without operands) will pop how many bytes off the stack?

4

Given the following MASM code using Irvine's library: mov eax,1 mov ebx,4 label6: mul ebx call WriteDec inc ebx cmp eax,40 jbe label6 mov eax,ebx call WriteDec

4 20 120 7

How much memory can be addressed in Protected mode?

4 GB

IA-32 max memory is...

4 GiB

After the following MASM code is executed: mov eax,11 mov ebx,3 mov ecx,10 add eax,ebx sub eax,ecx 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 ecx register (in decimal)?

4, 3, 10

Convert the following string into its ASCII hex representation.Don't use 0x or h with the hex values. The hex for "1+z" is 31 2B 7A Apple

41 70 70 6c 65

Suppose you have a RISC machine with a 2.3 GHz clock (i.e., the clock ticks 2.3 billion times per second). This particular computer uses an instruction cache, a data cache, an operand fetch unit, and an operand store unit. The instruction set includes simple instructions with the following timings: set reg, immed 2 clock cycles loop label 4 clock cycles add reg, immed 2 clock cycles add reg, reg 2 clock cycles load reg, mem 3 clock cycles Assume that the following code fragment is used to sum the element of a numeric array. If the initialization code has already executed (i.e. the SET instructions have already finished execution) how many array elements can be processed in 2.1 ms? Round your answer to the nearest integer. Recall that 1 ms = 0.001 seconds. Also assume that there are no physical memory limitations, implying that the array can be as large as desired. set r1, 0 ;initialize sum set r2, MAX_SIZE ; initialize loop counter set r3, @list ; initialize array pointer more: load r4, [r3] ;fetch current list element add r1, r4 ; add current list element add r3, 4 ; move array pointer to next element loop more ; auto-decrement r2, jump to more if r2 does not equal 0

439090 (2.3*10^9) * 0.0021ms = 4,830,000 4,830,000 / (4+2+2+3) = 439090.9

Convert the following binary number into an unsigned decimal value. 1011 1110 0100 1011

48,715 (with margin:0)

Convert the following string into its ASCII hex representation. Don't use 0x or h with the hex values. The hex for "1+z" is 31 2b 7A. Instruct

49 6E 73 74 72 75 63 74

Convert the following string into its ASCII hex representation. Don't use 0x or h with the hex values. The hex for "1+z" is 31 2B 7A. Integer

49 6E 74 65 67 65 72

For this problem, suppose that you are working with the partial data segment given below. Assume that the memory address of balance is 0x44. What hexadecimal address belongs to the first item in history? HISTLIMIT = 100 .data balance DWORD 0 account WORD ? history WORD HISTLIMIT DUP(?) isValid BYTE 0

4Ah

Convert the following binary number into an unsigned decimal value. 1101 1100 0010 1101

56,365 (with margin:0)

Given list, an array of WORDs, what element is addressed by list[8]? Hint: It's love.

5th Element

Suppose that result is declared as DWORD, and the following MASM code is executed: mov eax,13 mov ebx,3 mov ecx,6 label5: add eax,ebx add ebx,2 loop label5 mov result,eax what is the value stored in memory location named result?

61 (with margin: 0)

After executing the following instruction sequence, what is the value of AL, in hexadecimal mov al,9Ch not al

63h

The following instruction will increment the stack pointer (ESP) by how many bytes? (Ignore the .0 after the number. Canvas insists on pushing decimals even when kindly asked not to). ret 3

7

Suppose you have a RISC machine with a 2.2 GHz clock (i.e., the clock ticks 2.2 billion times per second). This particular computer uses an instruction cache, a data cache, an operand fetch unit, and an operand store unit. The instruction set includes simple instructions with the following timings: set reg, immed 2 clock cycles loop label 8 clock cycles add reg, immed 1 clock cycles add reg, reg 3 clock cycles load reg, mem 2 clock cycles Assume that the following code fragment is used to sum the element of a numeric array. If the initialization code has already executed (i.e. the SET instructions have already finished execution) how many array elements can be processed in4.71 ms? Round your answer to the nearest integer. Recall that 1 ms = 0.001 seconds. Also assume that there are no physical memory limitations, implying that the array can be as large as desired. set r1, 0 ;initialize sum set r2, MAX_SIZE ; initialize loop counter set r3, @list ; initialize array pointer more: load r4, [r3] ;fetch current list element add r1, r4 ; add current list element add r3, 4 ; move array pointer to next element loop more ; auto-decrement r2, jump to more if r2 does not equal 0

738,571 (2.2*10^9) * 0.0047ms = 10,340,000 10,340,000 / (8+1+3+2) = 738571

Which letter choice shows the memory byte order, from low to high address, of the following data definition? BigVal DWORD 12345678h

78h, 56h, 34h, 12h

Suppose that you are given the following program. Inside someProcedure, what numerical operand should be used with the RET instruction? .data x DWORD 153461 y WORD 37 z WORD 90 .code main PROC push x push y push z call someProcedure inc EAX mov EBX, z xor EAX, EBX exit main ENDP END MAIN

8

Suppose that you are given the following MASM data segment declaration: .data matrix word 12 dup(7 dup(?)) assume that the base address of matrix is 0xAB00 what is LENGTHOF matrix in decimal? what is SIZEOF matrix in decimal? what is the hexadecimal address of matrix[3][5]

84 168 AB34h

After the following MASM code is executed: mov eax,98 mov ebx,97 mov ecx,96 add eax,ebx sub eax,ecx 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 ecx register (in decimal)?

99, 97, 96

What is a register?

A fast local memory inside the CPU

How are assembly language statements converted to a computer's machine language

A software system (an assembler) accepts the assembly language source code as input, and produces architecture-specific machine code as output.

What will be the hexadecimal value of AL after these instructions execute? mov al,94h xor al,37h

A3h

what are the 8-bit sub registers of EAX

AH, AL

What is a 16-bit sub register of EAX

AX

Register Indirect addressing is defined as follows:

Accessing memory through an address stored in a register.

The stack frame inside a procedure is also known as the _____.

Activation Record

Given the following array definition, which letter choice contains 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

Why is it a good idea to implement a program's out put first?

As soon as the output is displayed, you can check to see if it fulfills layout specifications. The greatest advantage, however, is that the rest of the program development will be much easier to debug, since results will be displayed as the program's processes are implemented

Convert the following ASCII hex representation into its string.The hex 31 2B 7A is the string 1+z 41 73 73 65 6D 62 6C 79

Assembly

What will be the hexadecimal value of AL after these instructions execute? mov al,3Ch or al,82h

BEh

One goal of multiple internal buses is to simplify what process?

Bus Arbitration

Which answer choice shows the correct values of the Carry, Zero, and Sign flags after the following instructions execute? mov al,00110011b test al,2

CF = 0, ZF = 0, SF = 0

List 16-bit segment registers in the Integer Unit register

CS, SS, DS, ES, FS, GS

What does a data bus do?

Carries data between the CPU and memory

What is Main Memory Unit?

Cells with addresses, stores programs and data currently being used by the CPU (volatile storage)

What is CPU

Central Processing Unit, execute machine instructions

Name the registers in the CPU and their functions

Control: dictates current state of the machine Status : indicates status of operations (error, overflow, etc) MAR: Memory address register (holds address of memory location currently referenced) MDR: Memory Data Register: holds data being sent to or retrieved from the memory address in the MAR IP: Instruction Pointer (holds memory address of next instruction) IR: Instruction Register (holds current machine instruction) Operand_1, Operand_2, Result: ALU registers ( for calculations and comparisons) General: fast temporary storage

The ________ procedure advances the cursor to the beginning of the next line in the console window.

Crlf

After executing the following instruction sequence, what is the value of AL, in hexadecimal mov al,72h xor al,0A5h

D7h

What is the name of the lowest 8 bits of the EDX register?

DL

Which of the following portions of a program can complicate the instruction-caching process? (Check all that apply) Decision Structures Repetition Recursion Sequential Execution

Decision Structures Repetition Recursion

Which library procedure displays the CPU flags and 32-bit registers?

DumpRegs (Table 5-1)

After the following code has finished execution, ECX contains the initial contents of which register? mov edx, eax mov ebx, ecx mov ebx, edx mov ecx, ebx mov edx, eax

EAX

In what register will the quotient of the following instruction be found? DIV EBX

EAX

Which register contains an integer before calling WriteDec?

EAX (section 5.3)

List the 32-bit multi-purpose registers in the integer unit reigster

EBP, ESP, ESI, EDI

Which register contains the offset of a character array when calling GetCommandTail?

EDX

Where is the result of the following operation stored? MUL EBX

EDX:EAX

List the 32-bit special-purpose registers in the integer unit register

EFL (Status) , EIP (instruction pointer) note: in protected mode, control register, instruction register, MAR, and MDR are hidden

The RET Instruction pops the top of the stack into what register?

EIP

Which two 32-bit registers are known as extended index registers

ESI, EDI

Convert the following ASCII hex representation into its string.The hex 31 2B 7A is the string 1+z 45 6C 65 63 74 72 69 63

Electric

In the AddSub program in Section 3.2, the exit statement calls which predefined MS-Windows function to halt the program?

ExitProcess

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

False

Adding 0FFh and 05h in an 8-bit register sets the Overflow flag. (t/f)

False

Assembly language programs are portable to a variety of computer architectures (t/f)

False

Assuming that all processor clock speeds are identical, executing a given software algorithm on a multicore processor is always faster than executing the same algorithm on a single-core processor.(T/F)

False

Even in older x86 processors, there was an insignificant difference in performance between multiplication by bit shifting versus multiplication using the MUL and IMUL instructions. (t/f)

False

If the LOOP instruction sets ECX to zero, a jump to the destination label does take place. (t/f)

False

MASM has built-in range checking for effective addresses (t/f)

False

Software parallelism is currently much more developed than hardware parallelism. (T/F)

False

The ASCII codes for alphabetic letters are smaller than for decimal digits. (t/f)

False

The following instructions will set the Carry flag: mov al,0FEh sub al,2 (t/f)

False

The most significant bit in a binary byte is numbered bit 8 (t/f)

False

When passing parameters to a procedure on the stack, it is usually okay to change the value of the EBP register within the procedure. (t/f)

False

a signed integer stores the sign in the least significant bit (LSB) (t/f)

False

The CPU clock cycle length is the only contributing factor to the speed of operations on a computer. (T/F)

False. There are many other factors which affect the speed of operations on a computer such as: - size of RAM - cache memory - size of registers in CPU

Place the 3 major steps of the Instruction Execution Cycles in the correct order.

Fetch, Decode, Execute

Give an example of which 'general-purpose' register has an extra purpose? Give an example of which 'multi-purpose' register has an extra purpose?

General purpose: EAX and EDX are automatically used by integer multiplication and division instructions. ECX is automatically used as a counter for some looping instructions Multi-purpose: ESP is used for referencing the system stack

Which library procedure locates the cursor at a specific row and column on the screen?

Gotoxy

What is I/O unit?

Hardware/ software functions. communicates between CPU / Memory and peripheral devices

Identify which of the following are correct formats for the IMUL instruction. (Check all that apply)

IMUL reg16, reg/mem16 IMUL reg32, reg/mem32, imm8 IMUL reg16, reg/mem16, imm16 IMUL reg32, imm32 IMUL reg32, reg/mem32 IMUL reg16, imm8 IMUL reg32, imm8 IMUL reg16, imm 16 IMUL reg32, reg/mem32, imm32 IMUL reg16, reg/mem16, imm8

What does IR do

Instruction Register, holds current machine instruction

What does the IP do

Instruction pointer, holds memory address of next instruction

Which of the following is true about the PUSH instruction? // What does the PUSH instruction do?

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 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>

Identify which of the following are allowed formats for the MUL instruction. (Check all that apply)

MUL mem16 MUL mem32 MUL mem8 MUL reg

What does a MAR register do?

Memory Address Register, holds address of memory location currently referenced

What does MDR do?

Memory Data Register, holds data being sent to or retrieved from the memory address in the MAR

Is SH a valid 8-bit reference?

No, not allowed. This would be ambiguous, because we have ESP, ESI and SS registers.

Is EL a valid 8-bit reference?

No. Can't divde the ES register

What are the ALU register and what is their function

Operand_1, operand_2, Result. used for calculations and comparisons

A procedure is declared using the _____ and ____ directives.

PROC and ENDP

What are main parts of the CISC diagram?

Peripheral devices, I/O Unit, Main memory unit, CPU, Bus, Register, ALU , MIcroprogram, Micromemory

What is the default mode of Intel - IA 32 architecture? What does it mean?

Protected mode - certain areas of mem / registers can't be accessed by user programs

Which directive is used when defining 64-bit IEEE long reals?

REAL8

The instructions used to manipulate the ESP register are (select all that apply):

RET CALL PUSH POP

Which library procedure reads a string from standard input?

ReadString

What's the result of the following code fragment? I.E., what registers are changed? mov eax, 100 cdq mov ebx, 13 div ebx

Registers changed: eax contains 7 (int quotient of 100/13) ebx contains 13 (assigned, unchanged by division) edx contains 9 (integer remainder of 100/13)

What is a sub-register of ESI?

SI (refers to least significant 16-bits of ESI)

Convert the following ASCII hex representation into its string.The hex 31 2B 7A is the string 1+z 53 74 61 74 65

State

Why does protected mode prevent programs from changing the EIP register directly?

The EIP contains the memory address of the next instruction to be fetched. Since the programmer ordinarily will not know the absolute address where any of the instructions are stored, protected mode restricts access to EIP, and allows it to be changed only by the operating system.

In simple CISC architecture, which register holds the current micro-instruction

The control register

In simple CISC architecture, which register holds the current machine instructions?

The instruction register (IR)

Hardware

The tangible, physical devices that comprise a computer system

A MASM program must have a procedure named 'main' (t/f)

True

A common programming error is to inadvertently initialize ECX to zero before beginning a loop (when using the LOOP instruction). (t/f)

True

A word (on x86 systems) is 16 bits (t/f)

True

Adding 5 to 0FBh in an 8-bit register sets the Zero flag. (t/f)

True

Adding 7Fh and 05h in an 8-bit register sets the Overflow flag.

True

Constants in MASM is usually ALL CAPS (T/f)

True

END main is a directive that tells the operating system where to begin the execution of the program (t/f)

True

High-Level language programs are portable to a variety of computer architectures (t/f)

True

In the x86 Floating-Point, a decimal number contains three components: a sign, a significand, and an exponent.

True

Is the expression X or (Y and Z) equivalent to (X or Y) and (X or Z) for all possible inputs of X,Y, and Z? (t/f)

True

MASM is not case-sensitive (t/f)

True

The INC instruction does not affect the Carry Flag (t/f)

True

The MUL (unsigned multiply) instruction comes in three versions. (t/f)

True

The USES operator, coupled with the PROC directive, lets you list the names of all registers modified within a procedure.

True

The expression not(X and Y) is true when x and y are both false (t/f)

True

The following are both valid data definition statements: List1 Byte 10, 20 Byte 30,40 (t/f)

True

The following is a valid data definition statement: str1 \ BYTE "This string is quite long!", 0 (t/f)

True

The listing file contains a list of program symbols (t/f)

True

Unlike the MUL instruction, IMUL preserves the sign of the product.

True

What is the value of the boolean expression X or (Y and Z) when x = true, y = false, z = false?

True

a doubleword (on x86 systems) is 32 bits (t/f)

True

Which library procedure writes a single character to standard output?

WriteChar (table 5-1)

Which of the following are valid uses of the XCHG instruction? (check any/all that apply)

XCHG reg,reg XCHG mem,reg XCHG reg,mem

Is DH a valid 8-bit register reference?

Yes, refers to 8 high-order bits of the 16-low order bits of EDX

Is AL a valid 8-bit register reference?

Yes, refers to 8 low-order bits of EAX

If you reference a point beyond the end of an array in MASM (for example, the address of the what would be the 105th element of a 100-element array), what happens?

You attempt to access whatever data bytes are stored there.

Program in machine code: The hardware's instruction set architecture (ISA) provides...?

a micro-program for each machine instruction (CISC* / complex instruction set computer) or direct execution (RISC* / reduced instruction set computer)

A bus is..

a set of parallel 'wires' for transferring a set of electrical signals simultaneously

Given the macro definition and global declarations shown in the image below, provide answers to the following questions: quiz4 MACRO p,q LOCAL here push eax push ecx mov eax, p mov ecx, q here: mul p loop here mov p, eax pop ecx pop eax ENDM .data x DWORD 3 y DWORD 3 a. after the statement 'quiz x,4' executes, x contains? b. the statement 'quiz4 6,4' will produce an error when the macro is invoked (t/f). c. suppose that the following code executes: mov ebx, 3 mov ecx, 12 mov edx, ecx quiz4 ecx, ebx upon competion edx will contain?

a. 243 b. true c. 0

What are literals? What is the use?

actual values, named constants (integer, floating point, character, string) used for: initializing vars in .data segment, defining constants, assigning contents of registers, assigning contents of memory

What is a cache? examples.

an area of comparatively fast temporary storage for information copied from slower storage. ex1. program instructs. moved from secondary storage to main memory, so they can be accessed more quickly. ex2. data is moved from main memory to CPU register, so it can be accessed instantaneously

What is a single instruction that clears bits 0, 3, and 4 in the AL register?

and al,11100110b

What is ALU

arithmetic / logic unit

Device drivers nearly always contain some code written in

assembly language

A single switch (off = 0 , on = 1) inside a computer represents a

binary digit or bit

A group of 8 bits is called a

byte

high-speed memory that reduces the frequency of access by the CPU to conventional memory is called

cache memory

Which of the following CALL instructions writes the contents of EAX to standard output as a signed decimal integer?

call WriteInt

A program is considered portable if it

can be executed on multiple platforms

What does a control bus do?

carries signals for memory and I/O operations

Which flag is set when an unsigned value is too large to fit into a destination operand?

carry

The four parts of a CPU are:

clock, registers, control unit, arithmetic logic unit

In .data, each name is a _______. The system substitutes the______ _______ for each occurrence of a name. The ________ of a memory location may be _________.

constant, memory address contents, variable

Which internal bus uses binary signals to synchronize actions of all devices attached to the system bus?

control bus

What will be the final values of CX and DX when the following code executes? .data array SWORD 8,2,3,5,-4,6,0,4 .code mov cx,1 mov esi,2 mov ax,array[esi] mov bx,array[esi+4] cmp ax,3 jae L2 cmp bx,4 jb L1 j mp L3 L1: mov cx,4 L2: mov dx,5 jmp L4 L3: mov dx,6 L4:

cx = 1, dx = 6

The three types of buses connected to the CPU are:

data, address, control

What does a control register do?

dictates current state of the machine

Given the following MASM code snippet what is the output to the screen? .data str1 BYTE 'introduction', 0 .code ...... mov esi, OFFSET str1 add esi, 5 mov ecx, 4 cld more1: lodsb call WriteChar loop more1 mov ecx, 4 std more2: lodsb call WriteChar loop more2 ....

ductitcu

How is assembly language related to a computer's machine language?

each assembly language instruction maps to one machine instruction in the computer's instruction set

What does Byte-addressable mean?

each individual byte of memory has its own unique address

After the following MASM code is executed: mov eax,212 mov ebx,19 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 = 11, ebx = 19 , edx = 3

List the 32-bit general-purpose registers in the integer unit registers

eax, ebx, ecx, edx

What 32-bit registers have 8-bit and 16-bit sub-registers

eax, ebx, ecx, edx

Which register is known as a loop counter?

ecx

inside the computer: machine instructions, memory addresses, numbers, characters, etc., are all represented as

electrical signals

What 32-bit registers have only 16-bit sub-reigsters?

esi, edi, ebp, esp

Which of the following correctly describes the Java Virtual Machine

executes Java Bytecodes

What is a peripheral device?

external device, store/retrieve data (non-volatile storage), converts data between human-readable and machine readable forms

Most existing algorithms are readily parallelizable. (T/F)

false

The expression X or Y is only true when X and Y are both true. (t/f)

false

a quadword is 4 bytes (t/f)

false

What are the general registers' function?

fast temporary storage

During which phase of the instruction execution cycle is the program counter incremented?

fetch

List the three primary steps of the instruction execution cycle, in sequential order

fetch, decode, execute

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. .data ; General purpose variables a DWORD ? b DWORD ? c BYTE ?d BYTE ? upperLevel DWORD 18 lowerLevel DWORD 3 ; Strings yes BYTE "Yes",0 no BYTE "No",0 maybe BYTE "Maybe",0 .code main PROC mov eax, 0 mov ebx, a startLoop: cmp eax, ebx jge endOfProgram mov edx, OFFSET no call WriteString inc eax jmp startLoop mov edx, OFFSET maybe call WriteString endOfProgram: exit main ENDP END main

for (k = 0; k<a ; k++) print(no);

How is size measured in Intel IA-32 Architecture?

in bits. Bytes is measured in binary units. K = 2^10, M = 2^20, G = 2^30, etc in this course, use Ki = 2^10, Mi = 2^20, Gi = 2^30 ex: disk size of 200 GiB means 200 x 2^30 Bytes

What does a status register do?

indicates status of operation (error, overflow, etc)

Which library procedure sets the Zero flag if the AL register contains the ASCII code for a decimal digit (0-9)?

isDigit

What is general form of .data segment

label data_type initializer ;comment

The basic parts of an instruction, in order from left to right, are:

label, mnemonic, operand(s), comment

Each instruction line has 4 fields, what are they?

label, opcode, operands, comment

A program that combines object files into an executable program is called a

linker

What does an address bus do?

links to specific memory locations

IA-32 architecture is big-endian or little-endian

little-endian

What are Bytes and bits (abbreviations) in Intel IA-32 archtecture?

lower-case b for bits upper-case B for Bytes ex: 1 Mib = 128 KiB

The 32-bit 'general' and 'multi' registers may be _______ directly

manipulated

What is .data directive?

marks beginning of data segment, variable declarations go here

what is .code directive

marks end of data segment and beginning of code segment main procedure is defined here (Req) other procedures defined here (optional) main must have an exit instruction all procedure require PROC and ENDP directives

How is speed measured in Intel IA-32 architecture?

measured in electronic units. K = 10^3, M = 10^6, G = 10^9 ex: network speed of 8 Mbps means 8,000,000 bits per second

The 32-bit 'special' registers are manipulated by the __________ that implement the ______

micro-programs, instructions

Given the following register states, and using Base Indexed Addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contains the address of the first element of list. ESI register contains the address of the eleventh element of list. EBX register contains the value 40.

mov eax, [edx+ebx]

Given the following register states, and using Register Indirect Addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contains the address of the first element of list. ESI register contains the address of the eleventh element of list. EBX register contains the value 40.

mov eax, [esi]

Select the answer choice that best implements the following expression. Do not permit dword1, ECX, or EDX to be modified: eax = -dword1 + (edx - ecx) + 1

mov eax, dword1 neg eax mov ebx, edx sub ebx, ecx add eax, ebx inc eax

Given the following register states, and using Indexed Addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contains the address of the first element of list. ESI register contains the address of the eleventh element of list. EBX register contains the value 40.

mov eax, list[ebx]

What's wrong with this code segment? My_CREDITS = 12 .data x DWORD 12 y DWORD 13 z WORD 25 mov ebx, z mov y,x mov ebx, MY_CREDITS mov MY_CREDITS, ebx

mov ebx,z = size mismatch, mov y,x = can't move memory to memory mov my_Credits, ebx can't assign to a constant

Which of the following code sequences assigns the value 0x10 to EBX? (select all that are correct)

mov edx,20h push edx mov ecx,10h push ecx pop ebx pop edx and mov edx,20h push edx mov ecx,10h push ecx pop ebx pop edx

Caching is..

moving information from slower storage to faster storage, where it can be accessed more quickly

Which of the following are valid data definition statements that create an array of unsigned bytes containing decimal 10, 20, and 30 named my Array?

myArray BYTE 10, 20, 30

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 (-1)

The following data segment starts a memory address 1400. What is the address of each variable? .data myName BYTE 'Elmer Fudd', 0 yourName BYTE 30 DUP(0) myAge DWORD 45 yourAge DWORD ? myScore DWORD ? yourScore DWORD ?

myName: address = 1400, size = 11 yourName: address = 1400+11 = 1411, size = 30 myAge: address = 1411 + 30 = 1441, size 4 yourAge: address 1441+4 = 1445, size = 4 myScore: address 1445 + 4 = 1449, size = 4 yourScore: address = 1449+4 = 1453, size = 4

Assume that you are working with the five-stage pipeline shown in the diagram: S1 (instruction fetch unit) -> S2 (instruction decode unit) -> S3 (operand fetch unit) -> S4 (instruction execution unit) -> S5 (write back unit) S1: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 S2: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 S3: | | 1 | 2 | 3 | 4 | 5 | 6 | 7 S4: | | | 1 | 2 | 3 | 4 | 5 | 6 S5: | | | | 1 | 2 | 3 | 4 | 5 time ---> Suppose that each stage requires 3.6 nanoseconds to complete its task.How many nanoseconds would it take to complete 71 instructions WITH pipelining? Round your answer to the nearest integer.

n + ( k - 1 ) * Tstage = total time required n = 71, k = 5, Tstage = 3.6 [71+4]*3.6 ns = 270 ns

A/An ________ procedure call occurs when a called procedure calls another procedure before the first procedure returns.

nested

The Irvine32 library call GetMseconds returns

number of system milliseconds that have elapsed since midnight

Which of the following best describes the relationship between assembly language and machine language?

one to one

What is a bus in CISC? List all buses and their functions.

parallel 'wires' for transferring a set of electrical signals simultaneously. internal: transfers signals among CPU components control: carries signals for memory and I/O operations address: links to specific memory locations data: carries data CPU <-> memory

If you wanted to find out whether an integer contained an even number of 1 bits, which status flag would be useful

parity

What is VonNeumann architecture?

program is stored in memory and is executed under the control of the operating system

Operands may be any of the following: (select all that apply) register name constant or constant expression reserved word variable name (memory)

register name, constant or constant expression, variable name (memory)

The two's complement of an integer is formed by doing which of the following

reversing (inverting) the bits and adding 1

What is microprogram?

sequence of micro-instructions (implemented in hardware) required to execute a machine instruction

An assembler is a ________ that takes assembly language as input and produces machine language as output

software system

Cross-assemblers

software, can be used to convert a machine language to another machine language

Virtual machines

software, can be used to simulate another computer's archirtectrue

What does Opcode do?

specifies what to do -Mnemonic. ex; add, mov, call etc

'vonNeumann architecture' refers to computer architectures that ...

store programs in memory, and execute them under the control of the instruction execution cycle

What is END directive?

tells operating system where to begin execution

What is a micromemory

the actual hardware circuits that implement the machine instructions as microprograms

Software

the instructions that control the hardware

What is a Byte?

the smallest unit of data that can be manipulated directly in the IA-32 architecture ( 8 bits)

What does an internal bus do?

transfers signals among CPU components

By default, labels are visible only within the procedure in which they are declared. (t/f)

true

Mechanically speaking, the CALL instruction pushes its return address on the stack and copies the called procedure's address into the instruction pointer. (t/f)

true

Variables are laid out in memory in the order declared. (T/f)

true

Assume that you are working with the five-stage pipeline shown in the diagram: S1 (instruction fetch unit) -> S2 (instruction decode unit) -> S3 (operand fetch unit) -> S4 (instruction execution unit) -> S5 (write back unit) S1: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 S2: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 S3: | | 1 | 2 | 3 | 4 | 5 | 6 | 7 S4: | | | 1 | 2 | 3 | 4 | 5 | 6 S5: | | | | 1 | 2 | 3 | 4 | 5 time ---> Suppose that each stage requires 2.2 nanoseconds to complete its task.How many nanoseconds would it take to complete 89 instructions WITHOUT pipelining? Round your answer to the nearest integer.

w/o pipelining 1 instruction = (2.2*5) = 11 ns 89 instructions = 89*11 = 979

What is the name of the time delay in a CPU caused by differences between the speed of the CPU, the system bus, and memory circuits?

wait state

What's displayed here? .data intro_1 byte 'welcome,' username byte 'fred.' intro_2 byte 'what's up?' count dword 0 mov edx, OFFSET intro_1 call writestring call crlf mov edx, offset username call writestring call crlf mov edx, offset intro_2 call writestring call CrLf

welcome, fred. what's up? fred. what's up? what's up?

What is wrong with the following data segment? .data x_value DWORD 5 7Eleven BYTE 'My job', 0 X_VALUE DWORD 500 Age ; user's age' DWORD ?

x_value and X_VALUE are same variable, since MASM is not case-sensitive 7Eleven is an invalid variable (can't start with a digit) Age ;user's age; the first semi-colon make all of the rest of the line in to a comment

What is a single instruction that inverts bits 5 and 6 in BL without changing any other bits?

xor bl, 1100000b

What is operand?

zero, one or two operands specify the opcode's target... diff number of operands for diff opcodes ex; opcode destination opcode, destination, source


Conjuntos de estudio relacionados

Основи наукового пізнання сесія

View Set

Nursing Fun Unit 1 + Nursing History Worksheet

View Set

Unit 4.1 - Gas Exchange: COPD, Sleep Apnea, Acid-Base Balance

View Set

Mental Health - NCLEX-RN Examination Edition 7

View Set

Chapter 11 accounting (and extra)

View Set

Multiplication and Division review

View Set

Postmodernistic Architecture (8.24)

View Set

Chapter 4 - Legal Liability of CPAs

View Set