What is the difference between a syntax error and a logic error?
easyWhat is a runtime error?
easyA programmer writes: IF x = 5 THEN (missing the closing keyword ENDIF). What type of error is this?
easyA program is designed to calculate the average of three numbers but instead divides the total by 2. The program runs without crashing but gives incorrect results. What type of error is this?
mediumWhy are logic errors often harder to detect than syntax errors?
mediumA program attempts to open a file that does not exist, causing the program to crash with an error message. What type of error has occurred?
mediumWhich type of error would prevent a program from being run/compiled at all?
easyA program calculates BMI using the formula weight / height (missing the squaring of height). The program runs and gives an output, but the BMI values are incorrect. Classify this error and explain why.
mediumA user enters a non-numeric value into a program that then tries to perform a calculation with it, causing the program to crash. What type of error is this, and how could it be prevented?
hardExplain the difference between an error that occurs when a program is run (runtime error) and one that prevents the program from running at all (syntax error).
mediumWhat is the difference between validation and verification?
mediumGive THREE types of validation check with an example of each.
mediumA form requires a user to enter their date of birth. Which validation check would ensure the field has not been left blank?
easyA program requires a UK phone number to be entered as exactly 11 digits. Which validation check would be used to ensure this?
easyA program asks the user to enter a percentage, which must be between 0 and 100. The user enters 150. Which validation check would detect this as invalid?
easyExplain why input validation cannot guarantee that data is correct (accurate), only that it is reasonable.
hardA program expects the user to enter a whole number for "quantity", but the user types "five". Which validation check would catch this error?
easyWrite pseudocode for an input validation loop that repeatedly asks the user to enter a number between 1 and 10 until a valid value is entered.
mediumA user must enter an email address containing an "@" symbol. Which type of validation check is most appropriate?
mediumExplain why applying input validation as early as possible (e.g. immediately after data entry) is good practice in program design.
mediumWhat is black-box testing?
easyWhat is white-box testing?
easyA tester checks that entering a username and password on a login form correctly logs the user in or shows an error, without looking at the underlying code. What type of testing is this?
easyA developer writes a test that specifically checks that every branch of an IF/ELSE statement in their code is executed at least once. What type of testing is this?
mediumWhich of the following is an advantage of black-box testing over white-box testing?
mediumExplain why white-box testing might find errors that black-box testing would miss.
hardA company hires an external tester who has no access to the source code and is simply asked to use the finished application and report any issues. What type of testing is this an example of?
easyGive one example of a white-box testing technique.
mediumA program has a function that should return "Pass" for marks >= 40 and "Fail" otherwise. A black-box test checks inputs of 39 and 40 and confirms the correct outputs are returned. Is this testing the internal code structure?
mediumExplain why a combination of both black-box and white-box testing is often used when testing software.
hardWhat is the purpose of testing?
easyWhat are the three categories of test data?
easyA program accepts ages between 1 and 100. Give an example of normal, boundary, and erroneous test data.
mediumWhat is the purpose of a test plan?
easyA test plan table typically includes columns for test data, expected result, and what other column?
easyWhat is defensive design?
mediumWhat is input sanitisation and why is it important for security?
mediumDescribe how exception handling improves programme robustness and give an example.
mediumWhat is "anticipation of misuse" as a defensive design technique?
mediumA program reads a number entered by the user and divides 100 by it. What defensive programming technique would prevent a crash if the user enters 0?
mediumExplain how using a maximum length restriction on a text input field is an example of defensive programming.
mediumWhich of the following is an example of a defensive programming technique?
easyExplain why defensive programming techniques are particularly important for programs that accept input directly from members of the public.
hardA program is designed to read 10 numbers from a file into an array of size 10. What defensive technique should be used in case the file actually contains more or fewer than 10 numbers?
hardGive two examples of defensive design techniques that could be used together in a single program to handle unexpected input robustly.
mediumWhy is code maintainability important in software development?
easyExplain why using meaningful variable names improves code quality, with an example.
easyState three benefits of a modular approach to software design.
mediumWhat is test-driven development (TDD) and what is the correct order of steps?
hardExplain why code review is a good practice and state two things a reviewer should check.
mediumWhat is the purpose of consistent indentation in program code?
easyGive two examples of "naming conventions" a programmer might follow when naming variables.
easyA program contains the comment: "# This loop adds up all the values in the scores array and stores the result in total". What is the purpose of this comment?
easyExplain how poor indentation in a program with nested IF statements and loops could make the code harder to maintain, even if the program runs correctly.
mediumWhich of the following sets of variable names follows good naming convention practice for readability?
easyA programmer is asked to update code they wrote two years ago, but it has no comments, inconsistent indentation, and variables named a, b, and temp1. Explain why this would make the update more time-consuming.
mediumWhich of these is NOT typically considered a maintainability feature?
easyExplain how breaking a program into well-named procedures/functions (rather than one long block of code) improves maintainability.
mediumA team of programmers agrees that all Boolean variables in their project will be named starting with "is" or "has" (e.g. isValid, hasPermission). What is this an example of?
mediumExplain why maintainability is especially important for software that is expected to be used and updated for many years.
hardA test plan includes the column headings: Test number, Purpose, Test data, Expected result, Actual result. Why is it useful to include "Expected result" alongside "Actual result"?
mediumA program validates that a password must be between 8 and 16 characters long. Which of the following is a boundary test data value?
mediumDesign a test plan entry (test data and expected result) to check that a program correctly rejects invalid (erroneous) input for a field that must contain a whole number between 1 and 6 (e.g. a dice value).
mediumWhy should a thorough test plan include normal, boundary, AND erroneous test data, rather than just normal data?
mediumA program asks for a student's exam mark out of 100. Complete a test plan row for testing with the erroneous value -10, including the expected result.
medium