Created 07/03/03

# on the Trap Handler

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 name for the small collection of services on SPIM that are invoked using a `syscall` instruction?

A. wolf trap
B. trap handler
C. BIOS
D. operating system

2. Does the `syscall` instruction correspond to just one machine language instruction?

A. No--it is so complicated that it takes several machine instructions.
B. No--it is special and does not correspond to any machine instructions.
C. Yes--it is a fundamental operation of the hardware.
D. Yes--all assembly language statements correspond to one machine instruction.

3. Which of the following fragments correctly writes "Hello" to the monitor?

A.
            lw      $v0,4
            lw      $a0,hello
            syscall
             . . .
    hello:  .asciiz "Hello"
B.
            li      $v0,4
            la      $a0,hello
            syscall
             . . .
    hello:  .asciiz "Hello"
C.
            li      $v0,4
            lw      $a0,hello
            syscall
             . . .
    hello:  .ascii  "Hello"
D.
            li      $v0,4
            li      $a0,"Hello"
            syscall
             . . .

4. Where is the integer after the "read integer" service returns control?

A. In the input buffer.
B. In register $v0.
C. In register $a0.
D. In a register specified by the user.

5. What parameters are expected for the "read string" service?

A. The address of the input buffer.
B. The length of the input buffer and the address of the input buffer.
C. The length of the input buffer.
D. The addresses of the input buffer and of the output buffer.

6. Are the code numbers for the various services determined by the MIPS hardware or by the software of the the trap handler?

A. This is a hardware feature of the MIPS chip.
B. This is a hardware feature of the various IO devices attached to the computer.
C. Software--the user program sets up the service codes before it starts execution.
D. Software--the trap handler software examines the code and branches to the indicated sevice.

7. In an actual computer system with a full-scale operating system, what would the exit service do?

A. Halt the processor.
B. Return control to the operating system.
C. Halt the operating system.
D. Immediately start running another user program.

8. With the SPIM simulator, how is the trap handler loaded into (simulated) memory?

A. By checking "Bare Machine" in Settings.
B. By checking "Load trap file" in Settings.
C. By checking "Mapped I/O" in Settings.
D. By using "Open" in the "File" menu.

9. What does the "read integer" service do?

A. It reads two's complement integers directly from the keyboard.
B. It reads in a line of characters from the keyboard and then converts those characters to a two's complement integer.
C. It reads a single digit from the keyboard and returns it in $v0.
D. It reads the next number on the current line. If there is no next number it goes on to the next line.

10. With a full-sized operating system, when a user enters a string of characters in response to a prompt, where are editing characters (like delete and backspace) interpretted?

A. In the user's program.
B. An operating system service is running as the user enters and edits text.
C. The keyboard device driver implements line editing.
D. The basic IO system is in charge of this.

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.