Skip to content
Kartikey Purohit
← Course overview

Sample Papers

Paper 9 (full length)

IBM C1000-179: Fundamentals of Quantum Computing Using Qiskit v2.X Developer

Questions 68
Time limit 90 minutes (~79 seconds/question)
Passing score 47 / 68 (≈69%)
Instructions Select the single best answer unless the question says "(Choose two.)" All code assumes Qiskit v2.x with qiskit-ibm-runtime (V2 primitives) and, where noted, qiskit-aer. Bit ordering is little-endian throughout: qubit 0 is the rightmost character of a bitstring or Pauli label.

Do not use a Python interpreter. Answers file: paper-09-FULL-answers.md.


Section 1 — Create Quantum Circuits (Q1–Q12)

Q1. What does the following 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.depth())
  • A. 2
  • B. 3
  • C. 4
  • D. 5

Q2. What does the following code print?

from qiskit import QuantumCircuit
 
qc = QuantumCircuit(3)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 2)
qc.h(0)
qc.barrier()
qc.measure_all()
print(qc.count_ops())
  • A. OrderedDict({'measure': 3, 'h': 2, 'cx': 2, 'barrier': 2})
  • B. OrderedDict({'measure': 3, 'h': 2, 'cx': 2, 'barrier': 1})
  • C. OrderedDict({'measure': 3, 'h': 2, 'cx': 2})
  • D. OrderedDict({'measure': 3, 'h': 1, 'cx': 2, 'barrier': 2})

Q3. Which snippet prepares the 3-qubit GHZ state (|000⟩ + |111⟩)/√2?

  • A.
    qc = QuantumCircuit(3)
    qc.h(0); qc.h(1); qc.h(2)
  • B.
    qc = QuantumCircuit(3)
    qc.h(0); qc.cx(1, 0); qc.cx(2, 1)
  • C.
    qc = QuantumCircuit(3)
    qc.h(0); qc.cx(0, 1); qc.cx(1, 2)
  • D.
    qc = QuantumCircuit(3)
    qc.h(0); qc.cz(0, 1); qc.cz(1, 2)

Q4. What does the following code print?

from qiskit import QuantumCircuit
 
qc = QuantumCircuit(3, 2)
print(qc.width())
  • A. 3
  • B. 2
  • C. 6
  • D. 5

Q5. What does the following code print?

from qiskit import QuantumCircuit
 
qc1 = QuantumCircuit(2)
qc1.h(0)
 
qc2 = QuantumCircuit(2)
qc2.cx(0, 1)
 
qc1.compose(qc2)
print(qc1.draw('text'))
  • A.
         ┌───┐
    q_0: ┤ H ├──■──
         └───┘┌─┴─┐
    q_1: ─────┤ X ├
              └───┘
    
  • B.
         ┌───┐
    q_0: ┤ H ├
         └───┘
    q_1: ─────
    
  • C.
              ┌───┐
    q_0: ──■──┤ H ├
         ┌─┴─┐└───┘
    q_1: ┤ X ├─────
         └───┘
    
  • D. A CircuitError is raised because the circuits act on different registers.

Q6. What is the bound circuit after this code runs?

from qiskit import QuantumCircuit
from qiskit.circuit import Parameter
 
theta = Parameter('theta')
phi = Parameter('phi')
 
qc = QuantumCircuit(1)
qc.rz(theta, 0)
qc.rx(phi, 0)
 
bound = qc.assign_parameters([0.5, 1.5])
  • A. Rz(1.5) followed by Rx(0.5)
  • B. Rz(0.5) followed by Rx(1.5)
  • C. A CircuitError is raised — list binding is not allowed with multiple parameters
  • D. Rz(0.5) followed by Rx(0.5)

Q7. In Qiskit v2.x, which snippet correctly applies an X gate to qubit 1 only when classical register cr holds the value 1?

  • A. qc.c_if(cr, 1).x(1)
  • B. qc.x(1).c_if(cr, 1)
  • C.
    with qc.if_test((cr, 1)):
        qc.x(1)
  • D. qc.if_test(cr == 1, qc.x, 1)

