Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1PUSH registers; PC -> stack | Ax = 10 / 0 -> interrupt -> ISR: error message | |
| 2POP registers; resume task | BThe CPU must save its state BEFORE running the ISR. If it runs the ISR first, the register values and program counter of the interrupted task are overwritten and lost. | |
| 3Key press worked example: the keyboard sends a signal, the CPU finishes its cycle, saves its state, runs the keyboard ISR, restores its state and resumes. | CSteps 5 and 6: the CPU restores its saved state and carries on with the original task where it left off. | |
| 4Division by zero worked example: the software generates an interrupt, the CPU detects it after its cycle, saves its state and runs an ISR that shows an error message. | DThe CPU does not stop instantly. It finishes the current fetch-decode-execute cycle first and then detects the interrupt, and the sequence must also end with restore and resume. | |
| 5detect -> run ISR -> save state -> restore -> resume | EStep 3: the CPU saves its state (register values and the program counter) so the interrupted task can be resumed later. | |
| 6generate -> CPU stops instantly -> save -> ISR | Fgenerate -> detect -> save -> run ISR -> restore -> resume |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
interrupt handling sequence — The ordered steps: an interrupt is generated, the CPU finishes its cycle and detects it, saves its state, runs the ISR, restores its state, then resumes the original task.STEP 1: key press generates an interrupt
STEP 2: CPU finishes cycle and detects itSTEP 3: CPU saves its state (registers, PC)STEP 3: CPU saves its state
STEP 4: CPU runs the ISRSTEP 5: CPU restores the saved state
STEP 6: CPU resumes the original taskresult = 10 / 0
A software interrupt is generated