Created 03/14/03, revised 02/24/23

# on Bitwise Logic

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.

1. With some machine instructions, one of the operands is contained in 16 bits of the instruction itself. What is such an operand called?

 A.    immediate operand B.    embedded operand C.    binary operand D.    machine operand

2. What is it called when a logical operation is performed between the bits of each column of the operands to produce a result bit for each column?

 A.    logic operation B.    bitwise operation C.    binary operation D.    column operation

3. When an operation is actually performed, what is true of the operands in the ALU?

 A.    At least one operand must be 32 bits wide. B.    Each operand can be any size. C.    Both operands must come from registers. D.    Both operands must each be 32 bits wide.

4. Sixteen bits of data from an `ori` instruction are used as an immediate operand. During execution, what first happens with those 16 bits?

 A.    The data is zero-extended by 16 bits on the right. B.    The data is zero-extended by 16 bits on the left. C.    Nothing needs to be done. D.    Only 16 bits are used from the other operand.

5. What is it called with a bit pattern is copied into a register?

 A.    The register is loaded with the pattern. B.    The register is stuffed with the pattern. C.    The register is filled with the pattern. D.    The register is set with the pattern.

6. Which of the following instructions loads register `\$5` with the bit pattern that represents positive 4810?

 A.    `ori \$5,\$0,0x48` B.    `ori \$5,\$5,0x48` C.    `ori \$5,\$0,48` D.    `ori \$0,\$5,0x48`

7. Can the `ori` instruction put the two's complement representation of a negative integer into a register?

 A.    No. B.    Yes.

8. Which of the following instructions clears all the bits in register \$8 except for the low order byte, which is unchanged?

 A.    `ori \$8,\$8,0xFF` B.    `ori \$8,\$0,0x00FF` C.    `xori \$8,\$8,0xFF` D.    `andi \$8,\$8,0xFF`

9. What is the result of performing an exclusive or of a bit pattern with itself?

 A.    The result is all zero bits. B.    The result is the same as the original. C.    The result is all one bits. D.    The result is the reverse of the original.

10. Do all machine instructions have the same parts?

 A.    No. Different types of machine instructions are made of different fields. B.    No. Each machine instruction is completely different from any other. C.    Yes. All machine instructions have the same parts in the same order. D.    Yes. All machine instructions have the same parts, but they might be in different orders.

11. What is the result of bit-wise OR between the following two patterns?

```0110 1001
1010 0101
```
 A.    ```1110 1101 ``` B.    ```0100 1001 ``` C.    ```0101 1111 ``` D.    ```0110 1000 ```

12. What is the result of bit-wise AND between the following two patterns?

```0110 1001
1010 0101
```
 A.    ```1100 1101 ``` B.    ```0010 0001 ``` C.    ```1101 1111 ``` D.    ```0110 1000 ```

13. What is the result of bit-wise XOR between the following two patterns?

```0110 1001
1010 0101
```
 A.    ```1110 1101 ``` B.    ```0010 0001 ``` C.    ```1100 1100 ``` D.    ```0110 1000 ```

14. What is the result of bit-wise AND between the following two patterns?

```1110 1101
0010 0101
```
 A.    ```1110 1001 ``` B.    ```0010 0001 ``` C.    ```0010 0101 ``` D.    ```0110 1000 ```

15. What is the result of bit-wise OR between the following two patterns?

```1110 1101
0010 0101
```
 A.    ```1110 1001 ``` B.    ```0010 0001 ``` C.    ```0010 0101 ``` D.    ```1110 1101 ```

The number you got right:    Percent Correct:       Letter Grade:

If you have returned here from another page, or have re-loaded this page, you will need to click again on each of your choices for the grading program to work correctly. You may want to press the SHIFT KEY while clicking to clear the old answers.