Q8. When calling generate_preset_pass_manager(optimization_level=N, backend=backend), which optimization level still performs layout selection, routing, and basis translation (producing an ISA-compatible circuit) but applies essentially no gate optimization?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Q9. A circuit containing a single h gate is transpiled with basis_gates=['rz', 'sx', 'x', 'ecr']. What does the resulting circuit contain?

  • A. Nothing — an error is raised because h is not in the basis
  • B. One x gate and one rz gate
  • C. Rz(π/2) · √X · Rz(π/2) (two rz and one sx), with a global phase of π/4
  • D. The h gate unchanged, since single-qubit gates never need translation

Q10. Given:

qc = QuantumCircuit(1)
qc.h(0)
qc.s(0)
inv = qc.inverse()

Which gate sequence does inv contain (left to right)?

  • A. H, then Sdg
  • B. Sdg, then H
  • C. S, then H
  • D. H, then S

Q11. What does the following code print?

from qiskit import QuantumCircuit
 
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.measure_all()
print(qc.num_clbits)
  • A. 2
  • B. 0
  • C. 4
  • D. It raises an error because the circuit already has classical bits

Q12. You built a 2-qubit Bell-preparation circuit bell and want a version of it controlled on one extra qubit, appended to a 3-qubit circuit qc with qubit 0 as the control. Which snippet is correct?

  • A. qc.append(bell.control(1), [1, 2])
  • B. qc.cx(bell, [0, 1, 2])
  • C. qc.append(bell.to_gate(), [0, 1, 2])
  • D.
    cbell = bell.to_gate().control(1)
    qc.append(cbell, [0, 1, 2])

Section 2 — Perform Quantum Operations (Q13–Q23)

Q13. What state results from this code?

from qiskit.quantum_info import Pauli, Statevector
 
sv = Statevector.from_label('00').evolve(Pauli('XZ'))
  • A. |01⟩ (qubit 0 flipped)
  • B. |10⟩ (qubit 1 flipped)
  • C. |11⟩ (both flipped)
  • D. |00⟩ (unchanged)

Q14. What does the following code print?

from qiskit.quantum_info import SparsePauliOp
 
op = SparsePauliOp.from_list([("XI", 1.0), ("XI", 2.0), ("ZZ", 1.0)])
print(op.simplify())
  • A. SparsePauliOp(['XI', 'ZZ'], coeffs=[3.+0.j, 1.+0.j])
  • B. SparsePauliOp(['XI', 'XI', 'ZZ'], coeffs=[1.+0.j, 2.+0.j, 1.+0.j])
  • C. SparsePauliOp(['XI', 'ZZ'], coeffs=[2.+0.j, 1.+0.j])
  • D. SparsePauliOp(['IX', 'ZZ'], coeffs=[3.+0.j, 1.+0.j])

Q15. After running

from qiskit.quantum_info import Statevector
 
sv = Statevector.from_label('01')

at which index of sv.data is the amplitude 1?

  • A. Index 2
  • B. Index 1
  • C. Index 0
  • D. Index 3

Q16. What single-qubit state does this circuit produce?

qc = QuantumCircuit(1)
qc.h(0)
qc.z(0)
  • A. (|0⟩ + |1⟩)/√2
  • B. |0⟩
  • C. (|0⟩ − |1⟩)/√2
  • D. −|1⟩

Q17. Which operator equals H·X·H?

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

Q18. What value does this code print (approximately)?

from qiskit.quantum_info import Statevector, state_fidelity
 
plus = Statevector.from_label('+')
zero = Statevector.from_label('0')
print(state_fidelity(plus, zero))
  • A. 0.0
  • B. 0.25
  • C. 0.5
  • D. 1.0

Q19. What does the following code print?

from qiskit import QuantumCircuit
from qiskit.quantum_info import Operator, Pauli
 
