Useability principle: safety

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

Useability principle: safety

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A user clicks Delete on a file. Which design is safer?
A A pop-up asks 'Delete this file? This cannot be undone.' with Cancel and Delete buttons
B The file disappears instantly with no message
2. Which feature helps a user RECOVER after making a mistake?
A A bright colour on the Save button
B An Undo button that restores the deleted text
3. True or false: A safe interface only needs to stop mistakes, and recovery does not matter.
A True: prevention is the only part of safety
B False: it should also help users recover from errors
4. A sign-up form collects a student's home address and phone number. Which is the safer choice?
A Hide the details from other users and explain who can see them
B Show all details publicly by default so users can find each other
5. Which warning is clearer and safer?
A Warning: Closing now will lose your unsaved work. Save first?
B Error 0x4F: operation terminated

Match the Pairs

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

Left columnRight column
1if (confirm("Delete this file?")) { deleteFile(); } Apassword_entry = Entry(window, show="*")
2undoStack.pop() BThe account is deleted immediately with no confirmation, so one accidental click causes permanent harm.
3A clear warning tells users what will be lost before they continue, so they can avoid a harmful mistake CRemoves the last saved action so the user can reverse a mistake and recover from it
4Protecting personal data means hiding sensitive input so others cannot see it DThe message is unclear, so the user cannot tell what went wrong or how to recover from the error.
5deleteButton.onclick = deleteAccount; EAsks the user to confirm before a destructive action runs, preventing an accidental delete
6showMessage("Error 0x4F") Fmessagebox.askyesno("Warning", "This will erase all your work. Continue?")

Definitions

safety

Fill in the Blanks

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

1.
if messagebox.________("Delete?", "Sure?"): delete_file()
2.
history.append(text) text = history.___()
3.
pw = Entry(win, ____="*")
4.
messagebox.___________("Warning", "Sure?")
5.
ok = messagebox.askyesno("Delete", "Sure?") if __: delete_file()

Spot the Error

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

Question 1
A ok = True
B if ok:
C remove(name)
Question 2
A def undo():
B item = undo_stack.pop()
C items.remove(item)
D print('Restored', item)
Question 3
A pw = Entry(root)
B pw.pack()
C b = Button(root, text='Go')
Question 4
A def check_pw(pw):
B if len(pw) < 8:
C msg = 'Use 8+ chars'
D warn.config(text='!')
Question 5
A user = entry_user.get()
B pw_hash = entry_pw.get()
C save(user, pw_hash)

Answer Key

Useability principle: safety
Section A: Quick Questions
Q1
A — A pop-up asks 'Delete this file? This cannot be undone.' with Cancel and Delete buttons
Q2
B — An Undo button that restores the deleted text
Q3
B — False: it should also help users recover from errors
Q4
A — Hide the details from other users and explain who can see them
Q5
A — Warning: Closing now will lose your unsaved work. Save first?
Section B: Match the Pairs
Q1
if (confirm("Delete this file?")) { deleteFile(); } → Asks the user to confirm before a destructive action runs, preventing an accidental delete
Q2
undoStack.pop() → Removes the last saved action so the user can reverse a mistake and recover from it
Q3
A clear warning tells users what will be lost before they continue, so they can avoid a harmful mistake → messagebox.askyesno("Warning", "This will erase all your work. Continue?")
Q4
Protecting personal data means hiding sensitive input so others cannot see it → password_entry = Entry(window, show="*")
Q5
deleteButton.onclick = deleteAccount; → The account is deleted immediately with no confirmation, so one accidental click causes permanent harm.
Q6
showMessage("Error 0x4F") → The message is unclear, so the user cannot tell what went wrong or how to recover from the error.
Section C: Definitions
Q1
safety — A useability principle: the interface prevents harmful mistakes, such as with confirmation, clear warnings and data protection, and lets users recover from errors, such as with undo.
Section D: Fill in the Blanks
Q1
if messagebox.askyesno("Delete?", "Sure?"): delete_file()
Q2
history.append(text) text = history.pop()
Q3
pw = Entry(win, show="*")
Q4
messagebox.showwarning("Warning", "Sure?")
Q5
ok = messagebox.askyesno("Delete", "Sure?") if ok: delete_file()
Section E: Spot the Error
Q1
A — The confirmation dialog was replaced with True, so the file is deleted without asking. It should be ok = askyesno('Delete file?') so the user can cancel a harmful action.
Q2
C — Undo must restore the deleted item, not remove it again. The line should be items.append(item) so the user can recover from the mistake.
Q3
A — Without show='*' the password is displayed in plain text, so anyone nearby can read it. The Entry should use show='*' to protect personal data.
Q4
D — The warning shows only '!', which does not tell the user what is wrong. It should display the clear message with text=msg.
Q5
B — This stores the password as plain text. To protect personal data it should be hashed: pw_hash = hash(entry_pw.get()).