System controls

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

System controls

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which is an example of a system control?
A A form that accepts any value typed in
B A form that rejects an age of -5
2. What is the main purpose of a system control?
A Keep the system's behaviour within what is intended
B Make the system's screen look more colourful
3. A login screen only lets a student see their own marks. Which type of control is this?
A Access limit
B Feedback
4. A page shows 'Order saved!' after you press Submit. Which type of control is this?
A Feedback
B Input control
5. Which is an input control?
A A progress bar that shows a file uploading
B A range check that only accepts marks from 0 to 100

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1if not age.isdigit(): ANo input control: a non-number or a negative quantity is passed straight to the order, which can crash the system
2if role != "admin": BNo access limit: the program welcomes the user without checking the password, so anyone gets in
3Feedback control: the system tells the user what happened so they can correct their action CAn input control: it checks the data type and rejects non-numeric input before the system uses it
4Input control: reject values outside the allowed range Dprint("Error: enter a number from 1 to 10")
5password = input() print("Welcome") EAn access limit: it stops users who are not administrators from reaching restricted actions
6qty = int(input()) order(qty) Fif mark < 0 or mark > 100:

Definitions

system control

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
if age >= 0 ___ age <= 120: print("Valid age")
2.
value = input("Enter a number: ") while ___ value.isdigit(): value = input("Try again: ")
3.
if score < 0: _____("Score cannot be negative")
4.
if role __ "admin": print("Access denied")
5.
attempts = 0 while attempts < 3: attempts __ 1

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A age = int(input("Age: "))
B while age < 0 or age > 120:
C age = input("Again: ")
D print("Age saved")
Question 2
A role = "student"
B if role == "admin":
C print("Access denied")
D else:
E print("Access denied")
Question 3
A pw = input("Password: ")
B if len(pw) = 8:
C print("Password saved")
D else:
E print("Too short")
Question 4
A attempts = 3
B while attempts < 3:
C pin = input("PIN: ")
D attempts += 1
Question 5
A def check_qty(qty)
B if qty < 1 or qty > 10:
C return False
D return True

Answer Key

System controls
Section A: Quick Questions
Q1
B — A form that rejects an age of -5
Q2
A — Keep the system's behaviour within what is intended
Q3
A — Access limit
Q4
A — Feedback
Q5
B — A range check that only accepts marks from 0 to 100
Section B: Match the Pairs
Q1
if not age.isdigit(): → An input control: it checks the data type and rejects non-numeric input before the system uses it
Q2
if role != "admin": → An access limit: it stops users who are not administrators from reaching restricted actions
Q3
Feedback control: the system tells the user what happened so they can correct their action → print("Error: enter a number from 1 to 10")
Q4
Input control: reject values outside the allowed range → if mark < 0 or mark > 100:
Q5
password = input() print("Welcome") → No access limit: the program welcomes the user without checking the password, so anyone gets in
Q6
qty = int(input()) order(qty) → No input control: a non-number or a negative quantity is passed straight to the order, which can crash the system
Section C: Definitions
Q1
system control — A mechanism, such as input validation, user feedback or access limits, that keeps a system's behaviour within what is intended.
Section D: Fill in the Blanks
Q1
if age >= 0 and age <= 120: print("Valid age")
Q2
value = input("Enter a number: ") while not value.isdigit(): value = input("Try again: ")
Q3
if score < 0: print("Score cannot be negative")
Q4
if role != "admin": print("Access denied")
Q5
attempts = 0 while attempts < 3: attempts += 1
Section E: Spot the Error
Q1
C — The re-entered value is left as a string, so the range check on the next loop would crash or fail. It should be converted with int(input("Again: ")) so the input control keeps working.
Q2
C — This access limit gives the wrong feedback. An admin should see "Access granted", and "Access denied" belongs in the else branch.
Q3
B — A single = assigns a value and is a syntax error in a condition. The length check needs a comparison operator: if len(pw) >= 8:
Q4
A — The attempts counter must start at 0. Starting at 3 means the loop never runs and the user is never asked for a PIN, so the access limit does nothing.
Q5
A — The def line is missing its colon. It should be def check_qty(qty): so this input control function is valid Python.