Title: CertiQ — C1000-179 / 5 · Use the sampler primitive

Question: You have transpiled a circuit for your backend, producing the ISA circuit isa_qc, and created sampler = SamplerV2(mode=backend). Which call correctly submits the circuit for execution?
from qiskit_ibm_runtime import SamplerV2
# isa_qc: circuit already transpiled for `backend`
sampler = SamplerV2(mode=backend)
job = ...  # which call?
A.job = sampler.run([isa_qc])
B.job = sampler.run(isa_qc)
C.job = sampler.run([isa_qc], backend)
D.job = sampler.run([isa_qc], backend=backend)
Answer: Correct: A
SamplerV2.run() takes an iterable of PUBs (Primitive Unified Blocs). A bare ISA circuit is a valid PUB-like element, but it must be wrapped in a list: sampler.run([isa_qc]). The backend is not passed to run() — it was already bound via mode= when the primitive was constructed.
References
- quantum.cloud.ibm.com/docs/guides/get-started-with-primitives
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
Meta: s5-q001 · mcq · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A Bell circuit is measured and submitted with sampler.run([isa], shots=1000). What is the value of sum(result[0].data.meas.get_counts().values())?
from qiskit_ibm_runtime import SamplerV2
# isa: transpiled Bell circuit with measure_all()
sampler = SamplerV2(mode=backend)
result = sampler.run([isa], shots=1000).result()
counts = result[0].data.meas.get_counts()
print(sum(counts.values()))
A.1000 — the counts across all outcomes always add up to the number of shots
B.2 — a Bell state only produces the outcomes 00 and 11
C.500 — the shots are split evenly between the two measured qubits
D.1024 — the sampler always uses its 1024 default shots
Answer: Correct: A
get_counts() tallies every shot into its observed bitstring, so the counts sum to the total number of shots that were run. Here shots=1000 was passed explicitly, so the tallies sum to 1000 regardless of how many distinct bitstrings (2, 3, or 4) actually appear.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q010 · predict-output · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: After running a SamplerV2 job on a circuit that used measure_all(), you access bits = result[0].data.meas. Which statement about bits is correct?
result = sampler.run([isa], shots=256).result()
bits = result[0].data.meas
A.bits is a BitArray holding the per-shot measurement outcomes; call bits.get_counts() to summarize them into a dict
B.bits is already a dict that maps each bitstring to its count
C.bits is a NumPy array of measurement probabilities, one per basis state
D.bits is a Counts object, exactly like result.get_counts() returned in Qiskit V1
Answer: Correct: A
SamplerV2 stores each register's outcomes in a BitArray inside the DataBin (data.meas). A BitArray keeps the raw per-shot bitstrings; you turn it into a summary histogram with get_counts() (dict) or read shots directly with get_bitstrings(). It is not itself the counts dict.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q011 · mcq · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: You build sampler = SamplerV2(mode=backend) and never touch its options, then call sampler.run([isa]) with no shots argument. How many shots does the job run?
sampler = SamplerV2(mode=backend)
job = sampler.run([isa])   # no shots given, options untouched
num = job.result()[0].data.meas.num_shots
A.1024 — the default value used when neither shots nor default_shots is set
B.4096 — the SamplerV2 default
C.1 — one shot unless you ask for more
D.It raises an error, because shots is a required argument
Answer: Correct: A
When you pass neither a per-run shots value nor set options.default_shots, SamplerV2 falls back to its built-in default of 1024 shots. shots is optional precisely because this default exists.
References
- quantum.cloud.ibm.com/docs/guides/specify-runtime-options
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q012 · mcq · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: This code raises an error when it reaches sampler.run(...). What is the correct fix?
from qiskit import QuantumCircuit
from qiskit_ibm_runtime import SamplerV2
qc = QuantumCircuit(3)
qc.h(0); qc.cx(0, 1); qc.ccx(0, 1, 2)
qc.measure_all()
sampler = SamplerV2(mode=backend)   # backend is a real/fake device
job = sampler.run([qc])             # <-- raises here
A.Transpile the circuit to an ISA circuit for the backend first (e.g. with generate_preset_pass_manager), then run the ISA circuit
B.Wrap the circuit in one more list: sampler.run([[qc]])
C.Just pass a shots count: sampler.run([qc], shots=1024)
D.Construct the sampler with no mode: SamplerV2().run([qc])
Answer: Correct: A
Runtime primitives only accept ISA circuits — circuits whose gates and connectivity already match the backend's target. The raw circuit here uses gates (like the Toffoli) that are not in the backend basis, so run raises an input-validation error. Transpiling with a preset pass manager for the backend produces the ISA circuit that runs successfully.
References
- quantum.cloud.ibm.com/docs/guides/get-started-with-primitives
- quantum.cloud.ibm.com/docs/guides/transpile
Meta: s5-q013 · spot-bug · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: Hoping to turn on error mitigation for measurement counts, a developer writes sampler.options.resilience_level = 1 on a SamplerV2. What actually happens?
from qiskit_ibm_runtime import SamplerV2
sampler = SamplerV2(mode=backend)
sampler.options.resilience_level = 1
A.It raises an error — SamplerV2 has no resilience_level; that option belongs to EstimatorV2
B.It enables T-REx readout error mitigation on the sampled counts
C.It is accepted but silently ignored, because the sampler has no mitigation
D.It is an alias that turns on measurement twirling
Answer: Correct: A
resilience_level is an EstimatorV2 option — resilience levels drive expectation-value mitigation such as TREX/ZNE. SamplerV2 exposes no resilience_level; assigning it raises a validation error ('no such attribute'). The Sampler's error-handling options are dynamical_decoupling, twirling, and execution/simulator settings — it returns raw samples and leaves mitigation to you.
References
- quantum.cloud.ibm.com/docs/guides/runtime-options-overview
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q014 · mcq · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A 3-qubit circuit applies X to qubit 0 only, then measures qubit i into classical bit i. In the Sampler's counts, which bitstring dominates?
qc = QuantumCircuit(3, 3)
qc.x(0)                       # only qubit 0 is flipped
qc.measure(0, 0)
qc.measure(1, 1)
qc.measure(2, 2)
# ... transpile, then sampler.run([isa]) ...
counts = result[0].data.c.get_counts()
A.'001' — Qiskit prints bitstrings little-endian, so classical bit 0 (qubit 0) is the rightmost character
B.'100' — qubit 0 is the leftmost character in the bitstring
C.'111' — flipping any qubit flips the whole register
D.'000' — X on qubit 0 has no effect on the measured bits
Answer: Correct: A
Qiskit uses little-endian bit ordering: in the printed bitstring the classical bit with the highest index is on the left and bit 0 is on the right. Only qubit 0 is excited, and it is measured into classical bit 0, so the rightmost character is 1 and the rest are 0 -> '001'.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q015 · predict-output · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A circuit has 2 parameters. You bind a NumPy array of shape (6, 2) and run one PUB: sampler.run([(isa, vals)]). What is result[0].data.meas.shape?
import numpy as np
# isa has 2 free parameters
vals = np.linspace(0, 1, 12).reshape(6, 2)  # shape (6, 2)
result = sampler.run([(isa, vals)]).result()
print(result[0].data.meas.shape)
A.(6,) — the trailing axis is consumed as the 2 parameters, leaving 6 broadcast results
B.(6, 2) — the result keeps the full shape of the parameter array
C.(2,) — one result per parameter
D.() — a single scalar result, since it is one PUB
Answer: Correct: A
In a Sampler PUB the parameter array's last axis must have length = number of parameters; that axis is consumed to bind the circuit. The remaining leading shape becomes the result's broadcast shape. Shape (6, 2) with 2 parameters therefore yields 6 independent results -> data.meas.shape == (6,).
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q016 · mcq · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A 2-parameter circuit is bound with a parameter array of shape (3, 4, 2) in a single PUB. What is the shape of result[0].data.meas?
import numpy as np
# isa has 2 free parameters
vals = np.zeros((3, 4, 2))   # a 3x4 grid of 2-parameter sets
result = sampler.run([(isa, vals)]).result()
print(result[0].data.meas.shape)
A.(3, 4) — the last axis (size 2) binds the parameters; the leading (3, 4) is the broadcast grid
B.(3, 4, 2) — the result mirrors the full input array shape
C.(12,) — broadcast results are always flattened to 1-D
D.(2,) — one result per parameter
Answer: Correct: A
The trailing axis of a parameter array is reserved for the parameter values (here length 2 = the 2 parameters) and is consumed during binding. Everything before it is the broadcast shape, so a (3, 4, 2) array over a 2-parameter circuit produces a (3, 4) array of results, each indexable as data.meas[i, j].
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q017 · predict-output · Difficulty 3/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: The circuit isa has exactly 2 free parameters. This call raises a ValueError. What fixes it?
import numpy as np
# isa has 2 free parameters (p[0], p[1])
vals = np.zeros((5, 3))
job = sampler.run([(isa, vals)])   # ValueError: inconsistent with last dimension
A.Give the array shape (5, 2) — the last axis must equal the number of parameters (2), producing 5 results
B.Transpose it to shape (3, 5)
C.Flatten it to a 1-D array of length 15
D.The array is fine; the real fix is to also pass a shots value
Answer: Correct: A
For a parameter array, the trailing axis is matched against the circuit's free parameters, so its length must equal the number of parameters. The circuit has 2 parameters but the array's last axis is 3, hence the ValueError. Reshaping to (5, 2) makes the last axis 2 and binds 5 parameter sets, giving 5 results.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q018 · spot-bug · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: You want to switch on dynamical decoupling (an error-suppression technique that fills idle qubit time) for a SamplerV2 called sampler. Which line does this correctly?
from qiskit_ibm_runtime import SamplerV2
sampler = SamplerV2(mode=backend)
# enable dynamical decoupling:
A.sampler.options.dynamical_decoupling.enable = True
B.sampler.options.dynamical_decoupling = True
C.sampler.run([isa], dynamical_decoupling=True)
D.sampler.options.resilience.dynamical_decoupling = True
Answer: Correct: A
Dynamical decoupling is configured through the nested options object: options.dynamical_decoupling is an options group whose .enable flag turns the feature on. Setting options.dynamical_decoupling.enable = True is the supported form.
References
- quantum.cloud.ibm.com/docs/guides/configure-error-suppression
- quantum.cloud.ibm.com/docs/guides/specify-runtime-options
Meta: s5-q019 · mcq · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: Which of the following are settable options on a SamplerV2 primitive? (Select all that apply.)
A.sampler.options.default_shots
B.sampler.options.dynamical_decoupling.enable
C.sampler.options.twirling.enable_gates
D.sampler.options.resilience_level
E.sampler.options.optimization_level
Answer: Correct: A, B, C
SamplerV2 options cover sampling and error-handling: default_shots, the dynamical_decoupling group (error suppression), and the twirling group (Pauli/measurement twirling), plus execution and simulator settings. resilience_level is an EstimatorV2 option, and optimization_level is a transpiler setting (used when building the pass manager) — neither exists on the Sampler, so setting them raises a validation error.
References
- quantum.cloud.ibm.com/docs/guides/runtime-options-overview
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q020 · multi · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A research team wants complete control over readout-error correction: they need the untouched per-shot measurement outcomes so they can apply their own calibration matrix afterward. Which statement about SamplerV2 is correct?
A.SamplerV2 applies no readout-error mitigation to its output by default; it returns the raw per-shot bitstrings (a BitArray), so any custom mitigation can be done in post-processing
B.SamplerV2 always applies TREX readout mitigation, so obtaining raw outcomes is impossible without editing the runtime source
C.You must set resilience_level = 0 on the sampler to disable its built-in mitigation before raw counts are returned
D.Bypassing mitigation requires switching to EstimatorV2, which is the only primitive that exposes raw data
Answer: Correct: A
The Sampler primitive is deliberately low-level: it returns the sampled bitstrings as a BitArray with no post-processing correction of measurement error applied by default. That raw per-shot data is exactly what you need to implement your own mitigation (e.g. build and apply a readout-calibration/confusion matrix, or use a package like mthree). Error suppression (dynamical decoupling) and twirling can be opted into, but they do not alter the counts into 'mitigated' values.
References
- quantum.cloud.ibm.com/docs/guides/primitives
- quantum.cloud.ibm.com/docs/guides/error-mitigation-and-suppression-techniques
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
Meta: s5-q021 · mcq · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: You have a parameterized ISA circuit isa, a NumPy array vals of parameter values, and want 256 shots. Which call passes a correctly-structured SamplerV2 PUB?
# isa: parameterized ISA circuit ; vals: array of parameter values
sampler = SamplerV2(mode=backend)
job = sampler.run( ??? )
A.sampler.run([(isa, vals, 256)])
B.sampler.run([(isa, 256, vals)])
C.sampler.run([(isa, observable, vals, 0.02)])
D.sampler.run((isa, vals))
Answer: Correct: A
A SamplerV2 PUB is a tuple (circuit, parameter_values, shots) where the last two are optional, and the run() argument is a *list* of such PUBs. (isa, vals, 256) places parameter values in slot 2 and shots in slot 3, wrapped in a list — the correct form.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q022 · mcq · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A 1-parameter circuit is broadcast over 4 parameter values at 500 shots each. What does sum(result[0].data.meas.get_counts().values()) return when get_counts() is called with no index?
import numpy as np
vals = np.array([[0.0], [np.pi/3], [np.pi/2], [np.pi]])   # 4 parameter sets
ba = sampler.run([(isa, vals)], shots=500).result()[0].data.meas
print(sum(ba.get_counts().values()))
A.2000 — with no index, get_counts() aggregates the shots from all 4 parameter sets (4 x 500)
B.500 — it returns the counts for just the first parameter set
C.4 — one entry per parameter set
D.125 — the 500 shots are divided among the 4 parameter sets
Answer: Correct: A
On a broadcast (non-scalar) BitArray, get_counts() with no index flattens across every broadcast entry and tallies all of their shots together: 4 parameter sets x 500 shots = 2000. To get the histogram for a single parameter set you must index, e.g. get_counts(0).
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q023 · predict-output · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A circuit measures into two named classical registers, alice and bob. After running the Sampler, how do you read the counts for the alice register?
qr = QuantumRegister(2, 'q')
alice = ClassicalRegister(1, 'alice')
bob   = ClassicalRegister(1, 'bob')
qc = QuantumCircuit(qr, alice, bob)
# ... measure into alice and bob, transpile, run ...
result = sampler.run([isa]).result()
A.result[0].data.alice.get_counts()
B.result[0].data.meas.get_counts()['alice']
C.result[0].get_counts('alice')
D.result.data.alice.get_counts()
Answer: Correct: A
Each classical register becomes its own field in the result's DataBin, named after the register. With registers alice and bob, the DataBin has .alice and .bob BitArrays, so result[0].data.alice.get_counts() returns that register's histogram.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q024 · mcq · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: This code raises AttributeError: 'DataBin' object has no attribute 'meas' on the last line. What is the correct fix?
qc = QuantumCircuit(2, 2)
qc.h(0); qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
# ... transpile to isa, run ...
result = sampler.run([isa]).result()
counts = result[0].data.meas.get_counts()   # AttributeError
A.The register created by QuantumCircuit(2, 2) is named c, so use result[0].data.c.get_counts()
B.Replace the explicit measurement with qc.measure_all() — data.meas only works alongside measure(...)
C.BitArray has no get_counts(); iterate get_bitstrings() and tally them yourself
D.You must pass shots= to run() so the meas field gets created
Answer: Correct: A
The DataBin field name comes from the classical register's name. QuantumCircuit(2, 2) creates a default register named c, so the outcomes are in data.c, not data.meas. The name meas only exists if the circuit used measure_all(), which auto-creates a register called meas.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q025 · spot-bug · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: You set sampler.options.default_shots = 1000, then submit a single PUB that carries its own shot count: sampler.run([(isa, None, 50)]). How many shots does that PUB run?
sampler = SamplerV2(mode=backend)
sampler.options.default_shots = 1000
job = sampler.run([(isa, None, 50)])   # PUB = (circuit, params, shots)
num = job.result()[0].data.meas.num_shots
A.50 — a shot count given in the PUB overrides the default_shots option
B.1000 — the default_shots option always wins over a PUB value
C.1050 — the PUB shots are added to the default
D.500 — the two settings are averaged
Answer: Correct: A
Shots resolve most-specific-first: a value inside the PUB (slot 3) takes precedence over options.default_shots, which itself takes precedence over the built-in 1024 fallback. Here the PUB specifies 50, so exactly 50 shots run despite default_shots = 1000.
References
- quantum.cloud.ibm.com/docs/guides/specify-runtime-options
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
Meta: s5-q026 · mcq · Difficulty 3/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: Which of the following are real fields of the SamplerV2 twirling options group? (Select all that apply.)
A.twirling.enable_gates
B.twirling.enable_measure
C.twirling.num_randomizations
D.twirling.twirling_level
E.twirling.readout
Answer: Correct: A, B, C
The twirling options group controls Pauli twirling of gates and measurements: enable_gates and enable_measure toggle each kind, num_randomizations sets how many random twirls to average over, and shots_per_randomization/strategy complete the group. twirling_level and readout are not fields of this group, so assigning them raises a validation error.
References
- quantum.cloud.ibm.com/docs/guides/runtime-options-overview
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q027 · multi · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A Bell circuit should only ever yield 00 or 11, but readout error sprinkles in 01/10. A team wants to bypass runtime mitigation and apply their own scheme that keeps only the physically-consistent outcomes. Which approach implements this correctly?
# result from a Bell circuit; raw counts include 01/10 from readout error
counts = result[0].data.meas.get_counts()   # e.g. {'00':.., '11':.., '01':.., '10':..}
A.Filter the counts to keep only even-parity outcomes (00, 11) and renormalize — a post-selection scheme you implement yourself on the returned data
B.Set sampler.options.resilience_level = 2 so the runtime post-selects for you
C.Enable dynamical_decoupling, which removes the readout errors from the counts
D.Nothing can be done — you must accept the raw counts as the sampler returns them
Answer: Correct: A
Because the Sampler hands back raw per-shot outcomes, you are free to implement any custom mitigation in post-processing. Here the known symmetry (a Bell state has even parity) lets you post-select: drop the 01/10 shots and renormalize over 00/11. This is exactly the 'bypass runtime mitigation, roll your own' pattern.
References
- quantum.cloud.ibm.com/docs/guides/primitives
- quantum.cloud.ibm.com/docs/guides/error-mitigation-and-suppression-techniques
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
Meta: s5-q028 · mcq · Difficulty 3/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A 2-qubit circuit is run with shots=777. What is len(result[0].data.meas.get_bitstrings())?
ba = sampler.run([isa], shots=777).result()[0].data.meas
print(len(ba.get_bitstrings()))
A.777 — get_bitstrings() returns one entry per shot
B.2 — one entry per qubit
C.4 — one entry per possible 2-bit outcome
D.1 — a single concatenated string of all shots
Answer: Correct: A
get_bitstrings() returns the raw per-shot record: a list with exactly one bitstring for every shot, in order. With 777 shots you get a list of length 777. (get_counts() is the summarized view; get_bitstrings() is the un-aggregated one.)
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q029 · predict-output · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: In the primitives model, what does the Sampler primitive fundamentally return for a circuit that ends in measurements?
A.Samples drawn from the circuit's output probability distribution — per-shot measurement bitstrings that you can histogram into (quasi-)probabilities
B.The exact complex amplitudes of the circuit's output statevector
C.Expectation values of a set of observables
D.The single most-likely measurement outcome of the circuit
Answer: Correct: A
'Sampling' means repeatedly executing the circuit and recording the measured bitstring each shot — draws from the distribution the circuit defines over computational-basis states. The Sampler returns those per-shot samples (as a BitArray); estimating probabilities is then just counting frequencies. It never returns amplitudes or expectation values.
References
- quantum.cloud.ibm.com/docs/guides/primitives
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
Meta: s5-q030 · mcq · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: To make a SamplerV2 run on a fake/simulated backend reproducible — identical counts every time — which assignment sets the random seed correctly?
sampler = SamplerV2(mode=fake_backend)
# make results reproducible:
A.sampler.options.simulator.seed_simulator = 42
B.sampler.options.seed = 42
C.sampler.run([isa], seed=42)
D.sampler.options.execution.seed_simulator = 42
Answer: Correct: A
The simulator seed lives in the simulator options group: options.simulator.seed_simulator. Fixing it makes the (fake) backend's internal simulator deterministic, so repeated runs return identical counts. Without it, each run draws fresh randomness.
References
- quantum.cloud.ibm.com/docs/guides/specify-runtime-options
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q031 · mcq · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: This code excites qubit 0 and tries to read qubit 0's value out of each shot's bitstring, but every q0 comes out '0'. What is the fix?
qc = QuantumCircuit(2)
qc.x(0)              # qubit 0 -> |1>
qc.measure_all()
# ... transpile, run ...
bitstrings = result[0].data.meas.get_bitstrings()
q0 = [b[0] for b in bitstrings]   # expected '1', gets '0'
A.Qiskit bitstrings are little-endian, so qubit 0 is the *last* character; read b[-1] instead of b[0]
B.Replace measure_all() with explicit measure(0, 0); measure(1, 1), then b[0] reads qubit 0
C.Increase the shot count so the correct value stabilizes at b[0]
D.Read qubit 0 from get_counts() instead, whose keys index qubit 0 at position 0
Answer: Correct: A
Qiskit prints bitstrings little-endian: the character at index 0 is the *highest*-indexed bit, and qubit 0 sits at the far right (index -1). Since only qubit 0 was excited, b[-1] is '1' while b[0] (qubit 1) is '0'. The fix is to index from the right.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q032 · spot-bug · Difficulty 3/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: You want every job from a sampler to use 4096 shots by default, without passing shots on each run(). Which construction sets this up correctly?
from qiskit_ibm_runtime import SamplerV2
# want default_shots = 4096 for all runs
A.SamplerV2(mode=backend, options={"default_shots": 4096})
B.SamplerV2(mode=backend, shots=4096)
C.SamplerV2(mode=backend, default_shots=4096)
D.s = SamplerV2(mode=backend); s.shots = 4096
Answer: Correct: A
The primitive constructor takes an options mapping (or a SamplerOptions object); default_shots is a key inside it. SamplerV2(mode=backend, options={"default_shots": 4096}) makes every subsequent no-shots run use 4096. A per-run shots= argument would still override it.
References
- quantum.cloud.ibm.com/docs/guides/specify-runtime-options
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q033 · mcq · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: Which statements about error handling in SamplerV2 are correct? (Select all that apply.)
A.By default SamplerV2 applies no measurement-error mitigation; the returned counts are raw samples
B.Dynamical decoupling is an error-*suppression* technique you can turn on via options.dynamical_decoupling.enable
C.Setting options.resilience_level selects the sampler's built-in mitigation strategy
D.Twirling reduces the number of qubits that get measured
E.Because the sampler post-processes the data internally, you cannot add your own mitigation
Answer: Correct: A, B
SamplerV2 returns raw samples with no automatic readout mitigation (A), and its error-handling knobs are error *suppression* (dynamical decoupling) and twirling — DD is enabled through options.dynamical_decoupling.enable (B). Everything downstream (readout calibration, post-selection) is left to you.
References
- quantum.cloud.ibm.com/docs/guides/error-mitigation-and-suppression-techniques
- quantum.cloud.ibm.com/docs/guides/configure-error-suppression
- quantum.cloud.ibm.com/docs/guides/primitives
Meta: s5-q034 · multi · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: You broadcast a 1-parameter circuit over 6 parameter values in one PUB and pass shots=200. How many total circuit executions does the sampler perform?
import numpy as np
vals = np.linspace(0, np.pi, 6).reshape(6, 1)   # 6 parameter sets
job = sampler.run([(isa, vals)], shots=200)
A.1200 — every parameter set gets its own 200 shots (6 x 200)
B.200 — the 200 shots are shared across the whole sweep
C.6 — one execution per parameter value
D.34 — 200 shots divided among the 6 parameter sets
Answer: Correct: A
shots is per parameter set, not per PUB total. Broadcasting over 6 parameter values means the circuit is sampled 200 times at each of the 6 bindings, for 6 x 200 = 1200 executions. Each set's counts independently sum to 200.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/guides/specify-runtime-options
Meta: s5-q035 · mcq · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: A 2-qubit circuit applies X to both qubits and measures all. What is the dominant key of result[0].data.meas.get_int_counts()?
qc = QuantumCircuit(2)
qc.x(0); qc.x(1)
qc.measure_all()
# ... run ...
ba = result[0].data.meas
print(ba.get_int_counts())   # dominant key?
A.3 — get_int_counts() keys are integers; the bitstring 11 is binary 3
B.'11' — same string keys as get_counts()
C.11 — the digits 11 read as the decimal number eleven
D.2 — two qubits are set to 1
Answer: Correct: A
get_int_counts() returns the same histogram as get_counts() but with each bitstring decoded as an integer. Both qubits are 1, so the outcome bitstring is 11, which as a binary number is 3. The keys are true integers (3), not the string '11'.
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q036 · predict-output · Difficulty 2/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: Having chosen not to rely on any runtime mitigation, a team wants to rigorously correct measurement (readout) error in their SamplerV2 counts — not merely post-select. Which do-it-yourself technique fits the raw per-shot data the Sampler provides?
A.Characterize readout with calibration circuits to build an assignment (confusion) matrix, then apply its inverse to the measured counts (e.g. a matrix-based method such as M3)
B.Raise sampler.options.resilience_level until the readout error disappears
C.Apply Zero-Noise Extrapolation directly to the bitstrings
D.Turn on gate twirling, which mathematically inverts the readout confusion matrix
Answer: Correct: A
Readout error is a classical relabeling of measured bits, captured by an assignment/confusion matrix measured from calibration circuits (prepare each basis state, see what you read). Inverting (or least-squares inverting) that matrix corrects the counts — the approach used by tools like mthree (M3). The Sampler's raw counts are exactly the input such a method needs.
References
- quantum.cloud.ibm.com/docs/guides/error-mitigation-and-suppression-techniques
- quantum.cloud.ibm.com/docs/guides/primitives
Meta: s5-q037 · mcq · Difficulty 3/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: You estimate an outcome probability from a SamplerV2 histogram and then increase the shot count from 1000 to 4000. Roughly how does the statistical (sampling) error on that estimated probability change?
A.It roughly halves — sampling (shot) error scales like 1/sqrt(N), so 4x the shots gives about 2x smaller error
B.It drops to a quarter, scaling like 1/N with the number of shots
C.It is essentially unchanged — statistical error depends on the hardware, not the shot count
D.It roughly doubles, because more shots accumulate more noise
Answer: Correct: A
Counting outcomes is a Monte-Carlo estimate of a probability. The standard error of a frequency is sqrt(p(1-p)/N), i.e. it shrinks like 1/sqrt(N). Quadrupling the shots (1000 -> 4000) multiplies the error by 1/sqrt(4) = 1/2. This is why halving the error costs 4x the shots — the same shots<->precision trade-off that underlies the primitives.
References
- quantum.cloud.ibm.com/docs/guides/primitives
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
Meta: s5-q038 · mcq · Difficulty 3/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.

Question: You submit three circuits in one call: result = sampler.run([isaA, isaB, isaC]).result(). What is len(result)?
result = sampler.run([isaA, isaB, isaC]).result()
print(len(result))
A.3 — one PUB result per submitted PUB, indexed result[0], result[1], result[2]
B.1 — all circuits are merged into a single result object
C.256 — one entry per shot
D.768 — total shots across the three circuits
Answer: Correct: A
run() takes a list of PUBs and returns a PrimitiveResult that is a sequence of PUB results, one per input PUB, in order. Three circuits in, three results out — you read each with result[i].data.<register>.get_counts().
References
- quantum.cloud.ibm.com/docs/guides/primitive-input-output
- quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime
Meta: s5-q039 · mcq · Difficulty 1/3
AI-generated, execution-verified — CertiQ. Unofficial: not affiliated with, endorsed by, or sponsored by IBM.