CS271 Through Quiz4

Ace your homework & exams now with Quizwiz!

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

Arrays are stored in ____________ memory.

contiguous

Which of the following FPU manipulations corresponds to the given infix notation? Z = (A + B - C) / D * E

finit fld A fld B fadd fld C fsub fld D fdiv fld E fmul fstp Z

The _________ operator returns a count of the number of elements in a single data declaration.

lengthof

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 BYTE 37 0x105 z BYTE 90 .code main PROC 0x12 push x 0x17 mov AH, y 0x1C mov AL, z 0x21 call someProcedure 0x26 inc EAX 0x2B mov EBX, z 0x30 xor EAX, EBX 0x35 exit main ENDP END MAIN

0x2B

Assume that your program has access to the following data segment (starting at address 0x310): .data id DWORD 7 matrix WORD 50 DUP(10 DUP(?)) What is the hexadecimal address of matrix[7][3] (the 4th element of the 8th row)?

0x3A6

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

0x4A

Which of the following postfix expressions corresponds to the given infix expression? 1 + 2 * (4 - 2) / 4 ^ (1 + 1)

1 2 4 2 - * 4 1 1 + ^ / +

For the following segment, what is SIZEOF myChecker (in decimal - ignore the .0000 from Canvas) .data myChecker BYTE 12h BYTE 34h BYTE 56h BYTE 78h BYTE 90h

1, unless commas are used

The code below uses the Space macro which simply displays the number of blank spaces specified by its argument. What is the first number printed to the screen after this code executes? (ignore the .0000 from Canvas) main PROC push 2 push 13 call rcrsn exit main ENDP rcrsn PROC push ebp mov ebp,esp mov eax,[ebp + 12] mov ebx,[ebp + 8] cmp eax,ebx jl recurse jmp quit recurse: inc eax push eax push ebx call rcrsn mov eax,[ebp + 12] call WriteDec Space 2 quit: pop ebp ret 8 rcrsn ENDP

12

Suppose that you are given the following partial data segment, which starts at address offset 0x1000 : .data idArray WORD 3546, 1534, 12, 3481, 154, 6423 x DWORD LENGTHOF idArray y DWORD SIZEOF idArray z DWORD TYPE idArray z contains what value, in decimal? (Ignore the .0000 from Canvas)

2

An algorithm takes 3.6 seconds to execute on a single 3 GHz processor. 50% 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 6 3 GHz processors? Round answers to one decimal place.

2.1

Suppose that a program's data and executable code require 1024 bytes of memory. A new section of code must be added; it will be used with various values 81 times during the execution of a program. When implemented as a macro, the macro code requires 80 bytes of memory. When implemented as a procedure, the procedure code requires 157 bytes (including parameter-passing, etc.), and each procedure call requires 13 bytes. How many bytes of memory will the entire program require if the new code is added as a procedure?

2234

Suppose that you are working with a CISC machine using a 1.5 GHz clock (i.e., the clock ticks 1.5 billion times per second). This particular computer uses MASM-like instructions with the following timings: add reg, mem 5 clock cycles (i.e., the ADD micro-program has 5 instructions) add reg, immed 4 clock cycles loop label 6 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, \left[\text{esi}\right] [ esi ] ;add current list element add \textrm{7} 7 , 2 ;move array pointer to next element loop more ;auto-decrement ecx, jump to more if ecx ≠ 0 After initialization, how many array elements can be processed in 2.8 ms? Round your answer to the nearest integer. Note that 1 ms. = 0.001 second.

280,000

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

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

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

4

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

5th Element

Suppose that you are given the following partial data segment, which starts at address offset 0x1000 : .data idArray WORD 3546, 1534, 12, 3481, 154, 6423 x DWORD LENGTHOF idArray y DWORD SIZEOF idArray z DWORD TYPE idArray x contains what value, in decimal? (Ignore the .0000 from Canvas)

6

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 BYTE 37 z BYTE 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

6

Suppose that you are given the following partial data segment: .data myPtrCheck BYTE 12h, 34h, 56h, 78h, 90h, ABh, CDh, EFh .code ... mov eax, DWORD PTR myPtrCheck EAX contains what value, in hexadecimal?

78563412h

Given the following array declaration, how many bytes of memory does array matrix require? (in decimal - ignore the .0000 from Canvas) .data matrix WORD 14 DUP(31 DUP(?))

868

Suppose that a program's data and executable code require 1024 bytes of memory. A new section of code must be added; it will be used with various values 84 times during the execution of a program. When implemented as a macro, the macro code requires 106 bytes of memory. When implemented as a procedure, the procedure code requires 177 bytes (including parameter-passing, etc.), and each procedure call requires 12 bytes. How many bytes of memory will the entire program require if the new code is added as a macro?

9928

Register Indirect addressing is defined as follows:

Accessing memory through an address stored in a register.

Which structure is the following true for? _________ may have parameters.

Both Macros and Procedures

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

Bus Arbitration

Storing a string byte using string primitives increments/decrements which register?

EDI

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

EIP

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.

False

If the string direction flag is not set, string operations will move backward through the string.

False. A clear direction flag will cause the operations to move forward. A set direction flag using STD will cause the operations to move backwards.

Which structure is the following true for? For _________, arguments are substituted exactly as entered, without checking for memory, registers, or literals.

Macros

Which structure is the following true for? For _________, the entire code is substituted for each call.

Macros

Which of the following portions of a program can complicate the instruction-caching process? (Check all that apply)

Repetition, Decision Structure, Recursion

When passing procedure parameters on the stack, why are the following lines of code often necessary in a procedure? push ebp mov ebp,esp

To keep additional usage of the stack within the procedure from invalidating the stack offsets.

Multiprocessor Parallelism (shared memory) usually has lower coordination overhead than Multicomputer Parallelism (distributed memory). Correct!

True

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.

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

Arguments are ____________, parameters are _____________

passed, received

The _________ operator returns a value that is equivalent to multiplying the number of elements in a single data declaration by the size, in bytes, of a single element of a data declaration.

sizeof


Related study sets

GCSE Lit Revision: Mac, AIC and L&R

View Set

Prep U Chapter 34: Assessment and Management of Patients with Inflammatory Rheumatic Disorders

View Set

Emergency Action Plans and Fire Protection

View Set

BUS101: Chapter 9- SUmmary Learning Outcomes

View Set

Stupid ****ing tissues Nigg🅰️

View Set

Ameoba Sisters: 27-53 Bio Unit 4

View Set