CDA 3100 ACTUAL FINALS ANSWERS AND
QUESTIONS SET A+
✔✔The 16 bit immediate field in the branch instruction must have the following
operation performed before it can be used. Which are they? - ✔✔Shift left 2 positions,
extended to 32 bits, and added to the PC+4.
✔✔.asciiz str - ✔✔Store string in memory with null terminator
✔✔.ascii str - ✔✔Store the string in memory w/o null terminator
✔✔.byte b1,b2,b3...bn - ✔✔Stores values in successive bytes of memory
✔✔.word w1,w2,w3...wn - ✔✔store the n 32 bit items in memory
✔✔.double d1,d2,d3 - ✔✔Store the n items as dbl precision floating points
✔✔.float f1,f2,f3 - ✔✔Store the n items as single precision floating points
✔✔.half h1,h2,h3 - ✔✔store the n items as a 16 bit value
✔✔.space n - ✔✔Allocate n number of bytes in consecutive storage locations
✔✔.align n - ✔✔Align the next address on a boundary. If n=2 its a full word boundary
✔✔.globl sym - ✔✔declare sym as a global and can be referenced in other areas.
✔✔Given the code below, which of the commands below will load the 4th full word
contents into register $s1.
array .space 100
.
.
la $s2,array - ✔✔lw $s1,12($s2)
, ✔✔Finish the line of code to load a single byte of memory from a storage location called
array into register $s1.
la $s2,array
lw $s1,________ - ✔✔array
✔✔Which command aligns the next line of code on a full word boundary? - ✔✔.align 2
✔✔Which of the following lines of code is a valid for of the Load halfword unsigned
operation? - ✔✔lh $s2,array
✔✔What does the lui operation perform. - ✔✔Load 16 bytes from the immediate field
into the upper part of the register
✔✔What function does the following line of code perform?
addiu $sp,$sp,-32 - ✔✔Sets aside 32 bytes of 8 words of memory from the stack pointer
✔✔Before calling a function with the jal or jalr command you must at least perform
which of the following: - ✔✔Allocate at least 1 word of memory from the stack and save
the $ra register.
✔✔Which command returns from a called function? - ✔✔jr $ra
✔✔The logical AND gate has a truth table such that given two input A and B, the result
of A AND B is 1 if and only if: - ✔✔Both A and B is 1
✔✔Gray codes were developed to order bit patterns such that the change in bits from
one code to another differs by only one bit. For the following question, match order of
the 3 bit gray code starting with 000. The left side is the order, the gray code bits are on
the right.
1 - ✔✔000
✔✔Gray codes were developed to order bit patterns such that the change in bits from
one code to another differs by only one bit. For the following question, match order of
the 3 bit gray code starting with 000. The left side is the order, the gray code bits are on
the right.
2 - ✔✔001
✔✔Gray codes were developed to order bit patterns such that the change in bits from
one code to another differs by only one bit. For the following question, match order of
the 3 bit gray code starting with 000. The left side is the order, the gray code bits are on
the right.
QUESTIONS SET A+
✔✔The 16 bit immediate field in the branch instruction must have the following
operation performed before it can be used. Which are they? - ✔✔Shift left 2 positions,
extended to 32 bits, and added to the PC+4.
✔✔.asciiz str - ✔✔Store string in memory with null terminator
✔✔.ascii str - ✔✔Store the string in memory w/o null terminator
✔✔.byte b1,b2,b3...bn - ✔✔Stores values in successive bytes of memory
✔✔.word w1,w2,w3...wn - ✔✔store the n 32 bit items in memory
✔✔.double d1,d2,d3 - ✔✔Store the n items as dbl precision floating points
✔✔.float f1,f2,f3 - ✔✔Store the n items as single precision floating points
✔✔.half h1,h2,h3 - ✔✔store the n items as a 16 bit value
✔✔.space n - ✔✔Allocate n number of bytes in consecutive storage locations
✔✔.align n - ✔✔Align the next address on a boundary. If n=2 its a full word boundary
✔✔.globl sym - ✔✔declare sym as a global and can be referenced in other areas.
✔✔Given the code below, which of the commands below will load the 4th full word
contents into register $s1.
array .space 100
.
.
la $s2,array - ✔✔lw $s1,12($s2)
, ✔✔Finish the line of code to load a single byte of memory from a storage location called
array into register $s1.
la $s2,array
lw $s1,________ - ✔✔array
✔✔Which command aligns the next line of code on a full word boundary? - ✔✔.align 2
✔✔Which of the following lines of code is a valid for of the Load halfword unsigned
operation? - ✔✔lh $s2,array
✔✔What does the lui operation perform. - ✔✔Load 16 bytes from the immediate field
into the upper part of the register
✔✔What function does the following line of code perform?
addiu $sp,$sp,-32 - ✔✔Sets aside 32 bytes of 8 words of memory from the stack pointer
✔✔Before calling a function with the jal or jalr command you must at least perform
which of the following: - ✔✔Allocate at least 1 word of memory from the stack and save
the $ra register.
✔✔Which command returns from a called function? - ✔✔jr $ra
✔✔The logical AND gate has a truth table such that given two input A and B, the result
of A AND B is 1 if and only if: - ✔✔Both A and B is 1
✔✔Gray codes were developed to order bit patterns such that the change in bits from
one code to another differs by only one bit. For the following question, match order of
the 3 bit gray code starting with 000. The left side is the order, the gray code bits are on
the right.
1 - ✔✔000
✔✔Gray codes were developed to order bit patterns such that the change in bits from
one code to another differs by only one bit. For the following question, match order of
the 3 bit gray code starting with 000. The left side is the order, the gray code bits are on
the right.
2 - ✔✔001
✔✔Gray codes were developed to order bit patterns such that the change in bits from
one code to another differs by only one bit. For the following question, match order of
the 3 bit gray code starting with 000. The left side is the order, the gray code bits are on
the right.