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 | |
|---|---|---|
| 1key press interrupt -> ISR reads the character | AISR finished -> restore state -> resume task | |
| 2mouse move interrupt -> ISR updates pointer | BThe ISR action is wrong for the event. A divide by zero is dealt with by showing an error message or stopping the faulty program, not by reading a key press. | |
| 3Dividing by zero causes an interrupt, and the ISR shows an error message or stops the faulty program | CThe ISR works out the new position and the pointer on the screen is moved to it | |
| 4When the ISR has finished, the CPU goes back to the task it was running before the interrupt | DThe ISR reads the key that was pressed and passes the character to the program that is waiting for it | |
| 5divide by zero interrupt -> ISR reads a key press | EIF divisor = 0 THEN ISR shows error / stops program | |
| 6ISR finished -> CPU stops and never runs the task again | FAfter the ISR the CPU should return to the interrupted task and carry on. It does not stop for good. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
interrupt outcome — What the ISR does depends on the event: it reads a key press, updates the pointer, shows an error or stops a faulty program. Then the CPU resumes the task it was running.IF event = "key press" THEN
character ← readKey()
passToProgram(character)IF event = "mouse move" THEN
updatePointer(newX, newY)
ENDIFIF event = "divide by zero" THEN
showError("Cannot divide by zero")
stopProgram()IF event = "memory conflict" THEN
stopProcess(faultyProcess)
ENDIFrestoreState()
resume(interruptedTask)