Programming is the section where you stop talking about how computers work and start making them do things. If you have ever written a few lines of code and watched a program run for the first time, you already know the satisfaction this section builds on.

The edexcel igcse computer science programming section is the largest in the specification. It covers six topics: developing code, constructs, data types and structures, input and output, operators, and subprograms. Together, these form the practical toolkit you need for Paper 2 and the pseudocode questions on Paper 1. The programming edexcel igcse content is not about memorising syntax in a specific language; it is about understanding the concepts that underpin all programming languages.

These edexcel igcse computer science revision notes walk through each topic with examples, common mistakes and self-check questions. Whether you are comfortable with Python, C# or Java, the underlying principles tested in the 4CP0 qualification are the same.

Constructs: the three building blocks

Every program, no matter how complex, is built from three constructs: sequence, selection and iteration. The igcse 4cp0 programming specification expects you to use all three fluently.

Sequence means instructions run one after another, top to bottom. That sounds obvious, but it matters: the order of statements affects the result. Swapping two lines can change what a program outputs.

Selection means the program chooses which path to follow based on a condition. The simplest form is IF/ELSE:

INPUT age
IF age >= 18 THEN
    OUTPUT "You can vote"
ELSE
    OUTPUT "You cannot vote yet"
ENDIF

For multiple branches, use ELSE IF or a CASE/SWITCH statement. The exam might ask you to rewrite a chain of IF/ELSE IF statements as a CASE statement, or vice versa.

Iteration means repeating a block of code. There are two main forms:

  • Count-controlled loops (FOR loops) run a fixed number of times. Use these when you know in advance how many repetitions you need.
  • Condition-controlled loops (WHILE loops) run until a condition is met. Use these when the number of repetitions depends on user input or other runtime values.
// Count-controlled: print numbers 1 to 5
FOR i FROM 1 TO 5
    OUTPUT i
NEXT i

// Condition-controlled: keep asking until valid input
SET password TO ""
WHILE password != "secret123"
    INPUT password
ENDWHILE

Data types and structures

Choosing the right data type is a fundamental programming decision. The specification requires you to understand five basic data types:

Data typeWhat it storesExample
IntegerWhole numbers (no decimal point)42, -7, 0
Real (float)Numbers with a decimal point3.14, -0.5, 99.0
BooleanTRUE or FALSE onlyTRUE, FALSE
CharA single character'A', '7', '#'
StringA sequence of characters"Hello", "4CP0"

A common exam mistake is using the wrong data type. If a question asks for a price, use real (not integer, because prices have decimal places). If a question asks whether something is true or false, use Boolean (not a string containing "yes").

Variables and constants

A variable stores a value that can change during program execution. A constant stores a value that is fixed when the program starts and never changes. Use constants for values like VAT_RATE or MAX_ATTEMPTS; they make code easier to read and maintain because the value is defined in one place.

Global and local variables

A global variable is accessible from anywhere in the program. A local variable exists only inside the subprogram where it is declared. Best practice is to use local variables wherever possible, because they prevent accidental changes from other parts of the program. The exam frequently asks you to explain the advantage of local over global variables.

Data structures

Beyond single values, you need to understand three data structures:

  • One-dimensional arrays store a list of values of the same type, accessed by index. For example, scores[0], scores[1], scores[2].
  • Two-dimensional arrays store data in rows and columns, like a grid. For example, grid[2][3] accesses row 2, column 3.
  • Records group related data of different types. A student record might contain a string (name), an integer (age) and a Boolean (enrolled).

String manipulation

You should know how to find the length of a string, extract a substring, convert between uppercase and lowercase, and concatenate (join) strings. These operations appear regularly in Paper 2 tasks.

Operators

Operators are the symbols and keywords that perform operations on values. The specification groups them into three categories.

Arithmetic operators:

OperatorMeaningExampleResult
+Addition7 + 310
-Subtraction7 - 34
*Multiplication7 * 321
/Division7 / 32.33...
MODModulus (remainder)7 MOD 31
DIVInteger division7 DIV 32
MOD and DIV are the ones students mix up most. MOD gives the remainder after division (7 MOD 3 = 1 because 7 divided by 3 leaves a remainder of 1). DIV gives the whole-number part of the division (7 DIV 3 = 2 because 3 goes into 7 twice). A useful trick: MOD is commonly used to check if a number is even (number MOD 2 = 0 means even).

Relational operators compare two values and return TRUE or FALSE: equal to (=), less than (<), greater than (>), not equal to (!=), less than or equal to (<=), greater than or equal to (>=).

Logic operators combine Boolean expressions: AND (both must be true), OR (at least one must be true), NOT (reverses the value). For example: IF age >= 18 AND hasTicket = TRUE THEN checks two conditions simultaneously.

Input, output and validation

Programs need to communicate with users. INPUT reads data from the user; OUTPUT displays data to the user. The edexcel igcse computer science explained standard for input and output expects you to handle them cleanly, with appropriate prompts so the user knows what to enter.