qc = QuantumCircuit(1)
qc.h(0)
qc.z(0)
qc.h(0)
print(Operator(qc).equiv(Operator(Pauli('X'))))
  • A. True
  • B. False
  • C. It raises an error — equiv only accepts Operator objects built from circuits
  • D. None

Q20. Which of the following two-qubit states is entangled?

  • A. |+⟩ ⊗ |0⟩
  • B. (|00⟩ + |01⟩)/√2
  • C. (|0⟩ + |1⟩)(|0⟩ − |1⟩)/2
  • D. (|00⟩ + |11⟩)/√2

Q21. What (approximate) value does this code print?

from qiskit.quantum_info import Statevector, Pauli
 
plus = Statevector.from_label('+')
print(plus.expectation_value(Pauli('Z')))
  • A. 1.0
  • B. 0.0
  • C. −1.0
  • D. 0.5

Q22. What does the following code print?

from qiskit.quantum_info import SparsePauliOp
 
x = SparsePauliOp('X')
z = SparsePauliOp('Z')
print(x.tensor(z))
  • A. SparsePauliOp(['XZ'], coeffs=[1.+0.j])
  • B. SparsePauliOp(['ZX'], coeffs=[1.+0.j])
  • C. SparsePauliOp(['IX'], coeffs=[1.+0.j])
  • D. It raises an error — tensor requires operators of equal dimension greater than 1

Q23. Which statement about rz(π) and the z gate is correct?

  • A. They are identical matrices, so crz(π) and cz are also identical
  • B. They differ by a relative phase, so measurement statistics in the computational basis differ
  • C. rz(π) = −iZ: they differ only by a global phase, so applied to a full state they give identical measurement statistics — but their controlled versions crz(π) and cz are not equivalent
  • D. rz(π) equals the identity because a 2π rotation returns to the start

Section 3 — Run Quantum Circuits (Q24–Q33)

Q24. Which snippet selects the least busy real (non-simulator) operational backend?

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

Q25. You submit a circuit containing h and cx gates — without transpiling it — to a SamplerV2 targeting a real IBM Quantum backend whose basis gates are rz, sx, x, ecr. What happens?

  • A. The job is rejected with an error: V2 primitives require ISA circuits that match the backend's target
  • B. The service transpiles the circuit automatically before execution
  • C. The job runs, but with reduced fidelity
  • D. The gates are silently approximated by the nearest basis gates

Q26. You are running a variational algorithm in which each optimizer iteration uses the results of the previous one, and you want to avoid re-queuing between iterations. Which execution mode is most appropriate?

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

Q27. You need to run 20 fully independent circuits with no classical feedback between them and want them scheduled in parallel as efficiently as possible. Which execution mode fits best?

  • A. Session mode
  • B. Batch mode
  • C. Job mode, one submission per circuit
  • D. Serverless mode

Q28. Consider:

from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2
 
service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)
sampler = SamplerV2(mode=backend)

In which execution mode will sampler.run(...) execute?

  • A. Job mode
  • B. Session mode
  • C. Batch mode
  • D. Local simulation mode

Q29. You want to test a Sampler workflow locally, with no IBM Quantum account and no noise model. Which is the standard v2.x approach?

  • A. from qiskit import execute; execute(qc, backend='qasm_simulator')
  • B. from qiskit import BasicAer; BasicAer.get_backend('statevector_simulator')
  • C. Aer.get_backend('qasm_simulator').run(qc) imported from qiskit
  • D. from qiskit.primitives import StatevectorSampler and call StatevectorSampler().run([qc])

Q30. Which statement about FakeManilaV2 is correct?

  • A. It requires an IBM Quantum account to instantiate
  • B. It is a 27-qubit fake backend importable from qiskit.providers
  • C. It is a 5-qubit fake backend from qiskit_ibm_runtime.fake_provider that runs locally with a noise model snapshotted from the real device
  • D. It executes circuits on real hardware but with simulated queuing

Q31. What is the effective shot count for the PUB in this call?

