Skip to main content
EnglandComputer ScienceSyllabus dot point

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.

Generated by Claude Opus 4.811 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. String handling
  3. Input validation
  4. The Component 2 on-screen exam
  5. Try this

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

Sources & how we know this