Questions: Processor Status Flags and Condition Codes

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A programmer writes CMP R1, R2 followed by BLT target (branch if less than, signed). The branch is taken. What can we conclude?

AR1 is numerically smaller than R2 in unsigned binary representation
BR1 is less than R2 in signed (two's complement) interpretation, based on the N and V flags set by the subtraction R1 − R2
CThe zero flag was set to 1 because R1 and R2 are equal
DR2 − R1 produced a carry out from the most significant bit, setting the carry flag
Question 2 Multiple Choice

Why does the CMP instruction compute a subtraction but discard the numerical result, storing nothing in any general-purpose register?

ACMP is more efficient than SUB because it skips the register write-back stage in the pipeline
BFor conditional branching, only the flags (zero, negative, carry, overflow) matter — the numerical difference itself is not needed, so discarding it avoids consuming a destination register
CCMP uses the carry flag while SUB uses the overflow flag, making them fundamentally different operations
DThe difference is stored implicitly in the status register rather than truly discarded
Question 3 True / False

A single CMP instruction sets all four status flags simultaneously, so subsequent branch instructions (BEQ, BLT, BGT, BVS) can each check the result of the same comparison.

TTrue
FFalse
Question 4 True / False

On most processor architectures, nearly every instruction automatically updates most four status flags (zero, negative, carry, overflow) as a side effect of execution.

TTrue
FFalse
Question 5 Short Answer

Explain the difference between the carry flag and the overflow flag, and give an example of when you would care about each.

Think about your answer, then reveal below.