COMSC 260 Exam #3 Questions With Correct Answers. (Quizzes 9-12)
1 view 0 purchase
Course
Comsc 260
Institution
Comsc 260
COMSC 260 Exam #3 Questions With
Correct Answers. (Quizzes 9-12)
Which of the following options below is an accurate visual representation of a runtime stack? -
Answer, 1
00000FFC, 1
00000FF8, 1 <-- ESP (on bottom row)
(blue picture + Runtime Stack initial and final states)
Which instruct...
COMSC 260 Exam #3 Questions With
Correct Answers. (Quizzes 9-12)
Which of the following options below is an accurate visual representation of a runtime stack? -
Answer✔00001000, 1
00000FFC, 1
00000FF8, 1 <-- ESP (on bottom row)
(blue picture + Runtime Stack initial and final states)
Which instruction would cause the runtime stack and register EIP to change from the initial state
shown above to the final state shown above? - Answer✔D-) ret
The _ instruction does the following:
Pushes the offset (address) of the next instruction onto the runtime stack
Copies the address of the procedure that control has been transferred to into EIP - Answer✔C-)
call
Suppose the top of the runtime stack is currently memory address 0000000A (i.e., this address is
stored in ESP). Then suppose the following instruction is executed:
pop eax
What will be the new memory address that is at the top of the stack (i.e., the new address stored
in ESP)? - Answer✔0000000E
1. Suppose a program has the following three push instructions:
push eax
push ebx
push ecx
The corresponding sequence of pop instructions to remove these three values from the stack
should be:
pop eax
pop ebx
pop ecx
2. Register ESP stores the memory address of the location on the stack that is the top of the
stack. - Answer✔1. False
2. False
Suppose a program starts with the following instructions:
mov eax, 0
mov al, 11111111b
The first instruction clears eax, and the second instruction moves the 8-bit binary number
11111111 into al (the lowest byte of eax).
From here, the program is supposed to shift the number 11111111 from al (the lowest byte of
eax) to the highest byte of eax. How many add eax, eax instructions are needed to do this? -
Answer✔C-) 24
1. The runtime stack grows _
2. From _ memory addresses to _ memory addresses. - Answer✔1. downward
2. higher, lower
Suppose a program has the string "COMSC 260" stored in source. The goal of the program is to
store the reversed string, "062 CSMOC" in target. Part of the program is as follows:
Which of the options below contains the correct instructions to insert at lines 1 - 4 in the code
shown above? - Answer✔1. mov al, [esi]2. push eax
3. pop eax4. mov [esi], al
Which of the options below is equivalent to the instruction pop EAX? - Answer✔mov EAX,
[ESP]
add ESP, 4
Which of the options below is equivalent to push EAX? - Answer✔A-)
sub ESP, 4
mov [ESP], EAX
if( EAX <= EBX )
X = 5;
else
X = 10;
Which of the options below is equivalent to the code shown above? - Answer✔A-)
cmp EAX, EBX
ja L1
mov X, 5
jmp L2
L1: mov X, 10
L2:
1. The instruction xor al, al will always set the sign flag (SF) to 0.
2. The instruction xor al, al will always set the zero flag (ZF) to 0.
3|Page
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Brightstars. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.49. You're not tied to anything after your purchase.