Created 6/25/03

# on More Memory Access

This is a practice quiz. The results are not recorded anywhere and do not affect your grade. The questions on this quiz might not appear in any quiz or test that does count toward your grade.

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. What is the smallest addressable unit of main memory?

A. byte
B. bit
C. nibble
D. halfword

2. Which of the following instructions does sign extension?

A. lbu
B. lb
C. add
D. lhu

3. Say that:

- Memory at `0x10000000` contains `0x80`
- Register $5 contains `0x10000000`

What is put in register $8 after `lb $8,0($5)` is executed?

A. `0x88888880`
B. `0x00000080`
C. `0x80000000`
D. `0xFFFFFF80`

4. What instruction is used to store a byte to memory?

A. `sb`
B. `sbu`
C. `lb`
D. `sw`

5. Say that:

- Memory at `0x10000000` contains `0x80`
- Memory at `0x10000001` contains `0x00`
- Register $5 contains `0x10000000`

Say that the MIPS chip is running in little-endian mode (as does SPIM on an Intel computer). What is put in register $8 after `lh $8,0($5)` is executed?

A. `0xFFFFFF80`
B. `0x88888880`
C. `0x00000080`
D. `0x80000000`

6. Say that:

- Memory at `0x10000000` contains `0x80`
- Memory at `0x10000001` contains `0x00`
- Register $5 contains `0x10000000`

Say that the MIPS chip is running in big-endian mode (as does SPIM on an Apple computer). What is put in register $8 after `lh $8,0($5)` is executed?

A. `0xFFFF8000`
B. `0xFFFFFF80`
C. `0x00000080`
D. `0x80000000`

7. Which one of the following address are half-word aligned?

A. `0x01004F35`
B. `0x01004F37`
C. `0x01004F3A`
D. `0x01004F3F`

8. Say that data is in memory and the base register has been initialized correctly. You have the following program:

    lh     $5,0($10)
    lb     $6,4($10)
    addu   $7,$5,$4

What does the `addu` instruction do?

A. It performs the binary addition algorithm on whatever 32-bit patterns are in registers $4 and $5.
B. It performs a 16-bit addition because that is the size of the largest operand.
C. It performs an 8-bit addition.
D. The instruction causes a trap because the operands are not the same sizes.

9. Which of the following assembler directives reserves 1210 bytes of memory?

A. .word 3
B. .byte 12
C. .block 6
D. .space 12

10. You wish to speed up the execution of a C program. The program runs on a 32-bit processor. You notice that the variables in the program are a mix of `short int`, `int` and `long int` variables. The program does a great deal of integer arithmetic. How might you speed up this program?

A. Make as many variables of type `int` as is possible.
B. Make as many variables of type `short int` as is possible.
C. Make all variables as small as is needed for the range of values they are exected to hold.
D. Shorten the names of all the variables.

11. A digital image is stored in a file. The pixels of the image represent a gray level of 0 to 255. What instruction are you likely to use in loading a register with the value of a pixel?

A. `lb`
B. `lbu`
C. `lh`
D. `lhu`

12. How does SPIM display the data section of simulated main memory?

A. One byte per address in columns.
B. In groups of 4-byte words with the highest address on the right.
C. In groups of 4-byte words with the lowest address on the right.
D. This depends on the type of data in memory.

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.