2.3 robust programs

Cards (39)

  • What is the main purpose of testing a program?
    To ensure that a program works correctly regardless of user input
  • What are the key considerations for creating a secure and robust program?
    • Anticipating misuse
    • Input sanitisation
    • Validation
    • Verification
    • Authentication
    • Maintainable code
  • Why is it important to test a program?
    To ensure user requirements are met, errors are removed, and the program doesn't crash
  • What does anticipating misuse involve in defensive design?
    Planning ahead to take steps against potential misuse
  • What are the two types of testing mentioned?
    • Iterative Testing
    • Final Testing
  • What occurs during iterative testing?
    The programmer develops a module, tests it, and repeats until it works as expected
  • What is input sanitisation in programming?
    Checking and cleaning up data that has been input
  • What is final testing also known as?
    Terminal testing
  • When does final testing take place?
    After development and before the program is released to the end user
  • What is the purpose of validation in programming?
    To check whether input data follows specific criteria
  • What is a syntax error?
    A mistake in the grammatical rules of the programming language
  • What does verification check in a program?
    Whether data that has been entered is correct
  • What happens when a syntax error occurs?
    The program cannot be compiled and executed
  • What is authentication in the context of programming?
    Ensuring only authorised users can gain access to a system
  • Give an example of a syntax error.
    Incorrect spelling: pront("hello")
  • What does maintainable code allow other programmers to do?
    Read and quickly understand code that has been written
  • What is a logical error?
    A mistake made by the programmer that causes incorrect output
  • What are the types of validation checks mentioned in the study material?
    • Range Check
    • Type Check
    • Format Check
    • Presence Check
    • Lookup Table
    • Length Check
  • What does a range check verify?
    That data is within a certain range
  • What is the outcome of a logical error?
    The program runs without crashing but displays the wrong output
  • What does a type check ensure?
    That data is a certain data type
  • What is a format check used for?
    To ensure data is entered in a certain way
  • Give an example of a logical error.
    Incorrect calculation: total = num1 - num2
  • What does a presence check confirm?
    That data has actually been entered and not left blank
  • What is test data used for?
    • To test whether a program is functioning correctly
    • Should cover a range of possible and incorrect inputs
    • Designed to prove a program works or highlight flaws
  • What is a lookup table in programming?
    A table of acceptable entries, also known as a list
  • What does a length check verify?
    That the length of the input is within a certain amount
  • What are the four types of test data?
    1. Normal data - Sensible data the program should accept
    2. Boundary data - Data at the extreme boundary of data ranges
    3. Invalid data - Correct data type that does not meet validation rules
    4. Erroneous data - Wrong data type that the program cannot process
  • What are the examples of making a program maintainable?
    • Using subprograms for code reuse
    • Appropriate variable names
    • Using indentation for readability
    • Adding comments for understanding
    • Using constants for consistency
  • What is normal data in testing?
    Sensible data that the program should accept and process
  • What is modularisation in programming?
    Using subprograms to reuse code and make it easier to test
  • What is boundary data?
    Data at the extreme boundary of any data ranges
  • Why are appropriate variable names important in programming?
    They ensure the purpose of a variable is immediately understood
  • What is invalid data?
    Data of the correct type that does not meet validation rules
  • How does indentation improve code readability?
    It clearly shows each ‘block’ of code
  • What is erroneous data?
    Data of the wrong data type that the program cannot process
  • What is the purpose of comments in code?
    To enable a programmer to understand the purpose of each line of code
  • Why is using constants beneficial in programming?
    It keeps the program code consistent, making it easier to read and debug
  • What are the questions related to Defensive Design in the study material?
    1. Describe the different considerations a programmer should make for a defensive design.
    2. Describe each validation check and give a suitable example.
    3. Explain the different ways a program can be maintained.