Skip to content
Tech Interview Prep
Technical interview guide

Quantum Programming Frameworks

The practical toolchain a quantum software engineer works in day to day (Qiskit, Cirq, and PennyLane) and the difference between simulators and real hardware backends.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v3
Editorial status
Reviewed

Scope: Qiskit current; Cirq current; PennyLane 0.45; Amazon Braket current; OpenQASM 3; QIR current documentation reviewed 2026-09-04.

Overview

Curated: · Written: · Reviewed:

Quantum Programming Frameworks

In one line

Qiskit, Cirq and PennyLane are the toolchains you build, compile and run circuits in. Reach for them when you need to move a circuit from a local simulator to a hardware backend, because that move is where most of the interview questions sit.

Key definitions

  • Target: Qiskit's description of a device's basis gates, coupling map and limits. Transpilation compiles against it.
  • Sampler: Qiskit primitive that returns bitstring counts from shots.
  • Estimator: Qiskit primitive that returns expectation values of observables.
  • Moment: Cirq time slice. Operations in one moment act on disjoint qubits.
  • QNode: PennyLane function binding a circuit to a device and a differentiation method.

Formulas and complexity

σp=p(1−p)N\sigma_p=\sqrt{\frac{p(1-p)}{N}}

Standard error of a probability estimated from N shots. At p = 0.5 and N = 4096 it is under 1%.

memory=2n×16 bytes\text{memory}=2^n \times 16\ \text{bytes}

Statevector memory at complex128. A 30-qubit state needs 16 GiB.

∂θf=12[f(θ+π2)−f(θ−π2)]\partial_\theta f=\tfrac{1}{2}\left[f\left(\theta+\tfrac{\pi}{2}\right)-f\left(\theta-\tfrac{\pi}{2}\right)\right]

Parameter-shift for standard Pauli rotations. Each parameter costs two circuit evaluations per gradient, so 40 parameters cost 80 evaluations, each repeated for every shot batch.

How it works

  1. Build the circuit with free parameters as objects.
  2. Bind values, keeping each parameter bound by object identity.
  3. Transpile against the target's basis gates and coupling map.
  4. Check the target's live capabilities at submission time.
  5. Simulate, or submit with a durable idempotency key.
  6. Store counts together with provider metadata and the exact executed circuit.
simulator QPU Build circuit Bind parameters Transpile to target Live target check Statevector or noisy simulation Submit with idempotency key Normalize result

When to use and when not to

OptionUse whenLimit
Statevector simulatorIdeal amplitudes, small n, CI testsMemory grows as 2^n, no noise or shots
Density-matrix or trajectory simulatorModelled noise mattersCost rises quickly with qubit count
Hardware QPUDevice behaviour is the questionQueue time, per-shot fee, calibration drift
Adjoint or backprop gradientsExact gradients on a simulatorNot available on hardware
Parameter-shift gradientsHardware, or any device without analytic gradientsTwo evaluations per parameter, all shot-limited

Traps interviewers probe

  1. Reading bit order as fixed. Qiskit labels qubit 0 on the right. Check histogram conventions with an asymmetric fixture before computing fidelity.
  2. Estimating a Pauli expectation from computational-basis counts. Z-type terms work on raw counts, but X-type terms need a basis change before measurement. Fix: use the Estimator, or rotate each term's basis explicitly.
  3. Calling Operator on a circuit with measure, reset or conditionals. It raises QiskitError, while depth() and count_ops() still return. Fix: simulate the circuit, or compare only its unitary part.
  4. Retrying a timed-out submit without an idempotency key. The provider may have accepted the first request, so the retry bills twice. Fix: persist the key before sending, look the job up by key on timeout, and retry only if no job exists.
  5. Binding parameters by name. Independent subroutines that both declare theta collide in a name-keyed table. Fix: bind by parameter object, or give each subroutine a unique parameter.

Interview tips

Open by naming the workflow stage the question tests: compile, execute, or interpret. Then state the one assumption that decides the answer, such as whether the target is a simulator or hardware.

Expect these follow-ups: How many executions does one gradient cost on hardware? What changes if the target has a different coupling map? How do you know two frameworks agree on bit order? What does a passing local simulator not prove?

30-second outline: Name the stage. Give the mechanism in one sentence, for example transpilation rewrites gates to the target's basis and routes two-qubit gates across the coupling map. State the cost, such as extra CX gates and depth, and the trap, such as a silent bit-order flip. Close with the control you use, such as a canary circuit with a known answer at fixed shots.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.