MIPS Practice Questions - ANSWERS
MIPS Practice Questions - ANSWERS
MIPS Practice Questions - ANSWERS
00100011101111011111111111111000
10101100100010000000000000000100
00101000101010100000000000000010
00010010000010101111111111111111
00001000010010001101001111111000
6) nop
00000000000000000000000000000000
10001101011100000000000000000000
00000001001010100100000000100010
Convert the following machine code to MIPS instructions:
1) 0 0 1 1 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 1
2) 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0
3) 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
4) 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1
Note: Question should have specified value of Program Counter (PC). (Assume PC =
0x00001000)
j 0x050C86AC
5) 0x3C081234
00111100000010000001001000110100
lui $t0, 0x1234
6) 0x000A4143
00000000000010100100000101000011
sra $t0, $t2, 5
7) 0x00851026
00000000100001010001000000100110
xor $v0, $a0, $a1
8) 0x01AE6020
00000001101011100110000000100000
add $t4, $t5, $t6
Convert the following C code to MIPS assembly code:
int N = 64;
for(int i=0; i<N; i++)
{
A[i] = i;
}
li $t0, 64 #int N = 64
li $t1, 0 #int i = 0
if(i == j && i == k)
i++;
else
j--;
j = i + k;