This is representative of the kinds of topics and kind of questions you may be asked on the exam. In addition to this practice exam, you should also review:
li $t0, 15
li $t1, 5
addu $t2, $t0, $t1
$t0: 15, $t1: 5, $t2: 20
li $t0, 7
li $t1, 11
subu $t0, $t0, $t1
$t0: -4, $t1: 11
li $t0, 6
li $t1, 5
nor $t2, $t0, $t1
$t0: 6, $t1: 5, $t2: 8 (6 = (28 0s) 0110, 5 = (28 0s) 0101, (28 0s) 0110 | (28 0s) 0101 = (28 0s) 0111, ~ (28 0s) 0111 = (28 1s) 1000, (28 1s) 1000 = 4294967288). Note This question isn't fair because of how big the decimal number is; I originally neglected the 28 0s to the left.
li $t0, 12
li $t1, 4
multu $t0, $t1
mflo $t2
$t0: 12, $t1: 4, $t2: 48
li $t0, 14
li $t1, 4
divu $t0, $t1
mflo $t2
$t0: 14, $t1: 4, $t2: 3, keep in mind this is integer division
li $a0, 83
li $v0, 1
syscall
83
li $t0, 3
ori $t0, $t0, 8
$t0: 11 (3 = 0011, 8 = 1000, OR yields 1011 = 11)
li $t0, 7
andi $t0, $t0, 13
$t0: 5 (7 = 0111, 13 = 1101, AND yields 0101 = 5)
li $t0, 8
xori $t0, $t0, 11
$t0: 3 (8 = 1000, 11 = 1011, XOR yields 0011 = 3)
li $a0, 15
li $v0, 1
syscall
li $a0, 'a'
li $v0, 11
syscall
li $a0, 4
li $v0, 1
syscall
15a4
li $a0, 24
li $v0, 1
syscall
li $a0, 47
li $v0, 1
syscall
2447
.data
foo:
.asciiz "Some string\n"
bar:
.asciiz "Some other string\n"
main:
la $a0, bar
li $v0, 4
syscall
li $v0, 10
syscall
Some other string
.data
foo:
.ascii "alpha"
bar:
.asciiz "beta"
main:
la $a0, bar
li $v0, 4
syscall
li $v0, 10
syscall
beta
li $v0, 5
syscall
addiu $a0, $v0, 3
li $v0, 1
syscall
7
$t0 = 3;
$t1 = 7;
$t2 = ($t0 * $t1) + 8;
li $t0, 3
li $t1, 7
mult $t0, $t1
mflo $t2
addiu $t2, $t2, 8
int s0 = 82;
int s1 = s0 << 2;
int s2 = s1 * 20;
int s3 = s2 + 7;
int s4 = s3 - 24;
int s5 = s4 / 3;
main: li $s0, 82 # int s0 = 82; sll $s1, $s0, 2 # int s1 = s0 << 2; li $t0, 20 # int s2 = s1 * 20 (part 1 of 3) mult $s1, $t0 # (part 2 of 3) mflo $s2 # (part 3 of 3) addi $s3, $s2, 7 # int s3 = s2 + 7 li $t1, 24 # int s4 = s3 - 24 (part 1 of 2) sub $s4, $s3, $t1 # (part 2 of 2) li $t2, 3 # int s5 = s4 / 3 (part 1 of 3) div $s4, $t2 # (part 2 of 3) mflo $s5 # (part 3 of 3)
int s0 = <<read integer from the user>>;
int s1 = s0 + 3;
<<print integer s1>>;
main: li $v0, 5 syscall move $s0, $v0 addi $s1, $s0, 3 print: li $v0, 1 move $a0, $s1 syscall