AS · Practice questions · Interrupts

Save, service, restore.

Six original Cambridge-style questions on interrupts and interrupt handling, with mark-scheme style solutions.

Original questions All questions on this page are original work, written in the Cambridge AS & A Level style. They are not from past papers. They test the same concepts and skills the syllabus rewards.
Earn the marks

The handling sequence.

01
Recall
[2 marks]

State what is meant by an interrupt.

  • A signal sent to the processor (from a device or a program). ✓
  • To show that something needs attention / that an event needs processing. ✓
02
Recall
[3 marks]

Give three different possible causes of an interrupt.

  • Hardware, e.g. a printer is out of paper or a key is pressed. ✓
  • Software, e.g. division by zero or an illegal memory access. ✓
  • Timer, e.g. the end of a time slice (or the user pressing a break key, or power failure). ✓
03
Explain
[5 marks]

Describe how the processor detects and handles an interrupt.

  • At the end of each fetch-execute cycle the processor checks for an interrupt. ✓
  • The priority of the interrupt is compared with the current task; if it is higher it is serviced. ✓
  • The contents of the registers (including the PC) are saved on the stack. ✓
  • The start address of the ISR is loaded into the PC and the ISR is executed. ✓
  • When the ISR finishes, the registers are restored from the stack and the interrupted task continues. ✓
04
Explain
[2 marks]

Explain why interrupts are only detected at the end of a fetch-execute cycle.

  • So that the current instruction is completed (not left half executed). ✓
  • The register contents are then in a known state that can be saved and resumed correctly. ✓
05
Apply
[3 marks]

During a program, a printer "paper out" interrupt (priority 2) and a mouse movement interrupt (priority 1) arrive in the same cycle. Then, while the first ISR runs, a hard disk error interrupt (priority 4) arrives. State the order in which the three ISRs start, and the order in which the tasks are completed.

  • ISRs start in the order: printer (priority 2), hard disk error (priority 4, interrupts the printer ISR), mouse (priority 1). ✓
  • The hard disk ISR finishes first, then the printer ISR resumes and finishes. ✓
  • Then the mouse ISR runs (it is still higher than the program), then the program resumes. ✓
06
Analysis
[2 marks]

A student says: "When an interrupt happens, the processor stops the program and starts it again from the beginning after the ISR." Explain why this is wrong.

  • The program's register contents, including the PC, are saved before the ISR runs. ✓
  • They are restored afterwards, so the program continues from where it was interrupted. ✓

Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.