Skip to content
Kartikey Purohit
← Course overview

Sample Papers

Paper 1

Fundamentals of Quantum Computing Using Qiskit v2.X Developer

Questions 34 (half-length paper; real exam is 68)
Time limit 45 minutes (~79 seconds/question)
Passing target 24 / 34 ≈ 69% (mirrors the real 47/68 threshold)
Answer format Single best answer A–D unless a question says "Choose TWO"

Instructions

  1. Assume qiskit 2.x, qiskit-ibm-runtime (V2 primitives), and qiskit-aer are installed; all imports shown are the only ones needed.
  2. Qiskit's little-endian convention applies everywhere: qubit 0 is the rightmost character in bitstrings, Pauli strings, and statevector labels.
  3. Numerical outputs are exact up to floating-point rounding; pick the closest option.
  4. No notes, no interpreter. Time yourself. Answers are in paper-01-answers.md.

Section 1 — Create Quantum Circuits (Q1–Q6)

Q1. What does this code print?

from qiskit import QuantumCircuit
 
qc = QuantumCircuit(3)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 2)
qc.x(0)
print(qc.depth())
  • A. 2
  • B. 3
  • C. 4
  • D. 5

Q2. What does this code print?

from qiskit import QuantumCircuit
 
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
print(qc.size(), qc.width())
  • A. 3 2
  • B. 4 2
  • C. 4 4
  • D. 3 4

Q3. Which snippet prepares the Bell state (|00⟩ + |11⟩)/√2 on a fresh 2-qubit circuit?

  • A. qc.h(0); qc.cx(0, 1)
  • B. qc.cx(0, 1); qc.h(0)
  • C. qc.h(0); qc.h(1)
  • D. qc.x(0); qc.cx(0, 1)

Q4. A circuit is built with qc = QuantumCircuit(3) (no classical bits) and some gates, then qc.measure_all() is called. Which statement is true?

  • A. It raises an error because the circuit has no classical register
  • B. It measures into an existing register that must be named 'c'
  • C. It adds a barrier and a new 3-bit classical register named 'meas', then measures every qubit
  • D. It measures only the qubits that have gates applied to them

Q5. What does this code print?

from qiskit import QuantumCircuit
from qiskit.circuit import Parameter
 
theta = Parameter('t')
qc = QuantumCircuit(1)
qc.rx(theta, 0)
qc.rz(theta, 0)
print(len(qc.parameters))
  • A. 0
  • B. 1
  • C. 2
  • D. It raises an error because a parameter cannot be reused

Q6. Which statement about generate_preset_pass_manager is correct?

  • A. It accepts optimization levels 1–4, with 4 being the most aggressive
  • B. Level 0 performs the same gate optimization as level 3, just without routing
  • C. You must still call transpile() on its output before running on hardware
  • D. It accepts optimization levels 0–3, and level 3 applies the most aggressive optimization

Section 2 — Perform Quantum Operations (Q7–Q12)

Q7. What does this code print?

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
 
qc = QuantumCircuit(2)
qc.x(0)
sv = Statevector.from_instruction(qc)
print(sv.probabilities_dict())
  • A. {'01': 1.0}
  • B. {'10': 1.0}
  • C. {'01': 0.5, '10': 0.5}
  • D. {'11': 1.0}

Q8. What does this code print?

from qiskit.quantum_info import SparsePauliOp
 
op = SparsePauliOp.from_list([("XX", 1.0), ("XX", 2.0), ("ZZ", 0.0)]).simplify()
print(op)
  • A. SparsePauliOp(['XX', 'XX', 'ZZ'], coeffs=[1.+0.j, 2.+0.j, 0.+0.j])
  • B. SparsePauliOp(['XX'], coeffs=[3.+0.j])
  • C. SparsePauliOp(['XX', 'ZZ'], coeffs=[3.+0.j, 0.+0.j])
  • D. It raises an error because duplicate Pauli terms are not allowed

Q9. After this code runs, which state is the qubit in (up to numerical precision)?

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
 
qc = QuantumCircuit(1)
qc.h(0)
qc.z(0)
qc.h(0)
sv = Statevector.from_label('0').evolve(qc)
  • A. |0⟩
  • B. |1⟩
  • C. |+⟩
  • D. |−⟩

