Timedora
Free Practice Quiz Question List

Interrupts Online Quiz Questions

Use this free practice quiz with 20 questions to review Interrupts, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

In the conceptual CPU execution loop, how can an interrupt transfer execution from a running process to interrupt-handling code?

  1. A

    The CPU waits until the running process finishes, then checks for interrupts.

  2. B

    The CPU checks for interrupts between instructions and transfers control to handling code when necessary.

  3. C

    The process checks for interrupts only when it makes a system call.

  4. D

    The CPU checks for interrupts only before it fetches the first instruction.

02
Choose all
1 point

Select all reasons operating systems use interrupts.

  1. A

    They let a process do other work instead of busy-waiting for an event.

  2. B

    They allow the system to respond to events such as mouse movement without waiting for the current program to finish.

  3. C

    They eliminate the need for the operating system to manage processes.

  4. D

    They support periodic context switches so concurrent processes can share CPU time.

03
True or false
1 point

On RISC-V, executing ecall requests a trap that transitions the hardware to kernel mode to handle a system call.

  1. A

    True

  2. B

    False

04
Written response
1 point

In the Linux RISC-V syscall convention, what number must a wrapper place in a7 to invoke write? Enter the syscall number.

05
Fill in the blank
1 point

Interrupts can let a process do other work rather than for an event, and kernels use periodic to share CPU time among concurrent processes.

06
Open ended
1 point

Using the conceptual CPU execution loop, explain when the CPU checks for interrupts and how it transfers execution to interrupt-handling code.

07
Choose one
1 point

A RISC-V assembly wrapper is preparing to invoke a Linux system call. Which register setup follows the syscall convention before the wrapper executes the trap instruction?

  1. A

    Put the syscall number in a0, the arguments in a1 through a6, then execute ecall.

  2. B

    Put the syscall number in a7, the arguments in a1 through a6, then execute ecall.

  3. C

    Put the syscall number in a7, the arguments in a0 through a5, then execute ecall.

  4. D

    Put the syscall number in a5, the arguments in a6 through a7, then execute ecall.

08
Choose all
1 point

Select all statements that correctly describe the Linux RISC-V system-call convention.

  1. A

    ecall is the special RISC-V instruction used to request a system-call trap, and it has no operands.

  2. B

    ecall takes the syscall number as its operand.

  3. C

    a7 holds the system-call number.

  4. D

    Arguments go in a0 through a5, and the return value goes in a0.

09
True or false
1 point

A RISC-V wrapper for writing one character to standard output sets a7 to 64, sets a0 to 1, places the buffer pointer in a1, sets a2 to 1, and executes ecall. These register values invoke write(1, buffer, 1).

  1. A

    True

  2. B

    False

10
Written response
1 point

In the conceptual interrupt loop, when does the CPU check whether an interrupt needs handling? Give the point in the instruction sequence.

11
Fill in the blank
1 point

While waiting for a network packet, a process can avoid busy-waiting by doing until the interrupt signals that the packet has arrived.

12
Choose one
1 point

Which statement correctly describes how a RISC-V system call uses a trap and passes its call number and arguments?

  1. A

    A system call uses the ordinary function calling convention, and ecall returns the CPU to user mode without entering the kernel.

  2. B

    A system call uses a trap to enter kernel mode; ecall requests it, a7 holds the system-call number, and a0 through a5 hold arguments.

  3. C

    a0 holds the system-call number, a7 holds the first argument, and a system call does not require a special instruction.

  4. D

    ecall takes the system-call number as an operand, while a0 through a5 hold the return value.

13
True or false
1 point

Operating systems use interrupts for periodic context switches that help concurrent processes share CPU time fairly.

  1. A

    True

  2. B

    False

14
Written response
1 point

In the Linux RISC-V system-call convention, which register contains the system-call number?

15
Choose one
1 point

A RISC-V assembly wrapper must use Linux write to print exactly one character to standard output. Which register setup and instruction match the example?

  1. A

    Put 64 in a0, put the file descriptor in a7, then use ecall.

  2. B

    Put the buffer pointer in a0, set a1 to 64, and use ret to invoke write.

  3. C

    Put 64 in a7, put 1 in a0, put the buffer pointer in a1, put 1 in a2, then execute ecall.

  4. D

    Put 64 in a7, put the buffer pointer in a0, and execute ecall without setting the other arguments.

16
True or false
1 point

In the conceptual CPU model, the CPU checks for interrupts between adjacent instructions and transfers control to handling code when an interrupt needs attention.

  1. A

    True

  2. B

    False

17
Written response
1 point

In the conceptual CPU loop, what does the CPU check for between executing adjacent instructions?

18
Choose one
1 point

After a Linux system call on RISC-V, which register contains the return value?

  1. A

    a0

  2. B

    a7

  3. C

    a1 through a5

  4. D

    ecall

19
Written response
1 point

What inefficient waiting approach can interrupts help a process avoid while it waits for an event?

20
Choose one
1 point

For the example that writes one character to standard output, which setup correctly invokes Linux write on RISC-V?

  1. A

    Set a7 to 1, a0 to 64, a1 to 1, and a2 to the buffer pointer; then execute ecall.

  2. B

    Set a7 to 64, a0 to 1, a1 to the buffer pointer, and a2 to 1; then execute ecall.

  3. C

    Set a7 to the buffer pointer, a0 to 64, and a1 to 1; then execute ret.

  4. D

    Set a7 to 64 and put all three arguments in a0; then execute ecall.