Useability principle: error tolerance

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

Useability principle: error tolerance

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A form refuses to submit and highlights an email field that is missing the @ symbol. Which part of error tolerance is this?
A Undo reversing a mistake after it is saved
B Input validation catching a mistake before it is saved
2. A student taps 'Delete project' and the app asks 'Delete this project permanently? Yes / Cancel'. What is the prompt doing?
A Preventing an accidental, serious action by asking the user to confirm
B Validating that the project name is in the correct format
3. Which design is MORE error tolerant for a photo-editing app?
A A tutorial that tells users to be careful with each editing tool
B An Undo button that restores the photo to its state before the last change
4. A date-of-birth field only lets users pick a day from a calendar, so a date like 31 February cannot be entered. Which is the best description?
A It prevents errors by limiting input to valid values
B It helps users recover from errors by letting them undo them
5. Which interface is LESS error tolerant?
A A 'Clear all data' button that wipes the data instantly with no warning and no undo
B A 'Clear all data' button that asks for confirmation and offers undo for 10 seconds

Match the Pairs

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

Left columnRight column
1if (!email.includes("@")) { showError(); } Aif (history.length > 0) { history.pop(); }
2confirm("Delete this file?") BThe error message is vague and the check is incomplete. Users need a clear message such as 'Enter an age between 0 and 120' to fix the problem and recover.
3Undo lets users recover from a mistake by reversing the last action they took. CA confirmation prompt: it makes the user pause and check before an action that is hard to reverse.
4Preventing mistakes: a form accepts only an age in a sensible range, so typing errors are caught early. DThere is no confirmation prompt, so one accidental click permanently deletes the account with no chance to notice or recover. Add a confirm step first.
5deleteAccount(); // runs straight away, no prompt Eif (age < 0 || age > 120) { showError(); }
6if (age < 0) { showError("Error 42"); } FInput validation: the system checks what the user typed and flags a problem before the mistake is saved.

Definitions

error tolerance

Fill in the Blanks

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

1.
age = entry.get() if age._______(): save(age)
2.
ok = messagebox.________("Delete", "Sure?") if ok: delete_file()
3.
history.append(text) def undo(): return history.___()
4.
if score < 0 or score _ 100: show_error("Enter 0 to 100")
5.
try: n = int(entry.get()) ______ ValueError:

Spot the Error

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

Question 1
A pw = input("Password: ")
B if len(pw) > 8:
C print("Use 8+ characters")
D else:
E print("Saved")
Question 2
A history = ["H", "Hi", "Hi!"]
B if len(history) > 1:
C history.pop()
D text = history[0]
Question 3
A def delete_file():
B answer = input("Delete? y/n ")
C if answer != "y":
D remove(name)
Question 4
A name = input("Name: ")
B while name.strip() != "":
C print("Name is required")
D name = input("Name: ")
Question 5
A while age < 0 and age > 120:
B print("Enter 0 to 120")
C age = int(input("Age: "))

Answer Key

Useability principle: error tolerance
Section A: Quick Questions
Q1
B — Input validation catching a mistake before it is saved
Q2
A — Preventing an accidental, serious action by asking the user to confirm
Q3
B — An Undo button that restores the photo to its state before the last change
Q4
A — It prevents errors by limiting input to valid values
Q5
A — A 'Clear all data' button that wipes the data instantly with no warning and no undo
Section B: Match the Pairs
Q1
if (!email.includes("@")) { showError(); } → Input validation: the system checks what the user typed and flags a problem before the mistake is saved.
Q2
confirm("Delete this file?") → A confirmation prompt: it makes the user pause and check before an action that is hard to reverse.
Q3
Undo lets users recover from a mistake by reversing the last action they took. → if (history.length > 0) { history.pop(); }
Q4
Preventing mistakes: a form accepts only an age in a sensible range, so typing errors are caught early. → if (age < 0 || age > 120) { showError(); }
Q5
deleteAccount(); // runs straight away, no prompt → There is no confirmation prompt, so one accidental click permanently deletes the account with no chance to notice or recover. Add a confirm step first.
Q6
if (age < 0) { showError("Error 42"); } → The error message is vague and the check is incomplete. Users need a clear message such as 'Enter an age between 0 and 120' to fix the problem and recover.
Section C: Definitions
Q1
error tolerance — A useability principle: the interface prevents mistakes where it can, and helps users notice and recover from the ones they make, using validation, confirmation prompts and undo.
Section D: Fill in the Blanks
Q1
age = entry.get() if age.isdigit(): save(age)
Q2
ok = messagebox.askyesno("Delete", "Sure?") if ok: delete_file()
Q3
history.append(text) def undo(): return history.pop()
Q4
if score < 0 or score > 100: show_error("Enter 0 to 100")
Q5
try: n = int(entry.get()) except ValueError:
Section E: Spot the Error
Q1
B — The validation check is reversed. It rejects long passwords and lets short ones through. It should be if len(pw) < 8: so that passwords which are too short are caught before they are saved.
Q2
D — Undo should restore the previous state, which is the last item left after pop(). Using history[0] jumps back to the oldest state and throws away all of the user's recent work. It should be text = history[-1].
Q3
C — The confirmation logic is inverted. The file is deleted when the user says no and kept when they say yes. The condition should be if answer == "y": so that deletion only happens after the user confirms.
Q4
B — The loop condition is wrong. It repeats when the user has entered a valid name and accepts an empty field. It should be while name.strip() == "": so the user is asked again only while the field is empty.
Q5
A — No number can be below 0 and above 120 at the same time, so the validation loop never runs and bad ages get through. The range check needs or: while age < 0 or age > 120:.