CORRECT Answers
After having run both of the following instructions, what value will be in register t8?
li $t8, 2
li $t8, 4 - CORRECT ANSWER 4
If register t0 contains 0 and t1 contains 4, what will the following instruction do?
sw $t0, 0($t1) - CORRECT ANSWER Copy the contents of register t0 into the memory
address, 4
If register t2 contains 1 and register t3 contains 1, what value will they contain after running the
following instruction? - CORRECT ANSWER t2 will contain 2 and t3 will contain 1
Which of the following code snippets results in a loop? - CORRECT ANSWER label:
j label
Which of the following instructions will read a value from memory and copy it into a register? -
CORRECT ANSWER lw - The load immediate (li) instruction loads a value given in the
instruction (i.e. an immediate value) directly into a register and does not interact with memory.
The store word (sw) instruction performs a write to memory rather than a read. Both the add
immediate (addiu) and shift left logical (sll) instructions only interact with registers and do not
read from or write to memory.
Which of the following instructions will write a value from a register into memory? - CORRECT
ANSWER sw - The load immediate (li) instruction loads a value given in the instruction (i.e.
an immediate value) directly into a register and does not interact with memory. The store word
(sw) instruction performs a write to memory rather than a read. Both the add immediate (addiu)
and shift left logical (sll) instructions only interact with registers and do not read from or write to
memory.
, At any given time while a program is running, where is the current value of the switches located?
- CORRECT ANSWER Memory address: 0xf0100000
If switch 2 and switch 3 are both set, what value will be read from the switches? - CORRECT
ANSWER 12 (2^2 + 2^3)
Which types of instructions have branch delay slots? - CORRECT ANSWER Jump and
branch instructions
What is the smallest value that can be written to the address of the LED array in order to turn on
all 8 LEDs? - CORRECT ANSWER 0xff
Which value, when written to the memory address of the LED array, will turn on LEDs 0, 2, and
4? - CORRECT ANSWER 0b10101
Assume that register $t2 contains 0xf0100000. Which instruction will copy the current value of
the switches into register $s1? - CORRECT ANSWER lw $s1, 0($t2)
The first argument in the load word instruction is the destination register, which is where the
value copied from memory will be placed.
Assume that register $s3 contains 0xf0200000 and register $t4 contains 0b101. Which
instruction will turn on LEDs 2 and 0? - CORRECT ANSWER sw $t4, 0($s3)
The first argument in the store word instruction is the source register, which is where the value
being copied to memory will come from.
The following branch will never be taken:
bne $t0, $t0, label - CORRECT ANSWER True
If registers $t1, $t2, and $t3 all contain 2, what value will each of them contain after running the
following instruction?
addu $t1, $t2, $t3 - CORRECT ANSWER $t1 - 4