Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 6 pages
Exam (elaborations)

CDA 3100 ANSWERS AND QUESTIONS SET A.pdf

Document preview thumbnail
Preview 2 out of 6 pages

CDA 3100 ANSWERS AND QUESTIONS SET A.pdf

Content preview

CDA 3100 ANSWERS AND QUESTIONS SET A+
✔Suppose $s0, $v0, and $a0 are holding 60, 0, and 35, respectively. After the program
executes till p9L2, what will be the value in $v0?
jal p9L1
j p9L2
p9L1: add $v0, $v0, $a0
blt $v0, $s0, p9L1
jr $ra
p9L2: add ljhl

(a) 100
(b) 70
(c) The program will never run to p9L2.
(d) None of the above. - ✔✔B

✔✔Try to avoid using registers _____ and ______ - ✔✔$s0, $s7

✔✔A stack is a data structure that is first in first out. - ✔✔No

✔✔In MIPS, accessing the stack involves two instructions. - ✔✔Yes; addi and sw

✔✔A function can save registers values on the stack but need not pay attention to the
order when restoring them. - ✔✔False

✔✔Which of the following statements about MIPS stack is true?
(a) If a function has to modify $sp, it can save $sp on the stack by a "sw $sp, 0($sp)"
instruction and restore it later by a "lw $sp, 0($sp)" instruction.
(b) A "push" operation adds a new number to the stack. "push $t0" can be implemented
as a pseudo instruction as "sw $t0, -4($sp)."
(c) Both of the above.
(d) None of the above. - ✔✔D

✔✔Which of the following statements about MIPS stack is true?

, •(a) If a function does not call another function, it does not have to save $ra on the
stack.
•(b) If $sp is modified inside the function, it must be saved on the stack.
•(c) If a function calls another function, it must save $v0 on the stack.
•(d) None of the above. - ✔✔A

✔✔-In MIPS, you implement the stack by yourself by keeping $sp always pointing to the
______element on the stack - ✔✔top

✔✔What are the pointers $fp and $gp? - ✔✔frame pointer and global pointer (MIPS
functions ppt)

✔✔Which of the following statements about the MIPS interrupt mechanism is true?
(a) $EPC is created mainly for robustness. The interrupt can actually use $ra to save
the return address.
(b) It is okay to modify $t0 inside the interrupt because the main program is not
expecting $t0 to be unmodified after the interrupt.
(c) Both of the above.
(d) None of the above. - ✔✔D

✔✔Suppose a MIPS interrupt handler modifies $at but forgets to restore it before
returning. Suppose the interrupt is invoked only once. After it is invoked, which of the
following statements is true?
(a) The main program will not run correctly.
(b) The main program will not run correctly only if the interrupt is invoked during a
function call.
(c) The main program will run correctly.
(d) None of the above. - ✔✔D

✔✔Which of the following statements about the MIPS interrupt mechanism is true?
(a) An interrupt cannot be triggered during a function call (when the processor is
executing instructions inside a function).
(b) When an interrupt is triggered, the interrupt handler code is executed at the same
time the main program code is executed.
(c) Both of the above.
(d) None of the above. - ✔✔D

✔✔Which of the following statements is true?
li.s $f0, 5.0
li.s $f1, 7.0
c.lt.s $f0, $f1
bc1t p8L1
p8L0: add.s $f0, $f0, $f1
p8L1: bc1t p8L0
p8L2:

Document information

Uploaded on
September 11, 2026
Number of pages
6
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$18.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
1
Followers
2
Items
5553
Last sold
1 month ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions