GATE Computer ScienceHardGATE CS (PYQ pattern)
An 8-bit CPU compares A = 0x7F with B = 0x80 by computing A + (~B) + 1 and sets flags N (sign of result), Z, C (carry-out of the adder) and V (signed overflow). Which of the following are true? I. N = 1 II. V = 1 III. C = 1 IV. A < B as signed numbers according to N ⊕ V V. A < B as unsigned numbers according to C = 0
- A. I, II and IV only
- B. I, II and V only
- C. I, IV and V only
- D. II, III and V only
Correct answer: B. I, II and V only
A − B = 127 − (−128) = 255 does not fit in signed 8 bits: the result pattern 0xFF has N = 1 and V = 1. There is no carry-out because 0x7F < 0x80 unsigned, so C = 0 (borrow) and unsigned A < B. N ⊕ V = 0, correctly reporting that A is not less than B signed.
More Digital Logic questions
- An 8-bit ALU computes 0x80 − 0x01 as 0x80 + 0xFE + 1. What are the resulting flags (N, Z, C, V) where C is the adder's carry-out?
- A 4-bit register Q3Q2Q1Q0 shifts right every clock (Q2 ← Q3, Q1 ← Q2, Q0 ← Q1), and the new Q3 = Q3 ⊕ Q0 (old values). It starts at 1000…
- A 4-bit ripple counter uses toggle flip-flops with T = 1. FF0 is clocked by the input clock and toggles on each rising edge. FF1 is…
- A synchronous circuit has two D flip-flops with D1 = X ⊕ Q2 and D2 = Q1 ⊕ X, and output Z = Q1·Q2'. It starts at Q1Q2 = 00. Which…
- A single 2:1 multiplexer (output = s ? y : x) has each of its three inputs connected to one of 0, 1, a or b (no inverters). How many…
- A 128-to-1 multiplexer is built as a tree of 4-to-1 multiplexers only (unused data and select inputs may be tied to constants). What is…