What you'll learn
This revision guide covers the fundamental concepts of data representation and manipulation in programming, aligned precisely with the Pearson Edexcel International IGCSE Computer Science specification. You'll understand data types, structures, validation techniques, and how programs store and process information. These concepts form the foundation for algorithm design and practical programming tasks in your examination.
Key terms and definitions
Data type — the classification of data that determines what values it can hold and what operations can be performed on it (e.g. integer, real, Boolean, character, string)
Variable — a named storage location in memory that holds a value which can change during program execution
Constant — a named storage location whose value is set once and cannot be changed during program execution
Array — a data structure that stores multiple values of the same data type under a single identifier, accessed using an index
Validation — the process of checking that data meets certain criteria before it is accepted by a program
Type conversion — the process of converting data from one type to another (also called casting)
String manipulation — operations performed on string data such as concatenation, substring extraction, and length calculation
Record — a data structure that groups together related data items of different types under a single identifier
Core concepts
Data types in programming
Programming languages use different data types to represent different kinds of information efficiently. Understanding which data type to use is crucial for writing effective programs.
Primitive data types:
- Integer — whole numbers without decimal points (e.g. -5, 0, 42, 1000). Used for counting, indexing arrays, and representing discrete quantities
- Real/Float — numbers with decimal points (e.g. 3.14, -0.5, 2.0). Used for measurements, calculations requiring precision, and scientific data
- Boolean — logical values that can only be TRUE or FALSE. Used for flags, conditions, and control flow
- Character — single alphanumeric symbols (e.g. 'A', '7', '$'). Stored using ASCII or Unicode values
- String — sequences of characters treated as a single unit (e.g. "Hello", "CS2024"). Used for text, names, addresses
Choosing appropriate data types:
The selection of data type affects memory usage, processing speed, and program accuracy. For example:
- A student's age should be stored as an integer (not real) because ages are whole numbers
- A product price requires a real number to store pence/cents accurately
- A yes/no response should use Boolean type for efficiency
- A postcode/ZIP code should be a string (even if it contains only digits) because mathematical operations aren't needed
Variables and constants
Variables provide temporary storage for data that changes during program execution. The name should be meaningful (e.g. totalScore, studentName) and follow naming conventions.
Declaration and assignment:
Variables must typically be declared before use, specifying the identifier and data type:
INTEGER age
REAL temperature
STRING surname
BOOLEAN isPassed
Assignment gives a variable its value:
age ← 16
temperature ← 23.5
surname ← "Richards"
isPassed ← TRUE
Constants store values that remain fixed throughout program execution. Using constants improves code readability and maintainability:
CONSTANT INTEGER PASS_MARK = 40
CONSTANT REAL PI = 3.14159
CONSTANT REAL VAT_RATE = 0.20
Constants prevent accidental modification of important values and make updates easier (change one constant definition rather than multiple occurrences throughout the code).
Arrays and data structures
An array is a structured collection of elements sharing the same data type, accessed via an index position.
One-dimensional arrays:
Arrays store multiple related values under one identifier:
DECLARE scores[10] : INTEGER
DECLARE names[5] : STRING
Array elements are accessed using an index (usually starting from 0):
scores[0] ← 85
scores[1] ← 92
studentName ← names[3]
Two-dimensional arrays:
These represent data in rows and columns, useful for tables, grids, and matrices:
DECLARE salesData[4][12] : REAL // 4 regions, 12 months
DECLARE seatingPlan[8][10] : STRING // 8 rows, 10 seats
Accessing elements requires two indices:
salesData[2][5] ← 15420.50 // Region 2, Month 5
studentSeat ← seatingPlan[3][7] // Row 3, Seat 7
Records:
A record groups related data items of different types. For example, student information:
RECORD Student
STRING studentID
STRING fullName
INTEGER yearGroup
REAL averageScore
ENDRECORD
Records are accessed using dot notation:
Student1.studentID ← "CS2024-156"
Student1.fullName ← "Amara Johnson"
Student1.yearGroup ← 11
Student1.averageScore ← 87.5
String manipulation
Strings require specific operations different from numeric data types:
Common string operations:
Length — returns the number of characters in a string
LENGTH("Computer") returns 8Concatenation — joining strings together
"Hello" + " " + "World" produces "Hello World" firstName + surname produces full nameSubstring — extracting part of a string
SUBSTRING("Programming", 0, 4) returns "Prog" SUBSTRING(postcode, 0, 3) extracts area codeCharacter position — finding where a character occurs
POSITION("@", email) returns index of @ symbolCase conversion — changing to upper or lower case
UPPER("hello") returns "HELLO" LOWER("WORLD") returns "world"
These operations are essential for processing user input, formatting output, and data validation.
Data validation techniques
Validation ensures data entered into a program meets specified criteria, preventing errors and maintaining data integrity.
Validation checks:
Range check — ensures a value falls within acceptable limits
IF age >= 14 AND age <= 18 THEN // Valid IGCSE student ageLength check — verifies string length is appropriate
IF LENGTH(password) >= 8 THEN // Sufficient password lengthPresence check — ensures required data is provided (not empty)
IF surname <> "" THEN // Name has been enteredType check — confirms data matches expected type
IF ISNUMERIC(input) THEN // Can safely convert to numberFormat check — verifies data follows required pattern
IF SUBSTRING(email, 0, 1) <> "@" AND POSITION("@", email) > 0 THEN // Basic email format validationLookup check — matches input against permitted values
validGrades ← ["A", "B", "C", "D", "E", "U"] IF grade IN validGrades THEN // Valid examination grade
Validation vs verification:
Validation checks if data is reasonable and follows rules. Verification checks if data has been accurately entered (e.g. double-entry, visual confirmation). Both are important but serve different purposes.
Type conversion and casting
Type conversion (casting) changes data from one type to another, necessary when performing operations requiring compatible types.
Common conversions:
String to Integer:
userInput ← "42" age ← INT(userInput) // Converts "42" to 42String to Real:
priceText ← "19.99" price ← REAL(priceText) // Converts to 19.99Integer to String:
score ← 85 message ← "Your score is " + STR(score)Real to Integer:
average ← 87.6 rounded ← INT(average) // Results in 87 (truncation)
Type conversion issues:
Be aware that converting from real to integer loses decimal precision through truncation. Converting incompatible strings (e.g. "Hello" to integer) causes errors and requires validation first.
Worked examples
Example 1: Array processing with validation
Question: A program stores the test scores for 5 students in an array. Write pseudocode that:
- Declares an appropriate array
- Inputs the 5 scores with range validation (0-100)
- Calculates and outputs the average score
(6 marks)
Solution:
DECLARE scores[5] : INTEGER
DECLARE total, average : REAL
DECLARE i : INTEGER
total ← 0
FOR i ← 0 TO 4
REPEAT
OUTPUT "Enter score for student ", i+1, ":"
INPUT scores[i]
UNTIL scores[i] >= 0 AND scores[i] <= 100
total ← total + scores[i]
ENDFOR
average ← total / 5
OUTPUT "Average score: ", average
Mark scheme points:
- Correct array declaration with appropriate size and type (1 mark)
- Loop to input 5 values (1 mark)
- Range validation check 0-100 (1 mark)
- Accumulation of total (1 mark)
- Average calculation dividing by 5 (1 mark)
- Output of average (1 mark)
Example 2: String manipulation and record structure
Question: A library system stores book information using a record structure containing: ISBN (string), Title (string), YearPublished (integer), and IsAvailable (Boolean).
(a) Write pseudocode to declare this record structure. (2 marks)
(b) Write pseudocode to create a book record with ISBN "978-0-123456-78-9", title "Computer Science Fundamentals", published 2023, and currently available. (2 marks)
(c) The system needs to extract the publisher code (characters 7-9) from the ISBN. Write pseudocode to do this. (2 marks)
Solution:
(a)
RECORD Book
STRING ISBN
STRING Title
INTEGER YearPublished
BOOLEAN IsAvailable
ENDRECORD
(b)
Book1.ISBN ← "978-0-123456-78-9"
Book1.Title ← "Computer Science Fundamentals"
Book1.YearPublished ← 2023
Book1.IsAvailable ← TRUE
(c)
publisherCode ← SUBSTRING(Book1.ISBN, 6, 3)
OUTPUT publisherCode
Mark scheme points:
- (a) Correct record structure with all four fields and correct types (2 marks)
- (b) All four fields assigned correct values using dot notation (2 marks)
- (c) Correct use of SUBSTRING with appropriate parameters (2 marks)
Example 3: Data validation and type conversion
Question: A program asks users to enter their age. Write pseudocode that:
- Inputs the age as a string
- Validates it contains only numeric characters
- Converts it to an integer
- Performs a range check (must be between 14 and 19)
- Outputs an appropriate message
(5 marks)
Solution:
DECLARE ageInput : STRING
DECLARE age : INTEGER
DECLARE valid : BOOLEAN
valid ← FALSE
REPEAT
OUTPUT "Enter your age:"
INPUT ageInput
IF ISNUMERIC(ageInput) THEN
age ← INT(ageInput)
IF age >= 14 AND age <= 19 THEN
valid ← TRUE
OUTPUT "Age accepted"
ELSE
OUTPUT "Age must be between 14 and 19"
ENDIF
ELSE
OUTPUT "Please enter numbers only"
ENDIF
UNTIL valid = TRUE
Mark scheme points:
- Input as string (1 mark)
- Type check using ISNUMERIC or equivalent (1 mark)
- Conversion to integer (1 mark)
- Range validation 14-19 (1 mark)
- Appropriate error messages/loop structure (1 mark)
Common mistakes and how to avoid them
Confusing data types — Students often use real numbers where integers are appropriate (e.g. storing number of students as 25.0 instead of 25). Always choose the most appropriate type: whole numbers → integer, measurements → real, text → string, yes/no → Boolean
Array index errors — Forgetting that arrays typically start at index 0, not 1. An array declared as
scores[10]has indices 0-9, not 1-10. Always check loop bounds carefullyMissing validation — Accepting user input without checks leads to program crashes. Always validate before processing, especially when converting types or performing calculations
Incorrect string operations — Using arithmetic operators on strings when concatenation is needed, or vice versa. Remember:
"5" + "3"produces"53"(concatenation), not8(addition)Constants vs variables — Declaring values as variables when they should be constants (e.g.
PI,VAT_RATE,PASS_MARK). Use constants for values that never change to prevent accidental modificationLosing precision in conversions — Converting real to integer without understanding truncation.
INT(87.9)becomes87, not88. Use appropriate rounding functions if needed
Exam technique for "Problem-Solving and Programming: Data"
Command word recognition — "Declare" requires you to specify data type and identifier. "State" needs only the answer. "Write pseudocode" requires structured code using specification notation, not prose description. Always match your answer format to the command word
Show data type explicitly — When declaring variables or arrays, always include the data type (
INTEGER,REAL,STRING,BOOLEAN). Examiners cannot assume your intentionPartial marks available — Multi-mark questions award points for each correct element. Even if your overall solution has errors, correct validation, type conversion, or loop structure earns marks. Attempt all parts
Use specification pseudocode conventions — Follow Pearson Edexcel pseudocode standards:
←for assignment,DECLAREfor variables, correct array syntax with square brackets. Marks may be lost for non-standard notation
Quick revision summary
Data types (integer, real, Boolean, character, string) determine what values can be stored and operations performed. Variables hold changing values; constants store fixed values. Arrays group multiple elements of the same type; records combine different types. String manipulation includes concatenation, substring, and length operations. Validation checks ensure data meets criteria through range, length, presence, type, format, and lookup checks. Type conversion changes data between types but may lose precision. Always choose appropriate data types, validate input, and use correct pseudocode syntax in examinations.