Knowledge Check

Test your understanding of computer architecture basics

Quiz
Question 1 of 3

C to MIPS Assembly Translation

Convert the following C code to MIPS assembly. Use $s0 for variable 'a', $s1 for 'b', and $s2 for 'result'. Assume registers are already loaded with initial values.

int a = 5;
int b = 10;
int result;

if (a > b) {
    result = a - b;
} else {
    result = b - a;
}