Computer Knowledge

Digital Logic and Microprocessors

735 Questions

Digital logic and microprocessors form the core of computer science, covering logic gates, combinational and sequential circuits, and CPU architecture. These topics are crucial for computer knowledge sections in technical exams. Test your digital electronics basics here.

Logic gates and circuitsCombinational vs sequential circuitsMicroprocessor instructionsTruth tables and boolean functions

Digital Logic and Microprocessors Questions

Multiple choice

What is the CNOT gate?

  1. A two-qubit gate that flips the target qubit if the control qubit is in the \(|1\rangle\) state.
  2. A two-qubit gate that flips the control qubit if the target qubit is in the \(|1\rangle\) state.
  3. A two-qubit gate that swaps the states of the two qubits.

  4. A two-qubit gate that measures the states of the two qubits.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The CNOT gate is a two-qubit gate that flips the target qubit if the control qubit is in the (|1\rangle) state. It is also known as the controlled-NOT gate.

Multiple choice

What is the Toffoli gate?

  1. A three-qubit gate that flips the target qubit if the two control qubits are both in the \(|1\rangle\) state.
  2. A three-qubit gate that flips the control qubits if the target qubit is in the \(|1\rangle\) state.
  3. A three-qubit gate that swaps the states of the three qubits.

  4. A three-qubit gate that measures the states of the three qubits.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The Toffoli gate is a three-qubit gate that flips the target qubit if the two control qubits are both in the (|1\rangle) state. It is also known as the controlled-controlled-NOT gate.

Multiple choice

What is the SWAP gate?

  1. A two-qubit gate that swaps the states of the two qubits.

  2. A two-qubit gate that measures the states of the two qubits.

  3. A two-qubit gate that flips the target qubit if the control qubit is in the \(|1\rangle\) state.
  4. A two-qubit gate that flips the control qubit if the target qubit is in the \(|1\rangle\) state.
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The SWAP gate is a two-qubit gate that swaps the states of the two qubits.

Multiple choice

What is the matrix representation of the SWAP gate?

  1. $$\[ \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \]$$
  2. $$\[ \begin{pmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix} \]$$
  3. $$\[ \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \]$$
  4. $$\[ \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \]$$
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The matrix representation of the SWAP gate is a 4x4 matrix with 1s on the diagonal and 0s everywhere else, except for the two off-diagonal elements that are 1.

Multiple choice

What is the circuit symbol for the SWAP gate?

  1. A square with two lines crossing in the middle.

  2. A circle with two lines crossing in the middle.

  3. A triangle with two lines crossing in the middle.

  4. A diamond with two lines crossing in the middle.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The circuit symbol for the SWAP gate is a square with two lines crossing in the middle.

Multiple choice

What is the inverse of the SWAP gate?

  1. The SWAP gate itself.

  2. The CNOT gate.

  3. The Hadamard gate.

  4. The Toffoli gate.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The SWAP gate is its own inverse.

Multiple choice

How many CNOT gates are required to implement a SWAP gate?

  1. 1

  2. 2

  3. 3

  4. 4

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Three CNOT gates are required to implement a SWAP gate.

Multiple choice

What is the time complexity of implementing a SWAP gate using CNOT gates?

  1. O(1)

  2. O(log n)

  3. O(n)

  4. O(n^2)

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The time complexity of implementing a SWAP gate using CNOT gates is O(1).

Multiple choice

What is the matrix representation of the Controlled-Z Gate?

  1. $$\[\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \]\)$$
  2. $$\[\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & 1 \]\)$$
  3. $$\[\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \]\)$$
  4. $$\[\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & 1 \]\)$$
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The matrix representation of the Controlled-Z Gate is a 4x4 unitary matrix that applies a phase shift of -1 to the target qubit when the control qubit is in the state |1⟩.

Multiple choice

What is the inverse of the Controlled-Z Gate?

  1. The Controlled-NOT Gate.

  2. The Hadamard Gate.

  3. The Phase Gate.

  4. The Toffoli Gate.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The inverse of the Controlled-Z Gate is the Controlled-NOT Gate, which flips the target qubit's state when the control qubit is in the state |1⟩.

Multiple choice

What is the time complexity of the Controlled-Z Gate?

  1. O(1).

  2. O(log n).

  3. O(n).

  4. O(n^2).

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The Controlled-Z Gate is a single-qubit gate, and its time complexity is O(1), meaning it takes a constant amount of time to perform.

Multiple choice

How does the Controlled-Z Gate relate to the CNOT Gate?

  1. The Controlled-Z Gate is a generalization of the CNOT Gate.

  2. The CNOT Gate is a generalization of the Controlled-Z Gate.

  3. The Controlled-Z Gate and the CNOT Gate are unrelated.

  4. None of the above.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The Controlled-Z Gate is a generalization of the CNOT Gate, in the sense that the CNOT Gate can be implemented using the Controlled-Z Gate and a Hadamard Gate.

Multiple choice

Which of the following is a quantum gate?

  1. Hadamard gate

  2. CNOT gate

  3. SWAP gate

  4. All of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Hadamard gate, CNOT gate, and SWAP gate are all quantum gates.

Multiple choice

In the following truth table, what is the output value of E when A is 1, B is 0, and C is 1?

A B C E
0 0 0 0
0 1 1 1
1 0 0 1
1 1 1 0
  1. 0

  2. 1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

From the truth table, we can see that when A is 1, B is 0, and C is 1, the output value of E is 1.

Multiple choice

In the following truth table, what is the output value of N when A is 1, B is 0, and C is 0?

A B C N
0 0 0 0
0 1 1 1
1 0 0 1
1 1 1 0
  1. 0

  2. 1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

From the truth table, we can see that when A is 1, B is 0, and C is 0, the output value of N is 1.