In the conceptual CPU execution loop, how can an interrupt transfer execution from a running process to interrupt-handling code?
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.
Select all reasons operating systems use interrupts.
- A
They let a process do other work instead of busy-waiting for an event.
- B
They allow the system to respond to events such as mouse movement without waiting for the current program to finish.
- C
They eliminate the need for the operating system to manage processes.
- D
They support periodic context switches so concurrent processes can share CPU time.
On RISC-V, executing ecall requests a trap that transitions the hardware to kernel mode to handle a system call.
- A
True
- B
False
In the Linux RISC-V syscall convention, what number must a wrapper place in a7 to invoke write? Enter the syscall number.
Interrupts can let a process do other work rather than for an event, and kernels use periodic to share CPU time among concurrent processes.
Using the conceptual CPU execution loop, explain when the CPU checks for interrupts and how it transfers execution to interrupt-handling code.
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?
- A
Put the syscall number in
a0, the arguments ina1througha6, then executeecall. - B
Put the syscall number in
a7, the arguments ina1througha6, then executeecall. - C
Put the syscall number in
a7, the arguments ina0througha5, then executeecall. - D
Put the syscall number in
a5, the arguments ina6througha7, then executeecall.
Select all statements that correctly describe the Linux RISC-V system-call convention.
- A
ecallis the special RISC-V instruction used to request a system-call trap, and it has no operands. - B
ecalltakes the syscall number as its operand. - C
a7holds the system-call number. - D
Arguments go in
a0througha5, and the return value goes ina0.
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).
- A
True
- B
False
In the conceptual interrupt loop, when does the CPU check whether an interrupt needs handling? Give the point in the instruction sequence.
While waiting for a network packet, a process can avoid busy-waiting by doing until the interrupt signals that the packet has arrived.
Which statement correctly describes how a RISC-V system call uses a trap and passes its call number and arguments?
- A
A system call uses the ordinary function calling convention, and
ecallreturns the CPU to user mode without entering the kernel. - B
A system call uses a trap to enter kernel mode;
ecallrequests it,a7holds the system-call number, anda0througha5hold arguments. - C
a0holds the system-call number,a7holds the first argument, and a system call does not require a special instruction. - D
ecalltakes the system-call number as an operand, whilea0througha5hold the return value.
Operating systems use interrupts for periodic context switches that help concurrent processes share CPU time fairly.
- A
True
- B
False
In the Linux RISC-V system-call convention, which register contains the system-call number?
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?
- A
Put 64 in
a0, put the file descriptor ina7, then useecall. - B
Put the buffer pointer in
a0, seta1to 64, and useretto invokewrite. - C
Put 64 in
a7, put 1 ina0, put the buffer pointer ina1, put 1 ina2, then executeecall. - D
Put 64 in
a7, put the buffer pointer ina0, and executeecallwithout setting the other arguments.
In the conceptual CPU model, the CPU checks for interrupts between adjacent instructions and transfers control to handling code when an interrupt needs attention.
- A
True
- B
False
In the conceptual CPU loop, what does the CPU check for between executing adjacent instructions?
After a Linux system call on RISC-V, which register contains the return value?
- A
a0 - B
a7 - C
a1througha5 - D
ecall
What inefficient waiting approach can interrupts help a process avoid while it waits for an event?
For the example that writes one character to standard output, which setup correctly invokes Linux write on RISC-V?
- A
Set
a7to 1,a0to 64,a1to 1, anda2to the buffer pointer; then executeecall. - B
Set
a7to 64,a0to 1,a1to the buffer pointer, anda2to 1; then executeecall. - C
Set
a7to the buffer pointer,a0to 64, anda1to 1; then executeret. - D
Set
a7to 64 and put all three arguments ina0; then executeecall.
Related study packs and tools
- Study guide
02 — Information and Representation
A progressive guide to how computers encode numbers, text, images, and sound as binary data, including the trade-offs and limits of digital representation.
- Quiz
2 Digital Logic
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
- Flashcards
03 — Python Programming Fundamentals
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
- Study guide
3 CPU Architecture
Learn how registers, the ALU, datapath connections, and control logic work together to fetch and execute CPU instructions.
- Study guide
05 — Data Structures: Concepts, Operations, and Trade-Offs
A structured guide to the main data structures, their operations, efficiency trade-offs, representations, and practical selection criteria.
- Study guide
6 Computer Memory
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
- Study guide
07 Trees and Binary Search Trees
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
- Flashcards
08 — Discrete Mathematics for Computer Science
A focused review of propositional logic, quantifiers, sets, relations, functions, and foundational proof methods in discrete mathematics for computer science.
- Study guide
8 Software Documentation
Learn how to choose, structure, document, and maintain software documentation for users, developers, integrators, and operators.
- Study guide
9 Sorting Algorithms
A structured guide to comparison-based sorting algorithms, their complexity, stability, memory use, and practical selection criteria.
- Study guide
10 — Data, Systems, and Applications
A progression through how data is organized, searched, exposed through software interfaces, and managed through abstraction layers in modern computer systems.
- Quiz
12 — Foundations Capstone
A medium-difficulty quiz on integrating problem definition, representation, algorithms, complexity analysis, testing, correctness, ethical evaluation, and documentation in a computer science capstone.