Q10. Which circuit leaves the two qubits in an entangled state?

  • A. qc.h(0); qc.cx(0, 1)
  • B. qc.h(0); qc.h(1)
  • C. qc.x(0); qc.x(1)
  • D. qc.h(0); qc.z(0)

Q11. What does this code print?

from qiskit.quantum_info import Statevector, SparsePauliOp
 
sv = Statevector.from_label('+')
print(round(sv.expectation_value(SparsePauliOp('X')).real, 6))
  • A. 1.0
  • B. 0.0
  • C. -1.0
  • D. 0.5

Q12. Which single gate transforms |+⟩ into |−⟩?

  • A. X
  • B. H
  • C. Z
  • D. S

Section 3 — Run Quantum Circuits (Q13–Q17)

Q13. You are running a variational algorithm (VQE): each iteration uses the previous iteration's results to choose new parameters, and you want to avoid re-queuing between iterations. Which execution mode is the best fit?

  • A. Job mode
  • B. Session mode
  • C. Batch mode
  • D. Serverless mode

Q14. Which snippet correctly selects the least busy real device?

from qiskit_ibm_runtime import QiskitRuntimeService
service = QiskitRuntimeService()
  • A. backend = service.least_busy(operational=True, simulator=False)
  • B. backend = service.backends(least_busy=True)[0]
  • C. backend = service.get_backend('least_busy')
  • D. backend = least_busy(service.backends())

Q15. You pass a freshly built (untranspiled) circuit containing h and cx gates directly to SamplerV2(mode=backend).run(...) for a real IBM QPU. What happens?

  • A. The service transpiles it automatically before execution
  • B. It runs, but with reduced fidelity
  • C. The job is rejected because the circuit does not match the backend's ISA (target basis gates and connectivity)
  • D. The gates outside the basis set are silently skipped

Q16. Which snippet is the correct Qiskit v2.x pattern for running a circuit on a real backend?

  • A. result = qiskit.execute(qc, backend, shots=1024).result()
  • B. pm = generate_preset_pass_manager(optimization_level=1, backend=backend); isa = pm.run(qc); job = SamplerV2(mode=backend).run([isa])
  • C. job = backend.run(qc, shots=1024)
  • D. sampler = Sampler(backend); result = sampler(circuits=[qc])

Q17. You want to test a SamplerV2-style workflow locally, with no IBM Quantum account and no noise. Which class should you use?

  • A. StatevectorSampler from qiskit.primitives
  • B. SamplerV2 with QiskitRuntimeService(channel="local")
  • C. backend.run on qasm_simulator
  • D. SamplerV1 from qiskit_ibm_runtime

Section 4 — Use the Sampler Primitive (Q18–Q21)

Q18. (Choose TWO.) Which two statements about the SamplerV2 primitive are true?

  • A. The circuits it runs must contain measurement instructions
  • B. It returns expectation values of observables
  • C. It returns per-shot measurement data from which counts and bitstrings can be obtained
  • D. It automatically appends measure_all() to circuits without measurements

Q19. What does this code print?

from qiskit import QuantumCircuit
from qiskit.primitives import StatevectorSampler
 
qc = QuantumCircuit(2)
qc.x(0)
qc.measure_all()
job = StatevectorSampler().run([qc], shots=1000)
print(job.result()[0].data.meas.get_counts())
  • A. {'10': 1000}
  • B. {'01': 500, '10': 500}
  • C. {'01': 1000}
  • D. {'1': 1000}

Q20. A circuit is created with qc = QuantumCircuit(2, 2) and measured with qc.measure([0, 1], [0, 1]), then run with a V2 sampler: result = sampler.run([qc]).result(). Which expression retrieves the counts?

  • A. result[0].data.c.get_counts()
  • B. result[0].data.meas.get_counts()
  • C. result.get_counts(0)
  • D. result[0].quasi_dists

Q21. Which of the following is NOT a valid option on a SamplerV2 instance from qiskit_ibm_runtime?

  • A. sampler.options.default_shots
  • B. sampler.options.dynamical_decoupling.enable
  • C. sampler.options.twirling.enable_gates
  • D. sampler.options.resilience_level

Section 5 — Use the Estimator Primitive (Q22–Q25)

