1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is defensive design?
Writing programs that anticipate and handle misuse — ensuring the program behaves correctly even when given unexpected or invalid inputs — making programs reliable and secure
What is input validation?
Checking that data entered by a user meets specific criteria before it is processed — rejects invalid data and asks the user to re-enter — prevents errors and crashes
Write OCR ERL code that validates a user enters a number between 1 and 10
num = int(input("Enter a number 1-10")). while num < 1 OR num > 10. print("Invalid — try again"). num = int(input("Enter a number 1-10")). endwhile
What is authentication?
Confirming the identity of a user before allowing access — typically using a username and password — prevents unauthorised access
Write OCR ERL code for a simple username and password check
username = input("Username"). password = input("Password"). if username == "admin" AND password == "pass123" then. print("Access granted"). else. print("Access denied"). endif
What are naming conventions and why are they important?
Using clear descriptive names for variables and subprograms — eg totalScore instead of x — makes code easier to read and maintain — allows others to understand the code
What is indentation and why is it important?
Adding spaces or tabs to show the structure of code — makes it clear which statements are inside loops or selection statements — improves readability and maintainability
What is commenting and why is it important?
Adding notes to code using // in OCR ERL — explains what sections of code do — does not affect execution — helps others understand and maintain the code
What is the purpose of using subprograms in terms of maintainability?
Breaks code into smaller named sections — each section can be developed and tested independently — reduces repetition — makes code easier to read update and debug
What is the purpose of testing?
To ensure a program works correctly — identifies and fixes errors before the program is used — checks the program behaves as expected for all possible inputs
What is iterative testing?
Testing modules of a program during development — testing each section as it is written — allows errors to be found and fixed early before they affect other parts
What is final or terminal testing?
Testing the complete finished program at the end of development — checks the whole system works together correctly — checks it meets the original requirements
What is a syntax error and give an example?
An error that breaks the grammatical rules of the programming language — prevents the program from running — eg missing closing bracket — misspelled keyword — missing quotation mark
What is a logic error and give an example?
An error where the program runs but produces incorrect output — eg using > instead of >= causing a boundary to be missed — or an infinite loop due to the wrong condition
What is normal test data?
Data that is valid and within the expected range — should be accepted and processed correctly by the program — eg entering 5 for an input expecting a number between 1 and 10
What is boundary test data?
Data that is on the very edge of what is valid — tests the limits of the program — eg entering exactly 1 or exactly 10 for a range of 1 to 10 — should be accepted
What is invalid test data?
Data of the correct data type but outside the acceptable range — should be rejected by the program — eg entering 0 or 11 for a range of 1 to 10
What is erroneous test data?
Data of the completely wrong data type — should be rejected — eg entering "hello" for a field expecting an integer — tests type checking and validation
Create a test plan for a program that accepts ages between 0 and 120
Normal — enter 25 — expected: accepted. Boundary — enter 0 — expected: accepted. Boundary — enter 120 — expected: accepted. Invalid — enter -1 — expected: rejected. Invalid — enter 121 — expected: rejected. Erroneous — enter "hello" — expected: rejected