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 8 pages
Exam (elaborations)

CDA 3100 CORE REVIEWS ANSWERS AND QUESTIONS SET A.pdf

Document preview thumbnail
Preview 2 out of 8 pages

CDA 3100 CORE REVIEWS ANSWERS AND QUESTIONS SET A.pdf

Content preview

CDA 3100 CORE REVIEWS ANSWERS AND
QUESTIONS SET A+
✔✔If $t0 is holding 17, $t1 is holding 8, what will be the value stored in $t2 after the
following instructions?
andi $t0, $t0, 3
beq $t0, $0, L1
addi $t0, $t0, 1
L1: add $t2, $t0, $t1

(a) 10.
(b) 8.
(c) 2.
(d) None of the above. - ✔✔A

✔✔What does the instruction slt do?
slt $t3, $t1, $t2 - ✔✔Set $t3 to be 1 if $t1 < $t2, else clear $t3 to be 0

✔✔What register holds the address of the current instruction being executed? -
✔✔Program Counter

✔✔The offset of conditional branch instructions is relative to __________
(Slide 85, MIPS Assembly ppt) - ✔✔PC + 4

✔✔A loop must have what three things - ✔✔1. a loop body (what you want it to do)
2. A checking point
3. A mechanism to bring us from the end of the loop back to the beginning of the loop

✔✔MIPS usually ends with what instruction? - ✔✔li $v0,10 # telling the simulator to stop
syscall

✔✔If $t0 is holding 30, in the binary of instruction add $t2, $t0, $t1, the rs field should be
30? - ✔✔No; should be an index of $t0

, ✔✔Is it true that because the j instruction has to specify the entire address, it has a
smaller opcode field? - ✔✔No

✔✔Is it correct to write an instruction addi $t0, $t0, 100000? - ✔✔No, the number is too
large

✔✔Is it true that instruction beq $t0, $t1, L1 does not store the entire address
associated with L1 but the offset with respect to its own address? - ✔✔Yes

✔✔Is it true that the PC (program counter) always stores the address of the current
instruction, except when encountering beq, bne, and j? - ✔✔No

✔✔It would be nice if we have an instruction like beq $t0, 5, L1
which compares $t0 with the constant 5 and jumps if they are the same. Does MIPS
have this instruction? Why? - ✔✔Does not have it. Cannot fit in two immediate
numbers.

✔✔jal does two things: - ✔✔Goto the label in the instruction, and save the address of
the next address of the next instruction in $ra (register that stores the return address)

✔✔jr $ra does what? - ✔✔Goto the instruction whose address is the value stored in $ra

✔✔At the end of a function we write ____________ to go back - ✔✔jr $ra

✔✔T/F: A MIPS function is called by the jal instruction, which does two things: 1) going
to the address of the first instruction in the function, 2) passing the arguments in $a0 to
$a3. - ✔✔False

✔✔A MIPS function must be ended by the jr $ra instruction. - ✔✔True

✔✔MIPS functions are stored in a different part in the memory and not in the same part
as the main function. - ✔✔False

✔✔A MIPS function has to explicitly declare a name along with the list of arguments to
be passed to it, including the names and the types. - ✔✔False; No such list is explicitly
maintained.

✔✔A function in MIPS cannot have loops. - ✔✔False

✔✔In MIPS, the name of a function is a special data type. - ✔✔False

✔✔The jal L1 instruction jumps to L1, and saves the address of L1 into $ra. - ✔✔False.
The next one into $ra

Document information

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

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