Q22. Which statement about circuits submitted to the EstimatorV2 primitive is true?

  • A. They must end with measure_all()
  • B. They must not contain measurements — the observable defines what is measured
  • C. They must contain exactly one mid-circuit measurement
  • D. Measurements are allowed but ignored

Q23. What does this code print?

from qiskit import QuantumCircuit
from qiskit.quantum_info import SparsePauliOp
from qiskit.primitives import StatevectorEstimator
 
qc = QuantumCircuit(1)
qc.h(0)
job = StatevectorEstimator().run([(qc, [SparsePauliOp('Z'), SparsePauliOp('X')])])
print(job.result()[0].data.evs)
  • A. [0. 1.]
  • B. [1. 0.]
  • C. [0.5 0.5]
  • D. It raises an error because the circuit has no measurements

Q24. After transpiling qc into isa_circuit for a real backend, what must you do to the observable obs before building the Estimator PUB?

  • A. Nothing — observables are automatically remapped
  • B. Transpile the observable with the same pass manager
  • C. Call obs = obs.apply_layout(isa_circuit.layout)
  • D. Call obs.compose(isa_circuit)

Q25. Which statement about EstimatorV2 resilience levels in Qiskit Runtime is correct?

  • A. Level 0 applies measurement error mitigation only
  • B. Level 1 (the default) applies measurement error mitigation; level 2 adds zero-noise extrapolation (ZNE)
  • C. Level 2 applies probabilistic error cancellation (PEC) by default
  • D. Level 1 applies ZNE; level 2 adds dynamical decoupling

Section 6 — Visualize Circuits, Measurements, and States (Q26–Q29)

Q26. You prepare the Bell state (|00⟩ + |11⟩)/√2 and call plot_bloch_multivector(state). What do the two Bloch spheres show?

  • A. Both vectors pointing along +Z
  • B. One vector along +X, one along +Z
  • C. Both vectors pointing along +X
  • D. Both vectors with zero length (at the center of each sphere)

Q27. Which code produces this drawing?

     ┌───┐
q_0: ┤ H ├──■──
     └───┘┌─┴─┐
q_1: ─────┤ X ├
          └───┘
  • A. qc.h(0); qc.cx(0, 1)
  • B. qc.h(0); qc.cx(1, 0)
  • C. qc.h(1); qc.cx(0, 1)
  • D. qc.h(1); qc.cx(1, 0)

Q28. On a plot_state_qsphere visualization, what does the color of each point encode?

  • A. Measurement probability
  • B. The relative phase of that basis-state amplitude
  • C. The qubit index
  • D. The number of shots

Q29. Where does the state |−⟩ = (|0⟩ − |1⟩)/√2 sit on the Bloch sphere?

  • A. +X axis
  • B. −X axis
  • C. +Y axis
  • D. −Z axis

Section 7 — Retrieve and Analyze Results (Q30–Q32)

Q30. Yesterday you submitted a Runtime job and saved its job ID. In a brand-new Python session, how do you retrieve that job?

  • A. job = QiskitRuntimeService().job(job_id)
  • B. job = SamplerV2.retrieve(job_id)
  • C. job = backend.retrieve_job(job_id)
  • D. Jobs cannot be retrieved after the Python session that created them ends

Q31. A single-qubit circuit measured in the computational basis returns {'0': 600, '1': 400} over 1000 shots. What is the estimated expectation value ⟨Z⟩?

  • A. 0.2
  • B. -0.2
  • C. 0.6
  • D. 0.4

Q32. The standard error on an estimated expectation value is 0.02 at 1,000 shots. Approximately how many shots do you need to reduce it to 0.01?

  • A. 2,000
  • B. 4,000
  • C. 10,000
  • D. 1,500

Section 8 — Operate with OpenQASM (Q33–Q34)

Q33. This OpenQASM 2 program is loaded with qiskit.qasm2.loads and run on an ideal simulator with 100 shots. What are the counts?

OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
x q[1];
measure q -> c;
  • A. {'01': 100}
  • B. {'10': 100}
  • C. {'11': 100}
  • D. {'00': 100}

Q34. Which snippet returns a circuit's OpenQASM 3 representation as a Python string?

  • A. qc.qasm()
  • B. qiskit.qasm3.dump(qc)
  • C. qiskit.qasm3.dumps(qc)
  • D. qc.to_qasm3()

End of Paper 01 — check your work against paper-01-answers.md.