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 MAIN TIPS ANSWERS AND QUESTIONS SET A.pdf

Document preview thumbnail
Preview 2 out of 8 pages

CDA 3100 MAIN TIPS ANSWERS AND QUESTIONS SET A.pdf

Content preview

CDA 3100 MAIN TIPS ANSWERS AND QUESTIONS
SET A+
✔✔Is it correct to write this instruction?
lw $s0, $s1($s0) - ✔✔No, number must be a constant

✔✔Is it correct to write this instruction?
add $s0, 100($s1), $s2 - ✔✔No, two numbers added must be registers, not from
memory

✔✔Suppose memory at address 1000 to 1027 are storing 1,2,...,8 (in each 4 bytes).
Suppose $t0 is 1000. What will be in $t0 after this instruction?
lw $t0, 16($t0) - ✔✔5

✔✔Suppose we have the address of A[i] in $t0, where A is an integer array. Write
instructions to swap A[i] and A[i+1]. - ✔✔lw $t1, 0($t0)

✔✔Where are instructions and data stored? - ✔✔BOTH are in memory

✔✔What does R-type mean?
I-type?
J-type? - ✔✔Register type
Immediate type
Jump type

✔✔Constants inside arithmetic operations so that they are much faster - ✔✔true

✔✔The immediate in andi, ori, and xori is treated as an unsigned ______ bit number -
✔✔16

✔✔Instruction NOR function - ✔✔If at least one of the bits is 1, the result is 0; use $zero
as one of the input operands (pseudoinstruction)

, ✔✔With these instructions, how can we load an integer value (like 100) into a register
($t0)? - ✔✔addi $t0, $zero, 100
ori $t0, $zero, 80

✔✔How to tell if $t0 is equal to $t1? Suppose you need to set $s0 to be 0 if they are
equal and any non-zero value otherwise - ✔✔Xor, sub, both will work

✔✔How to tell if $t0 is an odd number? Suppose you need to set $t1 to be 1 if so and 0
otherwise - ✔✔andi $t1, $t0, 1

✔✔How to tell if $t1 is no less than $t0?
Set $t2 to be 0 if $t1 is no less than $t0, otherwise 1 - ✔✔sub $t2, $t1, $t0
srl $t2, $t2, 31

✔✔Set $t1 to be 7 times $t0 in 2 instructions - ✔✔sll $t1, $t1, $t0
sub $t1, $t1, $t0

✔✔Suppose $t0 is storing 30, $t1 is storing 20. After the following instructions, what will
be the value in $t2?
sub $t2, $t0, $t1
srl $t2, $t2, 2
ori $t2, $t2, 10

(a) 8
(b)10
(c)18
(d) None of the above. - ✔✔B

✔✔Suppose word array A stores 0,1,2,3,4,5,6,7,8,9, in this order. Assume the starting
address of A is in $s0. After the following instructions, what will be the value in $t0?

addi $s0, $s0, 32
lw $t0, 4($s0)
andi $t0, $t0, 1

(a) 0
(b) 8
(c) 9
(d) None of the above. - ✔✔D

✔✔Assume A is an integer array with 10 elements storing 0,1,2,3,4,5,6,7,8,9. Assume
the starting address of A is in $s0 and $t0 is holding 3. After the running the following
code, what will be the content of $t0?

Document information

Uploaded on
September 11, 2026
Number of pages
8
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$19.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
5614
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