Sample Exam IT3280E TA - Huy

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Question 1: In the MIPS architecture, which registers have values that do

not change during program execution?

○ $at
○ $zero
○ $sp
○ $ra
○ pc
○ lo
○ Another answer
Question 2: What is the serial number of register $k1?
○5
○ 13
○ 21
○ 25
○ 26
○ 27
○ 30
○ Another answer
Question 3: When you inish executing a basic instruction and start
executing a new instruction, how much does the pc register increase?
○ 0x8
○ 0x2
○ 0x4
○ 0x1
○ 0x16
○ Another answer

Question 4: In the Mars application, when translating from source code to


base code, which of the following tasks will be performed?
◻ Convert labels to addresses
◻ Convert registers from names to serial numbers
◻ Convert constants from decimal to hexadecimal
◻ Replace pseudo-commands with basic commands
Question 5: Given the following code:
.text
li $a0, 0
li $a1, 0
li $a2, 5
l1:
beq $a1, $a2, end
add $at, $a1, $a1
add $a0, $a0, $at
addi $a1, $a1, 1
j l1
end:

What is the value of the $a0 register after executing the above code?
◻5
◻6
◻ 15
◻ 20
◻ 30
◻ 40
◻ 60
Question 6: Given the following code:
# DIGITTAL LAB SIM 7-SEGMENT LED SIMULATION

.eqv SEVENSEG_LEFT 0xFFFF0011


.eqv SEVENSEG_RIGHT 0xFFFF0010

.text
main:
li $a0, 0x6F #Set value for right 7seg_led
jal SHOW_7SEG_RIGHT
li $a0, 0x66 #Set value for left 7seg_led
jal SHOW_7SEG_LEFT
exit:
li $v0, 10
syscall
endmain:
SHOW_7SEG_LEFT:
li $t0, SEVENSEG_LEFT
sb $a0, 0($t0)
jr $ra
SHOW_7SEG_RIGHT:
li $t0, SEVENSEG_RIGHT
sb $a0, 0($t0)
jr $ra
# END PROGRAM
Choose the correct statements:
◻ For the code to execute properly, you must connect to "Digital Lab Sim"
before running this code
◻ The 7-segment LED on the left shows the number 4
◻ The 7-segment LED on the right shows the number 9
◻ The 7-segment LED on the right shows the number 8
◻ The 7-segment LED on the left shows the number 6
◻ The 7-segment LED on the right shows the number 6
◻ When connecting "Digital Lab Sim" after running the code, the above code
can still run correctly
◻ The 2-digit number that appears in "Digital Lab Sim" after running the
code is a perfect square number
◻ The 2-digit number that appears in "Digital Lab Sim" after running the
code is a prime number
◻ The 2-digit number that appears in "Digital Lab Sim" after running the
code is an even number
◻ The dot in "Digital Lab Sim" does not appear after running the code
successfully
Question 7: Given the following code:
text
li $a1, 0
li $a2, 5
li $v0, 11
l1:
beq $a1, $a2, end
addi $a0, $a1, x
syscall
addi $a1, $a1, 1
j l1
end:

Let the code above print "mnopq" after execution, what is the value of x ?
(The value to ill in the box is a number, ex.: 2024)
Answer:
Question 8: In the R command format, what is the opcode value always?
(The value to ill in the box is a number, ex.: 2024)
Answer:
Question 9: Translate the following command into machine code (Written
in Hexa, with "0x" in front, ex.: 0x12345678): addi $t8, $t9, 2024
Answer:

You might also like