Validation checks that input data is reasonable before the program uses it. Common validation techniques include:

  • Range check: is the value within an acceptable range? (e.g., age must be between 0 and 120)
  • Type check: is the value the expected data type? (e.g., rejecting letters when a number is expected)
  • Length check: is the input the right length? (e.g., a password must be at least 8 characters)
  • Presence check: has the user entered anything at all?
SET mark TO -1
WHILE mark < 0 OR mark > 100
    OUTPUT "Enter a mark between 0 and 100: "
    INPUT mark
ENDWHILE

File handling

You must be able to read from and write to text files. This is a common Paper 2 task. The basic operations are: open the file, read or write data, close the file.

// Writing to a file
OPEN "results.txt" FOR WRITING
WRITE "Student A: 85"
WRITE "Student B: 72"
CLOSE "results.txt"

// Reading from a file
OPEN "results.txt" FOR READING
WHILE NOT END_OF_FILE
    READ line
    OUTPUT line
ENDWHILE
CLOSE "results.txt"

Subprograms: procedures and functions

A subprogram is a named block of code that performs a specific task. There are two types:

  • A procedure performs an action but does not return a value. Think of it as a command: "do this thing."
  • A function performs an action and returns a value. Think of it as a question: "do this thing and tell me the answer."
// Procedure: displays a greeting
PROCEDURE greet(name)
    OUTPUT "Hello, " + name + "!"
ENDPROCEDURE

// Function: calculates the area of a rectangle
FUNCTION calculateArea(length, width)
    RETURN length * width
ENDFUNCTION

// Using them
CALL greet("Sam")
SET area TO calculateArea(5, 3)
OUTPUT area

Parameters are the values you pass into a subprogram. They allow the same code to work with different data. The exam will test whether you can write subprograms that accept parameters and, for functions, return meaningful results.

The benefits of subprograms include: code reuse (write once, call many times), easier testing (test each subprogram independently), and improved readability (a well-named subprogram tells the reader what it does).

Developing code: errors and testing

Writing a program that works first time is rare. The specification expects you to identify, locate and fix errors and to design test plans.

Three types of error:

Error typeWhen it occursExample
Syntax errorCode breaks the rules of the languageMissing bracket, misspelled keyword
Logic errorCode runs but produces the wrong resultUsing + instead of *, wrong loop condition
Runtime errorCode crashes during executionDivision by zero, accessing a non-existent file

Syntax errors are usually caught by the compiler or interpreter before the program runs. Logic errors are the hardest to find because the program runs without crashing but gives incorrect output. Runtime errors appear only when the program hits a specific condition during execution.

Test data comes in three types:

  • Normal data: valid input the program should handle correctly (e.g., entering 50 when the range is 0-100)
  • Boundary data: values at the edge of valid ranges (e.g., 0, 100, and values just outside like -1 and 101)
  • Erroneous data: invalid input the program should reject (e.g., entering "abc" when a number is expected)
Boundary testing catches the errors that normal testing misses. If your program accepts ages between 18 and 65, test with 17 (should be rejected), 18 (should be accepted), 65 (should be accepted), and 66 (should be rejected). Most logic errors hide at the boundaries.

Self-check questions

Test yourself with these edexcel igcse computer science practice questions before checking your edexcel igcse computer science notes:

  1. Write pseudocode for a function that takes an array of integers and returns the average.
  2. What is the difference between a procedure and a function? Give an example of when you would use each.
  3. A program stores the names and marks of 30 students. Which data structure would you use, and why?
  4. Identify the type of error in this pseudocode: SET total TO 0; FOR i FROM 1 TO 10; SET total TO total + 1; NEXT i; OUTPUT total (Hint: the output should be the sum of 1 to 10, not 10.)
  5. Write pseudocode that reads lines from a text file and counts how many lines contain the word "error".

Programming is the section that separates students who understand computer science from students who have memorised definitions. The exam rewards you for being able to write, read and debug code, not just for knowing what the words mean. Spend your revision time writing programs, tracing through unfamiliar code, and deliberately breaking things to see what happens. That hands-on experience is what carries you through both papers.

Descarga la aplicación en Google Playstore.

Todo lo que necesitas para destacar en JAMB, WAEC y NECO.

Green Bridge CBT Mobile App
Asistente de Chat de Aprendizaje Personalizado con IA
Miles de exámenes anteriores de IGCSE, JAMB, WAEC y NECO.
Más de 1200 notas de lecciones
Soporte sin conexión: Aprende en cualquier momento y lugar.
Horario del Puente Verde
Resúmenes de Literatura y Preguntas Potenciales
Controla tu rendimiento y progreso.
Explicaciones detalladas para un aprendizaje integral
Resumido.

Complete revision notes for edexcel igcse computer science programming: constructs, data types, operators, subprograms, file handling and debugging.