Quiz: Framework Comparison and Interoperability
Answers with explanations at the end.
1. Braket writes a Bell state in one line and Q# in six. Is Q# more verbose? Explain what each of Q#'s extra lines buys.
2. Five frameworks return five different result formats for the same physical outcome. Name the one
that uses integer keys and the one that returns tuples of a dedicated Result type.
3. Apply X to qubit 0 of a two-qubit register. Give the state-vector index in Qiskit, Cirq, and
Braket, and name the outlier.
4. Is little-endian ordering a fact about quantum computing or about Qiskit? What does each convention make convenient?
5. Which of the five frameworks can read and write OpenQASM?
6. Name the two asymmetries in OpenQASM support across the frameworks.
7. A Qiskit circuit is exported to OpenQASM 2 and imported into Cirq. The state vectors do not match. Is this a bug in the exporter, the importer, or neither?
8. State precisely what OpenQASM transfers and what it does not.
9. Complete: "A standard interchange format does not remove the boundary — it ______."
10. A QASM round trip turns global_phase = 1.047198 into 0.000000. Why does this matter, given
that global phase is unobservable?
11. A team verified their translation pipeline with gate counts, Operator.equiv(), Bell-state
histograms, and an endianness test. All passed, and the pipeline dropped global phase. Explain why
each of the four tests was blind to it.
12. Why is Operator.equiv() the wrong comparison for a circuit you intend to control, and what
should you use instead?
13. theta[0] becomes _theta_0_ after a QASM 3 round trip. What is the recommended fix, and what
detail is easy to miss?
14. List the three responsibilities of a correct cross-framework pipeline.
15. Why must a translation be verified with an asymmetric state, and name two circuit families that cannot do the job.
16. Name the three genuine capability gaps between frameworks. What is everything else?
17. "PennyLane or Qiskit" is often a false choice. Explain why, and give the mechanism.
18. Roughly what fraction of Parts I–II is framework-independent? Give four examples of what transfers and two of what does not.
19. Rank these by measured impact on your results: framework choice, which qubits you use, the mitigation stack, the modality for your circuit shape. Cite a number for each.
20. Chapter 11 measured phase damping invisible in the computational basis using Aer; Chapter 14 found the same in Cirq and Chapter 17 in Braket. Is this three pieces of evidence or one? Explain.
Answers
1. No. Q#'s extra lines are: a declared return type (Result, Result); a scoped qubit
lifetime via use, which the runtime enforces; and an explicit ResetAll, which §15.5 showed is
checked — a qubit released in any state other than $|0\rangle$ is a runtime error with a call stack.
Each line buys a guarantee the shorter frameworks handle by convention.
2. Cirq uses integer keys ({0: 503, 3: 497}); Q# returns tuples of Result
({'(Zero, Zero)': 527, '(One, One)': 473}), where Result is a distinct type with values Zero and
One — not a bool or an int.
3. Qiskit: index 1 (little-endian). Cirq: index 2 and Braket: index 2 (both big-endian). Qiskit is the outlier — one of three.
4. About Qiskit. Little-endian makes $|q_1 q_0\rangle$ read like a binary number with $q_0$ as the least significant bit, convenient for arithmetic circuits (Chapter 22's QFT, Chapter 23's modular arithmetic). Big-endian makes the state-vector index read in the same order you listed the qubits, convenient for reasoning about circuit diagrams. Both are defensible; neither will change.
5. All five — Qiskit (QASM 2 and 3, natively), Cirq (QASM 2), Braket (QASM 3), PennyLane
(to_openqasm / from_qasm), and Q#/QDK (qdk.openqasm) — in both directions. That is the strongest
evidence OpenQASM is a real standard rather than one vendor's format.
6. Cirq's import is a second-class citizen — it lives in cirq.contrib, requires
pip install ply, and fails with ModuleNotFoundError until you install it. And Braket's native IR
is OpenQASM 3 — there is no translation step, which makes Braket an unusually good translation hub.
7. Neither. OpenQASM names qubits explicitly (x q[0]; is unambiguous), so the program
transferred correctly. Each framework then decides independently where qubit 0 sits in its own
state vector, and QASM has no opinion about that. Both tools behaved correctly.
8. Transfers: gate identity, qubit indices, gate parameters, and instruction ordering. Does not transfer: the state-vector indexing convention, the global phase, and the parameter names.
9. "…defines what is left at it."
10. Because a global phase is unobservable only on the state it is attached to. Controlling an
operation puts that state in superposition with another, and $e^{i\phi}$ becomes a relative phase
on the control qubit — which is observable. Chapter 6 §6.6 watched exactly this invert a measurement
outcome, {'1': 1757} becoming {'0': 1758}.
11. Gate counts: a global phase is not a gate. Operator.equiv(): it compares unitaries
up to global phase, deliberately — the test was designed to ignore precisely what was lost.
Bell-state histograms: global phase is unobservable in any direct measurement, by definition, at
any shot count. The endianness test: correct and about a different axis entirely. Three of the
four were blind by construction.
12. Because equiv() ignores global phase, which is unobservable standalone and observable once
controlled. Use exact equality — Operator(a) == Operator(b) — for any subroutine you will control.
Which comparison is right is a statement about how the circuit will be used, not a property of the
circuit.
13. Normalize both sides rather than trying to reproduce the mangling rule. The easy-to-miss
detail is the leading underscore: the escaped form is _theta_0_, not theta_0_. Chapter 6 §6.6
hit exactly this and guessed wrong on the first attempt.
14. (1) Serialize the circuit — OpenQASM does this correctly. (2) Convert results at exactly one boundary — one function, since bit reversal is its own inverse and scattered conversions cancel. (3) Verify with an asymmetric state.
15. Because a symmetric state's expected output is invariant under the bug — reversing the bits
of the histogram gives back the same histogram, so the test passes whether or not the convention is
right. Bell states (00/11) and GHZ states (000/111) are both palindromic; uniform
superpositions are also invariant.
16. Hardware access (IBM's open free tier, via Qiskit), resource estimation (Q#'s estimator, uniquely), and differentiability (PennyLane's parameter-shift through arbitrary devices). Everything else is ergonomics — real, worth having preferences about, and not worth a rewrite.
17. Because PennyLane's plugins execute QNodes on other frameworks' backends. With
pennylane-qiskit, a differentiable QNode runs on IBM hardware — so you get PennyLane's gradients
and Qiskit's hardware access simultaneously. Its best use is as a differentiation layer on top of
another framework rather than a replacement for one.
18. Roughly 90%. Transfers: the physics; the noise signatures (Chapter 11 §11.7's two-axis
table, reproduced identically in Aer, Cirq, and Braket); the diagnostic procedures (Chapter 12 §12.7);
the cost models (two-qubit gates dominate, depth is the enemy, T gates dominate fault-tolerant cost, a
gradient costs $2n+1$). Does not transfer: little-endian bit ordering, and the primitives architecture
(SamplerV2/EstimatorV2).
19. Which qubits you use — ~100× (Chapter 12: a 288× error spread within one chip; 0.9727 versus 0.2844 correct fraction on the same device). The mitigation stack — 79% error reduction, with a 4.5× difference between orderings (Chapter 13). The modality for your circuit shape — 3.18× two-qubit gate overhead (Chapter 17). Framework choice — last, amounting to ergonomics plus three capability gaps.
20. Essentially one. Phase damping destroys coherence between $|0\rangle$ and $|1\rangle$ without changing either population, and a computational-basis measurement reads only populations — so any correct simulator must reproduce it. The three measurements are a consistency check on the frameworks, not independent evidence about the physics. It is a fact about measurement, and that is why it transfers.