Which term is the umbrella term for the considerations of anticipating misuse, authentication, input validation and maintainability?
Defensive design
What is meant by anticipating misuse?
Thinking ahead about the unexpected ways users might use a program, by accident or on purpose
Which term describes checking that data entered by a user is sensible and follows set rules before the program uses it?
Input validation
What is meant by authentication?
Confirming the identity of a user before allowing them to use a program or see its data
Which term describes how easy a program is to read, understand, fix and update, whether by the original programmer later or by someone else?
Maintainability
What is meant by sub programs?
Procedures or functions that each carry out one task and can be called where needed
Which term describes giving variables, constants and sub programs names that say what they hold or what they do?
Naming conventions
What is meant by indentation?
Spacing the lines inside a block inwards from the left
Which term describes the notes written into a program, starting with # in Python, that explain what a section of code does and are ignored when the program runs?
Commenting
What is meant by a program being robust?
It keeps working correctly and does not stop with an error however the user behaves
Which statement about input validation is correct?
Data that passes validation can still be wrong
A program asks for an age between 11 and 18. The user types 20. What should the program do?
Reject it, explain the problem and ask again
A program reads an age with int(input()) and makes no other checks. What happens if the user types fifteen?
The program stops running with an error
Why do programs that check a username and password limit the number of login attempts?
To stop someone guessing a password by trying many
Why does putting each task in a sub program make a program easier to maintain?
A change only has to be made in one place
Why should variables be given meaningful names such as totalCost or radius?
So readers can tell what each one holds
In Python, why is the indentation inside a loop or selection essential?
It shows which lines are part of the same block
Why is commenting useful in a program?
It explains what a section of code does
A program asks how many tickets a user wants. The user types minus three, and the program crashes when it works out the total. What has the programmer failed to do?
Plan for all the likely input values
Why do login programs show the same message whether the username or the password is wrong?
So nobody can tell which part was guessed correctly
What is a likely result of a program that has no defensive design?
It stores data that is not valid
A program asks for a phone number. A user presses Enter without typing anything. How should the program deal with this?
Treat it as invalid and ask the user to enter it again
A program asks for a UK mobile number, which must be exactly 11 digits with no spaces. Which entered value should the program accept?
07900123456
Why should a program validate input even when the people using it are trusted?
Users can still enter values the program does not expect
Why should a message telling a user their input was invalid say what the program expected?
So the user can enter an acceptable value next time
A programmer has written the username and password that the program checks directly into the code. Why is this poor practice?
Anyone who reads the code can see the password
Which term describes a mistake that breaks the grammatical rules of a programming language and stops the program being run?
Syntax error
What is meant by a logic error?
A mistake in a program that lets it run but makes it produce unexpected output
What is meant by iterative testing?
Testing each module as it is written, fixing any errors and then testing it again
Which term describes checking a complete program at the end of production to make sure all its parts work together?
Final testing
What is meant by normal test data?
Data that should be accepted by a program without causing any errors
What is meant by boundary test data?
Data of the correct type on the very edge of the valid range
Which term describes values of the correct type that should be rejected because they are outside the range the program allows?
Invalid test data
Which term describes values of the wrong type that should be rejected by a program?
Erroneous test data
Which term describes the document prepared before a program is checked that lists every check to be carried out, with the values to use and the expected result for each?
Test plan
What is meant by refining an algorithm after testing?
Fixing an error that a failed test has revealed and then running the same test again
What is the main purpose of testing a program?
To find errors so that they can be fixed
Which of these mistakes is a syntax error?
Using = instead of == in an if statement
A username must be 6 to 14 characters long. Which data is boundary test data?
A username of 6 characters and one of 14 characters
A test plan includes a test that enters the text 'fifty' where a whole number is expected. What is the expected result?
An error message is shown and the text is rejected
A program should print Pass for marks of 50 or more, but it prints Fail for a mark of 50. Which change fixes the logic error?
Change mark > 50 to mark >= 50
A program accepts a whole number from 1 to 10. Which input is invalid test data?
0
Every module of a program is tested as it is written and each one works correctly on its own. Why is final testing still needed?
To check that the modules work correctly together
Which column of a test plan records what the program did when a test was carried out?
Actual result
Why is a program tested with invalid and erroneous data as well as with normal data?
To check it copes with unexpected input without crashing
A programmer fixes an error found by a test and reruns that test, which now passes. What should the programmer do next?
Rerun all of the earlier tests as well
A program passes every test in its test plan. What does this show?
It worked for the data that was tested
A program accepts a whole number from 1 to 20. Which set of test data contains one item of each type: normal, boundary, invalid and erroneous?
0, 5, 20 and Ten
Why is a test plan written before a program is tested?
So that no part of the program is missed
A program asks for a pupil's age as a whole number from 11 to 18. Which item of test data should be used to check that the program rejects the wrong type of data?
Sixteen
A test plan shows an expected result of Pass, but when the test is run the actual result is Fail. What does this show?