Created 06/18/03; edits: 07/25/15

# on Shift Instructions

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. Shift left logical the following bit pattern by one position:

```0011 1111
```
 A.    ``` 0111 1110 ``` B.    ``` 0111 1111 ``` C.    ``` 0011 1110 ``` D.    ``` 1011 1111 ```

2. Shift left logical the following bit pattern by two positions:

```0011 1111
```
 A.    ``` 0111 1111 ``` B.    ``` 1111 1110 ``` C.    ``` 1111 1100 ``` D.    ``` 1011 1111 ```

3. Shift right logical the following bit pattern by one position:

```0011 1111
```
 A.    ``` 0000 1111 ``` B.    ``` 1111 1110 ``` C.    ``` 0001 1110 ``` D.    ``` 0001 1111 ```

4. Here is a program that loads register \$5 with a bit pattern. Complete the program so that register \$4 receives the pattern in register \$5 shifted left logical by three positions.

```    ori      \$5, \$0, 0x92AF     # put a bit pattern into register \$5
sll      ___, ___, ___      # shift left logical by three, put
# result in register \$4
```
 A.    `sll \$5, \$3, \$4` B.    `sll 3, \$5, \$4` C.    `sll 5, 3, 4` D.    `sll \$4, \$5, 3`

5. What is the bit-wise OR of the following patterns:

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

6. What is the bit-wise AND of the following patterns:

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

7. What is the bit-wise XOR of the following patterns:

```0110 1101
0100 1010
```
 A.    `0110 0110` B.    `0010 0111` C.    `0110 1001` D.    `1110 0110`

8. What is the bit-wise NOR of the following patterns:

```0110 1101
0100 1010
```
 A.    `0110 1111` B.    `1001 0000` C.    `1110 1011` D.    `1110 1110`

9. Write the assembly language statement that will reverse the values of each bit in register \$5 and put the result in register \$8.

 A.    `nori \$8,\$5,\$0` B.    `nor \$8,\$5,\$0` C.    `xor \$8,\$5,\$0` D.    `nor \$5,\$8,\$0`

10. Write the assembly language instruction that copies the bit pattern in register \$13 to register \$15.

 A.    `ori \$15,\$13,\$0` B.    `andi \$13,\$15,\$15` C.    `and \$13,\$15,\$15` D.    `or \$15,\$13,\$0`

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.