Try Your Hand

Solutions to these exercises are given in Quantum Logic Gates Solutions.

For any code listing in the exercises, assume the following header lines:

 OPENQASM 2.0;
 include ​"qelib1.inc"​;

If you want to run any exercise, you must include them in the code you’d like to execute.

  1. Write the code for the following circuit:

    images/quantum_logic_gates/Measuring_Two_Qubits_on_a_Real_Computer.png
    1. Write the binary states recorded by the Measure gates. Write your answer as a concatenated string of the elements in the classical register.

    2. Run your code on a simulator.

    3. Run your code on a real quantum computer. Did you get the output you expected?

  2. Consider the quantum circuit shown here:

    1. Write a quantum ...

Get Quantum Computing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.