job = sampler.run([(qc, None, 4096)], shots=1024)
  • A. 1024 — the run argument always wins
  • B. 4096 — the per-PUB shots value overrides the run-level value
  • C. 5120 — the values are added
  • D. The call raises an error because shots are specified twice

Q32. Which snippet correctly saves IBM Quantum credentials to disk for later use?

  • A. QiskitRuntimeService.save_account(channel="ibm_quantum_platform", token="MY_TOKEN")
  • B. IBMQ.save_account("MY_TOKEN")
  • C. QiskitRuntimeService(token="MY_TOKEN").save()
  • D. service.enable_account("MY_TOKEN")

Q33. What does the following code print?

from qiskit import QuantumCircuit
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
 
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
 
backend = FakeManilaV2()
pm = generate_preset_pass_manager(optimization_level=1, backend=backend)
isa = pm.run(qc)
print(isa.count_ops())

(FakeManilaV2's basis gates include cx, rz, sx, x, id.)

  • A. OrderedDict({'h': 1, 'cx': 1})
  • B. OrderedDict({'rz': 2, 'sx': 1, 'ecr': 1})
  • C. OrderedDict({'u': 1, 'cx': 1})
  • D. OrderedDict({'rz': 2, 'sx': 1, 'cx': 1})

Section 4 — Use the Sampler Primitive (Q34–Q41)

Q34. A circuit with no measurement instructions is passed to SamplerV2.run(). What happens?

  • A. The Sampler measures all qubits automatically in the Z basis
  • B. The job succeeds and returns an empty distribution
  • C. An error is raised — Sampler PUBs require circuits with measurements (classical output)
  • D. The Sampler returns the exact statevector instead

Q35. A Bell circuit was built with qc.measure_all() and run with a SamplerV2. Which line correctly retrieves the counts from result = job.result()?

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

Q36. What does the following code print?

from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.primitives import StatevectorSampler
 
qr = QuantumRegister(2, 'q')
cr = ClassicalRegister(2, 'result')
qc = QuantumCircuit(qr, cr)
qc.x(0)
qc.measure(qr, cr)
 
job = StatevectorSampler().run([qc], shots=100)
print(job.result()[0].data.result.get_counts())
  • A. {'01': 100}
  • B. {'10': 100}
  • C. {'1': 100}
  • D. It raises an AttributeError — counts must be accessed via data.c

Q37. Continuing from Q36, ba = job.result()[0].data.result is a BitArray. What does print(ba.num_shots, ba.num_bits) output?

  • A. 2 100
  • B. 100 100
  • C. 100 2
  • D. 200

Q38. What does the following code print?

import numpy as np
from qiskit import QuantumCircuit
from qiskit.circuit import Parameter
from qiskit.primitives import StatevectorSampler
 
t = Parameter('t')
qc = QuantumCircuit(1, 1)
qc.ry(t, 0)
qc.measure(0, 0)
 
job = StatevectorSampler().run([(qc, [np.pi])], shots=100)
print(job.result()[0].data.c.get_counts())
  • A. {'0': 100}
  • B. Approximately {'0': 50, '1': 50}
  • C. It raises an error — parameters must be bound with assign_parameters before running
  • D. {'1': 100}

Q39. Which line sets the default number of shots for all subsequent runs of a runtime SamplerV2 instance?

  • A. sampler.options.default_shots = 2048
  • B. sampler.shots = 2048
  • C. sampler.options.execution.shots = 2048
  • D. sampler.set_shots(2048)

Q40. Which snippet enables dynamical decoupling with the XY4 sequence on a runtime SamplerV2?

  • A.
    sampler.options.resilience.dynamical_decoupling = "XY4"
  • B.
    sampler.options.dynamical_decoupling.enable = True
    sampler.options.dynamical_decoupling.sequence_type = "XY4"
  • C.
    sampler.options.dd_sequence = "XY4"
  • D.
    sampler.options.twirling.enable_gates = True
    sampler.options.twirling.sequence_type = "XY4"

Q41. Which option is not available on the runtime SamplerV2?

  • A. options.default_shots
  • B. options.dynamical_decoupling
  • C. options.twirling
  • D. options.resilience_level

Section 5 — Use the Estimator Primitive (Q42–Q49)

Q42. Which statement about circuits submitted to EstimatorV2 is correct?

  • A. Circuits must end with measure_all() so expectation values can be computed
  • B. Circuits must not contain measurements — the observable in the PUB defines what is measured
  • C. Measurements are optional but improve precision
  • D. Only mid-circuit measurements are allowed

Q43. You transpiled circuit to isa_circuit for a real backend and have observable = SparsePauliOp("ZZ"). Which snippet submits a correct Estimator PUB?

  • A.
    job = estimator.run([(isa_circuit, observable)])
  • B.
    isa_obs = observable.apply_layout(backend)
    job = estimator.run([(isa_circuit, isa_obs)])
  • C.
    isa_obs = observable.apply_layout(isa_circuit.layout)
    job = estimator.run([(isa_circuit, isa_obs)])
  • D.
    isa_obs = pm.run(observable)
    job = estimator.run([(isa_circuit, isa_obs)])

Q44. What (approximate) value does this code print?

from qiskit import QuantumCircuit
from qiskit.quantum_info import SparsePauliOp
from qiskit.primitives import StatevectorEstimator
 
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
 
result = StatevectorEstimator().run([(qc, SparsePauliOp('ZZ'))]).result()
print(result[0].data.evs)
  • A. 1.0
  • B. 0.0
  • C. 0.5
  • D. −1.0

Q45. What (approximate) value does this code print?

import numpy as np
from qiskit import QuantumCircuit
from qiskit.circuit import Parameter
from qiskit.quantum_info import SparsePauliOp
from qiskit.primitives import StatevectorEstimator
 
t = Parameter('t')
qc = QuantumCircuit(1)
qc.ry(t, 0)
 
result = StatevectorEstimator().run([(qc, SparsePauliOp('Z'), [np.pi])]).result()
print(result[0].data.evs)
  • A. 1.0
  • B. −1.0
  • C. 0.0
  • D. π

Q46. With the runtime EstimatorV2, what does setting options.resilience_level = 2 add compared to the default level 1?

  • A. Dynamical decoupling
  • B. Probabilistic error cancellation (PEC)
  • C. Measurement (readout) error mitigation
  • D. Zero-noise extrapolation (ZNE) on top of the level-1 measurement error mitigation

Q47. Which snippet explicitly enables ZNE with custom noise factors and an exponential extrapolator?

  • A.
    estimator.options.resilience.zne_mitigation = True
    estimator.options.resilience.zne.noise_factors = (1, 3, 5)
    estimator.options.resilience.zne.extrapolator = "exponential"
  • B.
    estimator.options.zne.enable = True
    estimator.options.zne.factors = (1, 3, 5)
  • C.
    estimator.options.resilience_level = "zne"
    estimator.options.noise_factors = (1, 3, 5)
  • D.
    estimator.options.error_mitigation = "zne-exponential"

Q48. Which two of the following techniques are error suppression (applied before/during execution) rather than error mitigation (classical post-processing)? (Choose two.)

  • A. Dynamical decoupling
  • B. Zero-noise extrapolation (ZNE)
  • C. Pauli twirling
  • D. Probabilistic error cancellation (PEC)

Q49. What does the following code print?

from qiskit import QuantumCircuit
from qiskit.quantum_info import SparsePauliOp
from qiskit.primitives import StatevectorEstimator
 
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
 
obs = [SparsePauliOp('ZZ'), SparsePauliOp('ZI'), SparsePauliOp('XX')]
result = StatevectorEstimator().run([(qc, obs)]).result()
print(result[0].data.evs)
  • A. 1.0
  • B. [1. 1.]
  • C. [1. 0. 1.]
  • D. It raises an error — one PUB may contain only one observable

Section 6 — Visualize Circuits, Measurements, and States (Q50–Q57)

Q50. Which snippet produces the following draw('text') output?

     ┌───┐     ┌─┐
q_0: ┤ H ├──■──┤M├───
     └───┘┌─┴─┐└╥┘┌─┐
q_1: ─────┤ X ├─╫─┤M├
          └───┘ ║ └╥┘
c: 2/═══════════╩══╩═
                0  1
  • A.
    qc = QuantumCircuit(2, 2)
    qc.h(1); qc.cx(1, 0)
    qc.measure([0, 1], [0, 1])
  • B.
    qc = QuantumCircuit(2, 2)
    qc.h(0); qc.cx(0, 1)
    qc.measure([0, 1], [0, 1])
  • C.
    qc = QuantumCircuit(2, 2)
    qc.h(0); qc.cx(1, 0)
    qc.measure([0, 1], [0, 1])
  • D.
    qc = QuantumCircuit(2, 2)
    qc.h(0); qc.cx(0, 1)
    qc.measure([0, 1], [1, 0])

Q51. What does passing reverse_bits=True to circuit.draw() do?

  • A. Reverses the gate order left-to-right
  • B. Renumbers the qubits inside the circuit object permanently
  • C. Flips control and target of every CX gate
  • D. Displays the wires with the highest-index qubit on top, without modifying the circuit

Q52. A Bell circuit (h(0), cx(0,1), measured) is run on an ideal simulator with 4000 shots and the counts are passed to plot_histogram. What does the histogram show?

  • A. Two bars, at 00 and 11, each near probability 0.5
  • B. Four equal bars at 00, 01, 10, 11
  • C. Two bars, at 01 and 10, each near probability 0.5
  • D. One bar at 00 with probability 1

Q53. You call plot_bloch_multivector on the statevector of a Bell state. What do the two Bloch spheres show?

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

Q54. On a Q-sphere plot (plot_state_qsphere), how are amplitude and phase of each basis state encoded?

  • A. Blob size encodes phase; blob color encodes amplitude
  • B. Blob size encodes the amplitude/probability; blob color encodes the phase
  • C. Color encodes the qubit index; size encodes probability
  • D. Latitude encodes phase; longitude encodes amplitude

Q55. The single-qubit state (|0⟩ − i|1⟩)/√2 sits on which axis of the Bloch sphere?

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

Q56. What does plot_histogram(counts, number_to_keep=2) do when counts has five distinct bitstrings?

  • A. Shows the 2 most frequent outcomes as their own bars and aggregates the remaining outcomes into a single "rest" bar
  • B. Shows only the first 2 bitstrings in alphabetical order and drops the rest
  • C. Raises an error because counts has more than 2 keys
  • D. Rescales the histogram to only 2 shots

Q57. What does the following code print?

from qiskit.quantum_info import Statevector
 
sv = Statevector.from_label('+')
print(sv.draw('latex_source'))
  • A. |+\rangle
  • B. \frac{\sqrt{2}}{2} |0\rangle+\frac{\sqrt{2}}{2} |1\rangle
  • C. \frac{1}{2} |0\rangle+\frac{1}{2} |1\rangle
  • D. \frac{\sqrt{2}}{2} |0\rangle-\frac{\sqrt{2}}{2} |1\rangle

Section 7 — Retrieve and Analyze Results (Q58–Q64)

Q58. Yesterday you submitted a runtime job and saved its ID as "abc123". Which snippet retrieves its result today, in a new Python session?

  • A. result = SamplerV2.retrieve("abc123").result()
  • B. result = service.jobs("abc123").result()
  • C.
    service = QiskitRuntimeService()
    job = service.job("abc123")
    result = job.result()
  • D. result = QiskitRuntimeService.load_job("abc123")

Q59. Which statement about the asynchronous execution model of runtime primitives is correct?

  • A. primitive.run(...) returns a job object immediately; job.result() blocks until the job completes
  • B. primitive.run(...) blocks until the result is ready
  • C. You must poll job.status() until DONE before calling job.result(), otherwise it raises an error
  • D. Results can only be retrieved while the session that created the job is still open

Q60. What does the following code print?

from qiskit import QuantumCircuit
from qiskit.primitives import StatevectorSampler
 
qc1 = QuantumCircuit(1, 1)
qc1.measure(0, 0)
 
qc2 = QuantumCircuit(1, 1)
qc2.x(0)
qc2.measure(0, 0)
 
result = StatevectorSampler().run([qc1, qc2], shots=10).result()
print(len(result), result[1].data.c.get_counts())
  • A. 1 {'1': 10}
  • B. 2 {'1': 10}
  • C. 2 {'0': 10}
  • D. 2 {'01': 10}

Q61. A single-qubit circuit run with 1000 shots returns {'0': 600, '1': 400}. What is the expectation value ⟨Z⟩ computed from these counts?

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

Q62. What does the following code print?

counts = {'00': 512, '11': 488}
shots = sum(counts.values())
probs = {k: v / shots for k, v in counts.items()}
print(probs)
  • A. {'00': 0.512, '11': 0.488}
  • B. {'00': 0.5, '11': 0.5}
  • C. {'00': 512.0, '11': 488.0}
  • D. {'00': 0.256, '11': 0.244}

Q63. After running a Sampler job, where do you find execution details such as the number of shots actually used for the first PUB?

  • A. result.shots
  • B. result[0].data.shots
  • C. job.metrics()['shots'] only
  • D. result[0].metadata (per-PUB metadata on the PubResult)

Q64. The standard error of an Estimator expectation value scales as 1/√shots. To reduce the standard error by a factor of 10, you must multiply the number of shots by:

  • A. 10
  • B. 100
  • C. √10
  • D. 1000

Section 8 — Operate with OpenQASM (Q65–Q68)

Q65. What does qiskit.qasm3.dumps(qc) output for the circuit below?

qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
  • A.
    OPENQASM 3.0;
    include "qelib1.inc";
    qreg q[2];
    creg c[2];
    h q[0];
    cx q[0],q[1];
    measure q -> c;
    
  • B.
    OPENQASM 3.0;
    include "stdgates.inc";
    bit[2] c;
    qubit[2] q;
    h q[0];
    cx q[0], q[1];
    measure q[0] -> c[0];
    measure q[1] -> c[1];
    
  • C.
    OPENQASM 3.0;
    include "stdgates.inc";
    bit[2] c;
    qubit[2] q;
    h q[0];
    cx q[0], q[1];
    c[0] = measure q[0];
    c[1] = measure q[1];
    
  • D.
    OPENQASM 2.0;
    include "stdgates.inc";
    qubit[2] q;
    bit[2] c;
    h q[0];
    cx q[0], q[1];
    c = measure q;
    

Q66. The following OpenQASM 2 program is loaded with qiskit.qasm2.loads() and run on an ideal simulator with many shots. Which outcomes appear?

OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
x q[0];
h q[1];
cx q[1],q[0];
measure q -> c;
  • A. '00' and '11', each ≈50%
  • B. '01' and '10', each ≈50%
  • C. '10' only
  • D. '01' only

Q67. Which two features exist in OpenQASM 3 but not in OpenQASM 2? (Choose two.)

  • A. Input parameters declared in the program (e.g., input float theta;)
  • B. Quantum register declarations
  • C. Including a standard gate library
  • D. Typed classical data such as int[32] and float[64] with general classical control flow (e.g., while loops)

Q68. You have an OpenQASM 3 program stored in a Python string program. Which call converts it to a QuantumCircuit?

  • A. qiskit.qasm3.loads(program)
  • B. qiskit.qasm3.load(program)
  • C. QuantumCircuit.from_qasm3_str(program)
  • D. qiskit.qasm3.parse(program)

End of Paper 09. Check your answers against paper-09-FULL-answers.md.