Gates and circuits

Gate questions test whether you can compute, not only recite. Be ready to multiply small matrices by hand and to say what a circuit does to a basis state.

14 questions. Reviewed December 2026. Answers are model answers to adapt, not scripts to memorise.

What interviewers test

  • Matrix and Dirac-notation fluency
  • Universality and decomposition
  • Reading and writing circuits

How to answer well

  • Know the action of H, X, Z, S, T and CNOT on basis states without looking.
  • Say that quantum gates are unitary, hence reversible.
  • When asked for a circuit, draw wires and state the final state step by step.

1 · Beginner

Why are quantum gates unitary?

A unitary matrix preserves the length of a state vector, so total probability stays 1, and it is invertible, so every gate can be undone by its conjugate transpose. Unitarity is what lets amplitudes interfere without creating or destroying probability. The only non-unitary step in a circuit is measurement.

Likely follow-up: Which classical gates are reversible, and is AND one of them?

Go deeper: Quantum gate

2 · Beginner

What do the Hadamard, X and Z gates do?

X flips |0⟩ and |1⟩. Z leaves |0⟩ alone and flips the sign of |1⟩. H maps |0⟩ to |+⟩ = (|0⟩ + |1⟩)/√2 and |1⟩ to |−⟩ = (|0⟩ − |1⟩)/√2, and it swaps the roles of X and Z: HXH = Z and HZH = X. H is its own inverse.

Likely follow-up: What does H do to |+⟩?

Go deeper: Quantum gates lesson · Gate reference

3 · Beginner

What does a CNOT gate do?

It flips the target qubit when the control is 1 and does nothing when it is 0, so |a,b⟩ becomes |a, a⊕b⟩. Applied to a control in superposition it creates entanglement: CNOT on (|0⟩ + |1⟩)/√2 ⊗ |0⟩ gives the Bell state (|00⟩ + |11⟩)/√2.

Likely follow-up: What is the matrix of CNOT, and what is CNOT squared?

4 · Beginner

How do you create a Bell state?

Start with |00⟩. Apply H to qubit 0 to get (|00⟩ + |10⟩)/√2, then CNOT with qubit 0 as control and qubit 1 as target to get (|00⟩ + |11⟩)/√2. Measuring both qubits gives 00 or 11 with probability ½ each and never 01 or 10.

Likely follow-up: How would you create the other three Bell states?

Go deeper: Circuit Builder · Bell state in seven frameworks

5 · Beginner

What are the S and T gates?

Phase gates that leave |0⟩ alone and multiply |1⟩ by a phase: S by i (a quarter turn about Z) and T by e^{iπ/4} (an eighth of a turn). So T² = S and S² = Z. T is the gate that makes the Clifford set universal, and it is expensive on error-corrected machines.

Likely follow-up: Why is T expensive in fault-tolerant computing?

6 · Intermediate

What is a universal gate set?

A set of gates from which any unitary can be approximated to any accuracy. A standard choice is Clifford+T, i.e. H, S, CNOT and T. Single-qubit rotations plus CNOT also suffice. Exact synthesis of arbitrary rotations is impossible with a finite set, so approximation is used, and the Solovay–Kitaev theorem says the cost grows only polylogarithmically in the accuracy.

Likely follow-up: Why is {H, CNOT, S} not universal?

Common mistake: Claiming a finite gate set can produce every unitary exactly.

Go deeper: Quantum gates lesson

7 · Intermediate

What is the Clifford group, and why do people care?

The Clifford gates map Pauli operators to Pauli operators; H, S and CNOT generate them. Circuits built only from Clifford gates and Pauli measurements can be simulated efficiently on a classical computer (the Gottesman–Knill theorem), so they carry no computational advantage on their own. Non-Clifford gates such as T supply the extra power, and counting them (T-count) is a common cost measure.

Likely follow-up: What is a stabilizer state?

8 · Intermediate

Compute the effect of HZH.

HZH = X. You can check by acting on basis states: H|0⟩ = |+⟩, Z|+⟩ = |−⟩, H|−⟩ = |1⟩, so |0⟩ goes to |1⟩, and likewise |1⟩ goes to |0⟩. Conjugating by H swaps X and Z, which is the same as a change of measurement basis.

Likely follow-up: What is HYH?

9 · Intermediate

What is phase kickback?

When a controlled-U acts on a target that is an eigenstate of U with eigenvalue e^{iφ}, the phase appears on the control instead: the control state |1⟩ is multiplied by e^{iφ}, while the target is unchanged. Phase kickback is the trick behind Deutsch–Jozsa, Grover and phase estimation, because it turns a function value into a phase on a superposed register.

Likely follow-up: Which target state do you use for a bit-flip oracle?

Go deeper: Grover’s algorithm

10 · Intermediate

How do you build a SWAP from CNOTs?

Three alternating CNOTs: CNOT(a→b), CNOT(b→a), CNOT(a→b). Tracking basis states shows the bits are exchanged. On hardware with limited connectivity SWAPs are inserted so that distant qubits can interact, which is why connectivity affects circuit depth.

Likely follow-up: What does a SWAP cost on a line of qubits to move a state k places?

11 · Intermediate

What is a Toffoli gate, and why can’t it be run directly on most hardware?

A doubly controlled NOT: it flips the target only if both controls are 1. It is universal for classical reversible computing. Most devices natively support one- and two-qubit gates, so a Toffoli is decomposed into a few single-qubit gates and six CNOTs, which makes it expensive on noisy hardware.

Likely follow-up: How many T gates does a standard Toffoli decomposition use?

12 · Advanced

How can you decompose an arbitrary single-qubit unitary?

Up to a global phase, any single-qubit unitary can be written as Rz(α) Ry(β) Rz(γ), a Z-Y-Z Euler decomposition, three rotation angles. Compilers use this to merge long runs of single-qubit gates into a single rotation sequence, saving depth.

Likely follow-up: How many parameters does an arbitrary two-qubit unitary need?

13 · Advanced

Explain controlled-U versus a controlled phase and how the global phase becomes relevant.

A global phase of U is unobservable on its own, but once U is controlled, that phase becomes a relative phase between the control’s |0⟩ and |1⟩ branches and is observable. That is why compilers must track phase carefully when building controlled operations, for example in phase estimation, where the eigenphase is read out through exactly this effect.

Likely follow-up: How would you make a controlled-Z from a CNOT and Hadamards?

14 · Advanced

What are native gates, and what does a transpiler do?

Each device implements a small native set, such as √X, Rz and a two-qubit gate like CZ or ECR, depending on the technology. A transpiler rewrites your circuit into that set, maps logical qubits to physical ones respecting connectivity (routing, adding SWAPs), and optimises gate count and depth. The same logical circuit therefore compiles to quite different physical circuits on different machines.

Likely follow-up: Why does connectivity affect error rates?

Go deeper: Qiskit’s transpiler · pytket compilation

Keep studying