GATE Computer ScienceHardGATE CS (PYQ pattern)
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. N = 0, Z = 0, C = 1, V = 1
- B. N = 0, Z = 0, C = 0, V = 1
- C. N = 1, Z = 0, C = 1, V = 0
- D. N = 0, Z = 0, C = 1, V = 0
Correct answer: A. N = 0, Z = 0, C = 1, V = 1
The sum is 0x17F, so the result is 0x7F (N = 0, Z = 0) with carry-out 1 (no borrow, since 0x80 ≥ 0x01 unsigned). Signed: −128 − 1 = −129 does not fit, so V = 1.
More Digital Logic questions
- 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…
- A 17-input XOR (parity) function is built only from 3-input XOR gates (no 2-input gates). What are the minimum number of gates and the…