COT exam Final pt 1 Questions With Complete Solutions
$t0 is a read-only register (T/F) Correct Answers false
A comment in MIPSzy begins Correct Answers #
A subroutine is called using the instruction Correct Answers jal
A subroutine is returned using the instruction: Correct Answers
jr $ra
A subroutine should push all the registers it uses onto the
program stacks t the beginning of the subroutine Correct
Answers True
Assume
$t0: 20
$t1: 30
$t2: 40
What is in $t2 after the following instructions:
addi $t2, $t2, 1
add $t2, $t1, $t0 Correct Answers 50
Assume $t1 holds 5100. Which instruction copies the contents
of $t0 into memory location 5100(DM[4100]) Correct Answers
sw $t0, 0($t1)
Assume $t1 holds 5100. Which instruction copies the contents
of data memory location 5100 (DM[5100]) into $t0 Correct
Answers lw $t0, 0($t1)
, Assume that a subroutine, sub, is loaded beginning at address
1000. A program calls sub with the instruction: jal sub. If jal sub
is at address 2000, what is in $ra after Jalynns sub exectues
Correct Answers 2000??
Assume that the address of variables X and Y are in registers $t0
and $t1, respectively. Which assembly program implements C
statement below?
while ( x>=y)
x = x+ 1; Correct Answers while: blt $t0, $t1 endWhile
addi $t0, $t0, 1
j while
endWhile:
Assume that the address of variables X and Y are in registers $t0
and $t1, respectively. Which of the following assembly
programs implements C statement: x = y-2?
(lw $t2, 0($t1)
addi $t2, $t2, -2
sw $t2, 0($t0)) Correct Answers lw $t2, 0($t1)
addi $t2, $t2, -2
sw $t2, 0($t0)
Assume that the base of an array x is at DM[5000]. Which
MIPSzy instruction read x[1] into register 3? Correct Answers
addi $t0, $zero, 5000
lw $t3, 4($t0)
Assume that variable x is in DM[5100]. Which MIPSzy
instruction implements C statement x = 2; Correct Answers
addi $t0, $zero, 2
$t0 is a read-only register (T/F) Correct Answers false
A comment in MIPSzy begins Correct Answers #
A subroutine is called using the instruction Correct Answers jal
A subroutine is returned using the instruction: Correct Answers
jr $ra
A subroutine should push all the registers it uses onto the
program stacks t the beginning of the subroutine Correct
Answers True
Assume
$t0: 20
$t1: 30
$t2: 40
What is in $t2 after the following instructions:
addi $t2, $t2, 1
add $t2, $t1, $t0 Correct Answers 50
Assume $t1 holds 5100. Which instruction copies the contents
of $t0 into memory location 5100(DM[4100]) Correct Answers
sw $t0, 0($t1)
Assume $t1 holds 5100. Which instruction copies the contents
of data memory location 5100 (DM[5100]) into $t0 Correct
Answers lw $t0, 0($t1)
, Assume that a subroutine, sub, is loaded beginning at address
1000. A program calls sub with the instruction: jal sub. If jal sub
is at address 2000, what is in $ra after Jalynns sub exectues
Correct Answers 2000??
Assume that the address of variables X and Y are in registers $t0
and $t1, respectively. Which assembly program implements C
statement below?
while ( x>=y)
x = x+ 1; Correct Answers while: blt $t0, $t1 endWhile
addi $t0, $t0, 1
j while
endWhile:
Assume that the address of variables X and Y are in registers $t0
and $t1, respectively. Which of the following assembly
programs implements C statement: x = y-2?
(lw $t2, 0($t1)
addi $t2, $t2, -2
sw $t2, 0($t0)) Correct Answers lw $t2, 0($t1)
addi $t2, $t2, -2
sw $t2, 0($t0)
Assume that the base of an array x is at DM[5000]. Which
MIPSzy instruction read x[1] into register 3? Correct Answers
addi $t0, $zero, 5000
lw $t3, 4($t0)
Assume that variable x is in DM[5100]. Which MIPSzy
instruction implements C statement x = 2; Correct Answers
addi $t0, $zero, 2