Skip to content
Kartikey Purohit
← Course overview

Day 8 — Official Sample Gaps

Question Bank

24 questions. Closed book, ~35 minutes. Grade with solution-bank.md. Q1–Q8: §7 results and jobs. Q9–Q24: mixed review across all sections, trap-heavy.


Part 1 — Results and Jobs (§7)

Q1. In qiskit-ibm-runtime 0.48, job.status() on a RuntimeJobV2 returns "RUNNING". Which of the following is a possible final state for this job?

  • A. "COMPLETED"
  • B. "CANCELLED"
  • C. "FINISHED"
  • D. "CLOSED"

Q2. You submitted a job yesterday and only saved its ID string. In a fresh Python session, how do you get its results?

  • A. job = QiskitRuntimeService().job(job_id); result = job.result()
  • B. result = SamplerV2.retrieve(job_id).result()
  • C. job = QiskitRuntimeService().jobs(job_id); result = job.result()
  • D. You cannot — results are only available in the session that submitted the job.

Q3. Which method returns the amount of QPU time a runtime job consumed?

  • A. job.metrics()['timestamps']
  • B. job.usage()
  • C. job.qpu_time()
  • D. job.result().metadata['usage']

Q4. A circuit built with qc.measure_all() is run through SamplerV2 as the only PUB. Which expression yields the counts dictionary?

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

Q5. ba = result[0].data.meas is a BitArray from a 2-qubit circuit run with 1000 shots. Which statement is TRUE?

  • A. ba.num_bits == 1000 and ba.num_shots == 2
  • B. ba.get_bitstrings() returns a list with one entry per shot
  • C. ba.get_counts() returns probabilities that sum to 1.0
  • D. len(ba) == 1000

Q6. A single-qubit circuit measured over 4096 shots gives {'0': 3072, '1': 1024}. What is the manually computed ⟨Z⟩?

  • A. 0.75
  • B. 0.5
  • C. 0.25
  • D. −0.5

Q7. An Estimator run at precision 0.02 is too noisy; you want standard error around 0.005. Approximately how many times more shots does this take?

  • A. 2×
  • B. 4×
  • C. 8×
  • D. 16×

Q8. A circuit has two classical registers, a (2 bits) and b (1 bit), both measured. What does result[0].join_data() return for a SamplerV2 result?

  • A. A dict mapping register names to counts
  • B. A single BitArray with num_bits == 3 combining both registers
  • C. A list of two BitArrays
  • D. An error — join_data() requires registers of equal width

Part 2 — Mixed Trap Review (all sections)

Q9. For Pauli('XZ'), which qubit does the Z act on?

  • A. Qubit 0 — Pauli strings are little-endian; the rightmost character is qubit 0
  • B. Qubit 1 — Pauli strings are read left to right starting at qubit 0
  • C. Both qubits — XZ is a two-qubit gate applied jointly
  • D. It depends on the number of qubits in the circuit it is applied to

Q10. qc = QuantumCircuit(2); qc.x(0); qc.measure_all() is sampled. Which counts key dominates?

  • A. '10'
  • B. '01'
  • C. '11'
  • D. '00'

Q11. qc = QuantumCircuit(2, 2) with explicit qc.measure([0,1],[0,1]) is run through SamplerV2. Which attribute holds the measurement data?

  • A. result[0].data.meas
  • B. result[0].data.c
  • C. result[0].data.creg0
  • D. result[0].data.bits

Q12. After isa = pm.run(qc) for a 5-qubit backend (original circuit: 2 qubits, observable SparsePauliOp('ZZ')), what must you do before estimator.run([(isa, obs)])?

  • A. Nothing — the Estimator expands observables automatically
  • B. obs = obs.apply_layout(isa.layout) so the observable matches the transpiled qubit layout
  • C. obs = obs.tensor(Pauli('III')) to pad it to 5 qubits
  • D. isa = isa.apply_layout(obs) to shrink the circuit back to 2 qubits

Q13. Which pairing is correct for V2 primitives?

  • A. Sampler: circuits must contain measurements; Estimator: circuits must not contain measurements
  • B. Sampler: circuits must not contain measurements; Estimator: circuits must contain measurements
  • C. Both require measurements
  • D. Neither requires nor forbids measurements

