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 | |
|---|---|---|
| 1while no_key_pressed: check_keyboard() | APolling: the CPU keeps checking the keyboard again and again, wasting time that could be used to run programs | |
| 2CPU runs program; key pressed -> interrupt signal sent | BIF interrupt_received THEN handle_event() | |
| 3Interrupts free the CPU to run programs, because it does not have to keep checking each device | CThis is wrong because with interrupts the printer signals the CPU when it needs attention, so the CPU is not stuck checking and can run other programs. | |
| 4Interrupts give a quick response to an urgent event, such as a device needing attention immediately | DAn interrupt: the CPU keeps running programs and only responds when the keyboard signals that it needs attention | |
| 5Interrupts make the CPU check the mouse every millisecond to see if it moved | EThis describes polling, not interrupts. With interrupts the mouse sends a signal only when it moves, so the CPU does not keep checking. | |
| 6A printer has to wait until the CPU happens to check it, so the CPU is always busy with it | FRUN program_A // no checking of devices needed |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
interrupt — A signal that tells the CPU an event needs attention, so it responds only when needed instead of constantly checking devices (polling). This frees the CPU and gives a quick response.WHILE TRUE
CHECK keyboard
ENDWHILE// An interrupt alerts the CPU to an event// Constant checking of devices = polling// Interrupts give a quick response// The CPU is free to run other programs