Eduqas A-Level Computer Science A500QS
Data Structures: Arrays, Records and Hash Tables
Stacks, Queues, Linked Lists and Trees
Boolean Logic and Simplification
Algorithms, Pseudo-Code and Programming Constructs
Variables, Scope, Parameters and Identifiers
Recursion and Modular Programming
Sorting Algorithms
Searching and Shortest-Path Algorithms
Big O Notation and Algorithm Efficiency
Validation, Verification and Testing
Data Compression
Programming Paradigms and Computer Languages
Systems Analysis, Maintenance and Documentation
System Design and Human-Computer Interaction
Software Engineering Tools and Translators
Computing, Society and the Law
Computer Architecture, the Processor and Assembly Language
Input, Output and Secondary Storage
Networks, Protocols and the Internet
Data Transmission and Network Performance
Number Systems and Binary Arithmetic
Data Types, Characters and Floating Point
Files, Records and File Organisation
Databases, Normalisation and Entity Modelling
SQL, Big Data and Distributed Systems
The Operating System and Its Modes
Interrupts, Memory Management and Scheduling
Types of Software System
Data Security, Cryptography and Attack
Validation, Verification and Testing
Implementing validation in an algorithm
- 3 things to know
- Component 1
Overview
Benefit of writing a validation check as a separate function, defensive programming and how a drop-down list reduces the need for validation code.
What you need to know
Answer each one before you reveal it.
Why is a post-conditioned loop a natural structure for validating input?
Explain the benefit of writing a validation check as a separate function.
Questions from this subtopic
Each one with the model answer underneath.
- 1
Write pseudo-code for a loop that keeps asking for an age until it lies between 0 and 120.
Model answer
The loop is REPEAT INPUT age UNTIL age ≥ 0 AND age ≤ 120. The program cannot continue until an acceptable value has been entered.
- 2
Why is a post-conditioned loop a natural structure for validating input?
Model answer
A post-conditioned loop always asks for the value once before testing it. The test then decides whether the question has to be repeated.
- 3
Explain the benefit of writing a validation check as a separate function.
Model answer
A function that returns TRUE or FALSE can be called from anywhere in the program. The same rule is then applied identically wherever that field is entered.
- 4
Write pseudo-code that rejects an empty name entry.
Model answer
The test is IF name = '' THEN OUTPUT 'Name required' ELSE store the record. An empty string is the value a presence check looks for.
- 5
How can a program stop a validation loop running forever?
Model answer
A counter can limit the number of retries allowed before the program gives up. The user is then returned to the menu instead of being trapped.
- 6
What is defensive programming?
Model answer
Defensive programming means writing code that expects invalid or hostile input at every entry point. Checks are placed on data before it is used rather than afterwards.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Validation, Verification and Testing, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.