How do you work with text in a program, and how do you validate input in the on-screen exam?
String handling (length, indexing, substrings, concatenation, case conversion), input validation (presence, range, length, type and format checks), and how programs are written and tested in the Component 2 on-screen exam.
An Eduqas GCSE Computer Science answer on string handling (length, indexing, substrings, concatenation, case conversion), input validation (presence, range, length, type, format), and how programs are written, tested and refined in the Component 2 on-screen exam.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
Eduqas wants you to handle strings (length, indexing, substrings, concatenation and case conversion), perform input validation (presence, range, length, type and format checks), and understand how programs are written, tested and refined in the Component 2 on-screen exam. Validation loops and string extraction are common on-screen tasks.
String handling
name = "Ada Lovelace"
output length(name) // 12
output name[0] // "A"
greeting = "Hi " + name // "Hi Ada Lovelace"
Input validation
The Component 2 on-screen exam
Component 2 (Computer Programming) is an on-screen exam: you work at a computer in your centre's chosen high-level language (such as Python or C#). The tasks ask you to write programs from a specification, complete or correct partly written code, and trace what code does. You then run and test your programs using test data: normal data (typical, valid values), boundary data (values at the edge of what is allowed, such as 1 and 10 for a 1-to-10 range) and erroneous data (invalid values that should be rejected). You refine the program based on the results, fixing errors so it meets the requirements. This is why string handling, validation and the three constructs all matter: they are the tools you apply live in the exam.
Try this
Q1. Name the string operation that joins two strings together. [1 mark]
- Cue. Concatenation.
Q2. State which validation check ensures a value is within allowed limits. [1 mark]
- Cue. A range check.
Q3. Name the three kinds of test data used in the on-screen exam. [1 mark]
- Cue. Normal, boundary and erroneous.
Exam-style practice questions
Practice questions written in the style of WJEC Eduqas exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
Eduqas Component 2, 20225 marksA program asks for a user's age and must only accept a whole number between 11 and 18. Describe the validation needed and write an algorithm that keeps asking until a valid age is entered.Show worked answer →
Validation needed (up to 2 marks): a range check (the value must be between 11 and 18 inclusive) and a type check (it must be a whole number), so invalid entries are rejected.
Algorithm (up to 3 marks): read the age inside a condition-controlled loop that repeats while the value is outside the range, re-prompting each time.
age = input("Enter age: "); while age < 11 OR age > 18; output "Invalid"; age = input("Enter age: "); endwhile.
Marks: correct condition (1), loop that re-asks (1), accepts only valid values (1). Markers reward a loop that cannot be left until the input is valid.
Eduqas Component 2, 20234 marksA program stores a full name as one string. Describe how string-handling operations could extract the first name and convert it to uppercase.Show worked answer →
Find the position of the space using a search operation, then take the substring from the start up to that position to get the first name (up to 2 marks).
Apply a case-conversion operation to change the first name to uppercase, for example an upper-case function (up to 2 marks).
Markers reward using length/index/substring to locate and extract the first name and a case-conversion operation. Just saying "split the string" without the substring/index detail is weaker.
Related dot points
- The purpose and functions of an operating system (memory management, multitasking, peripheral management, the user interface, and security and user management) and the role of common utility software.
An Eduqas GCSE Computer Science answer on the purpose and functions of an operating system (memory management, multitasking, peripheral management, the user interface, security and user management) and the role of common utility software.
- High-level and low-level languages, machine code and assembly language, the three translators (compiler, interpreter and assembler), and the features of an integrated development environment (IDE).
An Eduqas GCSE Computer Science answer on high-level versus low-level languages, machine code and assembly, the three translators (compiler, interpreter, assembler) with their differences, and the features of an integrated development environment.
- Variables and constants, the common data types (integer, real, Boolean, character, string), and the arithmetic, relational and logical operators used in programs.
An Eduqas GCSE Computer Science answer on variables and constants, the common data types (integer, real, Boolean, character, string), and the arithmetic, relational and logical operators, including integer division and modulus.
- The three programming constructs: sequence, selection (if and nested if) and iteration (count-controlled and condition-controlled loops), and when to use each.
An Eduqas GCSE Computer Science answer on the three programming constructs: sequence, selection (if, else, nested if) and iteration (count-controlled for loops and condition-controlled while loops), with worked pseudocode for each.
- Arrays as a data structure: declaring and using one-dimensional arrays, accessing elements by index, and iterating through an array with a loop, with awareness of two-dimensional arrays.
An Eduqas GCSE Computer Science answer on arrays as a data structure: declaring and using one-dimensional arrays, accessing elements by index, iterating through an array with a loop, and awareness of two-dimensional arrays.
Sources & how we know this
- WJEC Eduqas GCSE Computer Science specification (from 2016) — Eduqas (2020)