Q14. Running SamplerV2(mode=backend).run([qc]) with an untranspiled qc containing an h gate raises an error mentioning unsupported instructions. Why?

  • A. Sampler only accepts QASM strings
  • B. h is not a valid Qiskit gate in v2.x
  • C. V2 primitives on hardware require ISA circuits — transpiled to the backend's basis gates and connectivity
  • D. The circuit is missing a classical register

Q15. You are running a variational algorithm where each iteration's circuits depend on the previous iteration's results. Which execution mode fits best?

  • A. Batch — parallel scheduling of independent jobs
  • B. Job mode — one standalone request per iteration
  • C. Session — dedicated access window for iterative, dependent workloads
  • D. Local mode — hardware iteration is not supported

Q16. Which statement about Estimator resilience levels is correct?

  • A. Level 0 applies TREX; level 1 adds ZNE; level 2 adds PEC
  • B. Level 0 = no mitigation; level 1 (default) = measurement error mitigation (TREX); level 2 adds ZNE
  • C. Level 1 = no mitigation; level 2 = TREX; level 3 = ZNE
  • D. Resilience levels apply to both Sampler and Estimator

Q17. Which is the correct dynamic-circuit syntax to apply an X gate on qubit 1 when classical bit 0 equals 1?

  • A. qc.x(1).c_if(0, 1)
  • B. with qc.if_test((qc.clbits[0], 1)): qc.x(1)
  • C. qc.if_test(qc.x(1), clbit=0, value=1)
  • D. if qc.clbits[0] == 1: qc.x(1)

Q18. theta = Parameter("theta"); alpha = Parameter("alpha") are used in a circuit; you call qc.assign_parameters([0.5, 1.5]). Which binding occurs?

  • A. theta = 0.5, alpha = 1.5 — insertion order into the circuit
  • B. alpha = 0.5, theta = 1.5circuit.parameters is sorted alphabetically by name
  • C. An error — lists are not accepted, only dicts
  • D. Random assignment; you must always use a dict

Q19. Which call writes an OpenQASM 3 string for circuit qc?

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

Q20. sampler.options.resilience_level = 1 raises a validation error. Why?

  • A. Resilience must be set in the run() call, not on options
  • B. The value 1 is out of range for Sampler; only 0 is allowed
  • C. resilience_level is an Estimator-only option; Sampler has no error mitigation, only suppression (DD, twirling)
  • D. The option was renamed to sampler.options.resilience.level

Q21. Which list correctly classifies error handling techniques?

  • A. Suppression: dynamical decoupling, twirling · Mitigation: TREX, ZNE, PEC
  • B. Suppression: TREX, ZNE · Mitigation: dynamical decoupling, twirling
  • C. Suppression: ZNE, PEC · Mitigation: dynamical decoupling, TREX
  • D. All four are mitigation; Qiskit has no suppression techniques

Q22. Which option path enables dynamical decoupling with the XY4 sequence on a runtime primitive?

  • A. options.dd.enabled = True; options.dd.type = "XY4"
  • B. options.dynamical_decoupling.enable = True; options.dynamical_decoupling.sequence_type = "XY4"
  • C. options.suppression.dynamical_decoupling = "XY4"
  • D. options.resilience.dynamical_decoupling.sequence = "XY4"

Q23. qc = QuantumCircuit(2); qc.x(0) — what is Statevector(qc)?

  • A. [0, 1, 0, 0] — amplitude 1 at index 1 (binary 01, q0 = 1)
  • B. [0, 0, 1, 0] — amplitude 1 at index 2 (binary 10)
  • C. [1, 0, 0, 0] — X on q0 does not change |00⟩
  • D. [0, 0, 0, 1] — X flips both qubits

Q24. Which is a valid EstimatorV2 PUB for a parameterized ISA circuit qc with observable obs and values vals?

  • A. (qc, vals, obs)
  • B. (obs, qc, vals)
  • C. (qc, obs, vals)
  • D. (qc, vals) — the observable is set via estimator.options.observable