Quantum Gates & the Circuit Model
How quantum programs are expressed as circuits of unitary gates acting on qubits: the single- and multi-qubit gates every quantum algorithm is built from.
- Minutes to read
- 3
- Practice MCQs
- 25
- Interview Q&A
- 25
- Edition
- v3
- Editorial status
- Reviewed
- Relevant for
- Quantum Software Engineer
Scope: IBM Quantum and Qiskit current circuit/transpiler documentation; OpenQASM 3; QIR specification reviewed 2026-09-04.
Curated: · Written: · Reviewed:
MCQ-2A two-qubit circuit is built from the gates X, H, CNOT and T, and the team wants to confirm that the compiled sequence U = H⊗I · CNOT · T⊗I is a legal ideal gate before running it on hardware. They compute U†U and get a 4×4 matrix whose diagonal entries are 1.0, 1.0, 1.0, 1.0 and whose off-diagonal entries are all 0.0 to within 1e-12. What does this result establish about U?
Answer to see the discussion.
MCQ-3A teammate wants to implement Pauli X in a state-vector simulator as a multiply of both basis amplitudes by the same phase, arguing that X "only changes phase" and that global phase is unobservable. The test suite prepares one qubit in |0>, applies X, and asserts the post-gate amplitude vector rather than measurement statistics. Which action must the routine implement for that assertion to pass?
Answer to see the discussion.
MCQ-5A reviewer argues that Pauli Y is just Pauli X with a global phase attached, because both flip |0⟩ and |1⟩. A colleague writes out the matrices: X = [[0,1],[1,0]] and Y = [[0,−i],[i,0]]. Which statement about Y's action on the basis states is correct?
Answer to see the discussion.
MCQ-8A team is building a variational ansatz and needs one parameterized gate that turns |0> into equal superposition with a relative phase of −i at a single parameter value, sweeping continuously through intermediate states as the parameter varies. Which statement about Rx(θ) is correct?
Answer to see the discussion.
MCQ-15A transpiler swaps one decomposition of a single-qubit gate for another that multiplies every amplitude by e^{iπ/4}. Standalone, the two circuits give bit-identical measurement statistics; only when the gate is later used as the target of a control do they diverge. Which difference between the two definitions accounts for the standalone agreement?
Answer to see the discussion.
MCQ-1A 3-qubit circuit is drawn left to right as: H on q0, then CNOT with control q0 and target q1, then CNOT with control q1 and target q2. The team's simulator applies the gates in the drawn order but composes each new gate on the left of the accumulated unitary, so the final operator is U = CNOT(q1,q2) · CNOT(q0,q1) · H(q0). Starting from |000>, which state does this simulator produce?
Answer to see the discussion.
MCQ-16A 2-qubit circuit prepares a state by applying H to q0, then CNOT(q0,q1), then S to q1. An engineer appends a second circuit to return the qubits to |00⟩, but the final state is not |00⟩. Which appended sequence correctly inverts the preparation?
Answer to see the discussion.
MCQ-6A two-qubit register is initialized to |00>. You apply a Hadamard to qubit 0, then a CNOT with qubit 0 as control and qubit 1 as target, then measure both qubits in the computational basis. Across many runs, what distribution of outcomes do you see?
Answer to see the discussion.
MCQ-4A team prepares |+> by applying H to |0>, then applies Z, then measures in the X basis by applying a final H and measuring in the Z basis. They run 1000 shots. What counts do they observe, and why?
Answer to see the discussion.
MCQ-7A circuit prepares |+> = (|0> + |1>)/sqrt(2), applies T = diag(1, e^{i*pi/4}), then applies H and measures in the computational basis. A teammate claims the T gate is irrelevant because it only changes a global phase. What is the measurement outcome distribution, and why does it refute the claim?
Answer to see the discussion.
MCQ-11A 2-qubit circuit starts in |00>. It applies H on q0, then CNOT(q0,q1), then Rz(π/2) on q1. An optimizer moves the Rz(π/2) gate to before the CNOT. What is the final state after this reordering?
Answer to see the discussion.
MCQ-13A statevector backend builds a circuit's unitary by folding `op.to_matrix()` over `circuit.data` in order. On the circuit `h(0)`, `cx(0,1)`, `measure(0, c[0])`, the fold raises on the third element, which has no unitary matrix. A teammate patches the fold to substitute the 2×2 identity for the measurement, and the backend now returns a statevector plus the classical register `c`. What is wrong with the patched output?
Answer to see the discussion.
MCQ-14A compiler team is adding mid-circuit reset to a state-vector simulator. The spec says reset on qubit q must drive q to |0⟩ from any prior state of q, including when q is entangled with the rest of the register, while leaving the other qubits' reduced state unchanged. Which model of reset is incorrect?
Answer to see the discussion.
MCQ-9A simulator's two-qubit gate is suspected of being implemented as a mid-circuit measurement of the control followed by a classically controlled X on the target, rather than a coherent CNOT. An engineer runs the circuits below on the coherent implementation. Which circuit's measurement statistics would change if the gate were the measurement-based version?
Answer to see the discussion.
MCQ-20A backend declares basis gates {RZ, SX, X, CX} and a coupling map that is the line 0–1–2–3. The backend rejects any circuit containing a gate outside its basis set or a two-qubit gate on a non-adjacent pair. Which of the following circuits will it accept as-is?
Answer to see the discussion.
MCQ-19A 27-qubit device has a coupling map where qubit 0 is coupled only to qubit 1, and qubit 1 is coupled to qubits 0, 2 and 3. A circuit is written with three qubits and a single CNOT between its qubit 0 and its qubit 2. The transpiler is run with optimization_level=1 and no initial_layout given. After transpilation the CNOT is reported as cx q1, q3. Which statement explains why the transpiler produced this result?
Answer to see the discussion.
MCQ-10A 5-qubit device has the coupling map 0-1-2-3-4, a line in which the native two-qubit gate CX runs only between neighbouring physical qubits; there is no long-range or teleportation-based gate. A circuit contains one two-qubit gate, CX(q0, q4), with logical q0 mapped to physical 0 and logical q4 mapped to physical 4, and the routing pass is allowed to insert SWAP gates. What is the minimum number of SWAPs the router must insert for the circuit to execute?
Answer to see the discussion.
MCQ-21A 5-qubit device has a linear coupling map 0–1–2–3–4: two-qubit gates are allowed only between adjacent physical qubits. A circuit needs one CNOT between the logical qubits currently placed on physical qubits 0 and 4, and the compiler routes by inserting SWAPs along the shortest path. Each SWAP is decomposed into three CNOTs. How many additional CNOTs does the routing insert?
Answer to see the discussion.
MCQ-12A 6-qubit circuit is compiled for a device whose native gate set is {CX, RZ, SX, X}. The compiler reports gate count 14, circuit depth 7, and two-qubit depth 5. A teammate argues the circuit is too slow because 14 gates is a lot, and proposes replacing it with a different compilation that reports gate count 11, circuit depth 9, and two-qubit depth 6. On this device, CX gates take 400 ns and single-qubit gates take 40 ns, and gates on disjoint qubits can be issued in the same cycle. Which compilation should be chosen, and why?
Answer to see the discussion.
MCQ-17Suppose a 5-qubit circuit contains a single Toffoli (CCX) gate. The target device's basis gates are {RZ, SX, X, CX}, with two-qubit (CX) error 1.0e-2 and single-qubit error 1.0e-4. The transpiler's default decomposition of CCX uses 6 CX gates and 10 single-qubit gates. An alternative decomposition uses 3 CX gates and 14 single-qubit gates. Both implement CCX exactly. Which decomposition should the transpiler emit, and what is the estimated total gate error?
Answer to see the discussion.
MCQ-18A compiler targets a device whose native gate set is {H, S, CNOT}. It must implement a circuit containing a single-qubit Rz(π/4) rotation to within 1e-3 operator-norm error. The compiler exhaustively searches sequences of up to 12 native gates and reports the best approximation error is 0.39. Which conclusion is correct?
Answer to see the discussion.
MCQ-24A 4-qubit, 40-gate circuit is transpiled for a device whose native gate set lacks the original two-qubit gate. A bug in the transpiler's optimization pass leaves the compiled circuit matching the intended circuit's computational-basis bitstring counts for every input, but with the wrong relative phase between the |01> and |10> amplitudes of the state prepared from |0100>. Which check catches the bug?
Answer to see the discussion.
MCQ-22A team transpiles the same 27-qubit circuit (1,200 CX gates) for a heavy-hex device at `optimization_level=3` in CI. Two runs seconds apart, against an unchanged backend target, produce 431 and 448 CX gates, and the regression test that asserts an exact CX count fails roughly one run in three. Each transpile takes about 9 s. The team wants the lowest CX count they can get and needs the test to stop flapping. What should they do?
Answer to see the discussion.
MCQ-23A team exports a 2-qubit circuit to a portable artifact. The circuit applies H to q0, then measures q0 into c0, then applies X to q1 only if c0 == 1. On the original simulator, 1000 shots give q1 = 1 in 498 shots. After round-trip, 1000 shots give q1 = 1 in 1000 shots. The artifact's JSON contains all three operations with correct operands and parameters, and the operations are in the original order. Which property of the artifact is most likely not preserved?
Answer to see the discussion.
MCQ-25A team re-runs a 12-qubit circuit on the same backend, same software environment, and the same 8192 shots. The source QASM is byte-identical and the backend's published calibration data is unchanged, yet P(1010…) falls from 0.62 to 0.58: a 0.04 gap against a shot-noise σ of about 0.005. They had archived only the source QASM, the backend name, and the counts. Which missing record explains the shift?
Answer to see the discussion.