Self-Assessment Quiz: Qubit Manipulation in Code
Twenty questions on gates, states, and — above all — phase. Aim for 16 or more.
Question 1
A single-qubit state is described by: - A. one real probability - B. two complex amplitudes with $|\alpha|^2 + |\beta|^2 = 1$ - C. two real probabilities summing to 1 - D. a single complex number
Question 2
Applying a gate to a state is mathematically: - A. matrix–matrix multiplication - B. matrix–vector multiplication - C. a dot product returning a scalar - D. element-wise multiplication
Question 3
Which matrix is H? - A. $\begin{pmatrix}0&1\\1&0\end{pmatrix}$ - B. $\begin{pmatrix}1&0\\0&-1\end{pmatrix}$ - C. $\frac{1}{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}$ - D. $\begin{pmatrix}1&0\\0&i\end{pmatrix}$
Question 4
Applying Z to $|0\rangle$ produces: - A. $|1\rangle$ - B. $|0\rangle$, unchanged - C. $|+\rangle$ - D. $-|1\rangle$
Question 5
Why does Z leave $|0\rangle$ unchanged? - A. Z is the identity - B. $|0\rangle$ lies on Z's rotation axis, and a rotation cannot move a point on its own axis - C. Z only acts on superpositions - D. It is a special case in Qiskit's implementation
Question 6
$H|1\rangle$ equals: - A. $|0\rangle$ - B. $(|0\rangle + |1\rangle)/\sqrt2$ - C. $(|0\rangle - |1\rangle)/\sqrt2$ - D. $|1\rangle$
Question 7
$|+\rangle$ and $|-\rangle$ have measurement probabilities that are: - A. identical: 0.5 and 0.5 - B. 1.0 and 0.0 respectively - C. complex - D. different by a factor of $\sqrt2$
Question 8
Statevector(qc):
- A. samples the circuit 1,024 times
- B. simulates the circuit exactly, with no sampling
- C. runs on hardware
- D. returns only probabilities
Question 9
Statevector cannot be used on real hardware because:
- A. it is too slow
- B. no physical process reveals a quantum state; measurement collapses it
- C. IBM does not allow it
- D. hardware lacks the memory
Question 10
Statevector simulation requires memory proportional to: - A. $n$ - B. $n^2$ - C. $2^n$ - D. constant
Question 11
On the Bloch sphere, $|+\rangle$ sits at: - A. the north pole - B. the south pole - C. $(+1, 0, 0)$ on the $x$ axis - D. the center
Question 12
The Bloch sphere picture fails for: - A. superposition states - B. entangled multi-qubit states - C. the $|1\rangle$ state - D. states with complex amplitudes
Question 13
Running H H on $|0\rangle$ and measuring gives:
- A. 50/50 between 0 and 1
- B. 0 with certainty
- C. 1 with certainty
- D. a random result each run
Question 14
Running H Z H on $|0\rangle$ and measuring gives:
- A. 50/50
- B. 0 with certainty
- C. 1 with certainty
- D. it depends on the shot count
Question 15
That difference is possible because: - A. Z changes the measurement probabilities - B. Z changes a relative phase, and the second H converts phase into amplitude via interference - C. the simulator is buggy - D. Z is not really a gate
Question 16
$HZH$ equals which gate? - A. I - B. X - C. Y - D. H
Question 17
For $R_y(\theta)$ applied to $|0\rangle$, $P(0)$ equals: - A. $\cos(\theta)$ - B. $\cos^2(\theta)$ - C. $\cos^2(\theta/2)$ - D. $\theta/\pi$
Question 18
Global phase is: - A. observable in any measurement - B. unobservable — but becomes observable when the operation is controlled - C. always zero - D. the same thing as relative phase
Question 19
To compare two states that may differ by a global phase, use:
- A. ==
- B. .equiv()
- C. is
- D. numpy.array_equal
Question 20
On current superconducting hardware, rz is:
- A. the most expensive single-qubit gate
- B. virtual — zero duration, zero error
- C. not supported
- D. implemented as three sx pulses
Answers
| # | Answer | Why |
|---|---|---|
| 1 | B | Two complex amplitudes, normalized. §3.2 |
| 2 | B | A $2\times2$ matrix times a length-2 vector. §3.8 |
| 3 | C | Note the minus sign — it is what makes $H\lvert1\rangle$ differ from $H\lvert0\rangle$. §3.2 |
| 4 | B | Unchanged. §3.2 |
| 5 | B | Geometry, not a special case. §3.4 |
| 6 | C | The minus sign is the whole story. §3.2 |
| 7 | A | Identical — which is exactly why §3.5 is surprising. §3.2 |
| 8 | B | Exact, no shots, no noise. §3.3 |
| 9 | B | Measurement collapses the state. §3.3, and Ch. 1 §1.4 |
| 10 | C | The exponential wall again. §3.3 |
| 11 | C | $\lvert+\rangle$ and $\lvert-\rangle$ are the $x$ poles. §3.4 |
| 12 | B | Entangled qubits have no individual states. §3.4 pitfall |
| 13 | B | The $\lvert1\rangle$ amplitudes cancel. §3.5 |
| 14 | C | The $\lvert0\rangle$ amplitudes cancel instead. §3.5 |
| 15 | B | Interference. This is the chapter's central idea. §3.5 |
| 16 | B | Verified in three lines with Operator. §3.8 |
| 17 | C | The half angle. A persistent source of factor-of-two bugs. §3.6 |
| 18 | B | The exception is what makes phase kickback work. §3.7 |
| 19 | B | == fails on a global phase and the failure is confusing. §3.7 |
| 20 | B | Implemented as a phase-reference shift in the controller. §3.8 |
Topic Map
| Questions | Topic | Section | If you missed these |
|---|---|---|---|
| 1, 2, 3, 6 | Gates as matrices | §3.2, §3.8 | Do Exercise 3.2 from memory, then check with Operator |
| 4, 5, 11, 12 | The Bloch sphere | §3.4 | Run Exercise 3.9; the geometry makes the algebra unnecessary |
| 7, 13, 14, 15, 16 | Phase and interference | §3.5 | Reread §3.5 and run code/example-03-phase-interference.py. This is the chapter |
| 8, 9, 10 | Statevector |
§3.3 | You will use this tool in every remaining chapter |
| 17 | Rotations | §3.6 | The half-angle convention; Exercise 3.13 |
| 18, 19 | Global vs. relative phase | §3.7 | Do Exercise 3.14 — the controlled $-I$ result is worth seeing |
| 20 | Virtual $Z$ | §3.8 | Exercise 3.15; it shapes how you write circuits from Chapter 28 on |
Score 16+: go to Chapter 4.
Score 12–15: if you lost points on 13–16, that is the cluster to fix before continuing — Part IV
is entirely built on interference and nothing there will make sense without it. Run
code/example-03-phase-interference.py and work through the 📐 Math Aside in §3.5 with a pencil.
Score under 12: reread §3.2 through §3.5 and run every snippet. Skip §3.6 to §3.8 on this pass;
they are reference material you can return to. The single thing to understand before Chapter 4 is
why H Z H gives a different answer from H H.