Kramizo
Log inSign up free
HomeWJEC GCSE Computer ScienceProgramming: Concepts and Constructs
WJEC · GCSE · Computer Science · Revision Notes

Programming: Concepts and Constructs

1,777 words · Last updated July 2026

Ready to practise? Test yourself on Programming: Concepts and Constructs with instantly-marked questions.
Practice now →
Quick answer

Programming concepts form the foundation of all computer programs. Variables store data of specific types (integer, real, Boolean, character, string) while constants hold fixed values. Selection statements (if/elif/else) control program flow using conditions and comparison operators. Iteration repeats code using for loops (known repetitions) or while loops (condition-based repetitions). Arrays store multiple values accessed by index position. String manipulation uses built-in operations like upper(), lower() and slicing. Master these constructs and you'll be able to write, trace and debug programs confidently in your WJEC exam.

What you'll learn

This guide covers the fundamental programming concepts you need for WJEC GCSE Computer Science. You'll learn how to use variables, data types, selection statements, iteration and data structures to write effective programs. These concepts apply whether you're coding in Python, C# or another language specified by WJEC.

Key terms and definitions

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

Iteration — the process of repeating a block of code multiple times using loop structures

Selection — choosing which code to execute based on whether a condition evaluates to true or false

Assignment — giving a value to a variable using the assignment operator (= in most languages)

Data type — defines what kind of data a variable can store (integer, real, Boolean, character, string)

Array — a data structure that stores multiple values of the same data type under a single identifier

Index — the position number used to access an element in an array or string (usually starting from 0)

Core concepts

Variables and data types

Variables must be declared and assigned values before use. Different programming languages handle this differently, but the principle remains the same.

Integer stores whole numbers (positive or negative):

  • Examples: 42, -17, 0
  • Use for: counting, indexing, whole number calculations

Real/Float stores decimal numbers:

  • Examples: 3.14, -0.5, 2.0
  • Use for: measurements, scientific calculations, currency

Boolean stores only True or False:

  • Use for: flags, conditions, yes/no states

Character stores a single letter, digit or symbol:

  • Examples: 'A', '7', '!'
  • Must use single quotes in most languages

String stores sequences of characters:

  • Examples: "Hello", "WJEC2024", "Kingston, Jamaica"
  • Use for: names, addresses, messages

When you assign a value to a variable, the data type must match what the variable expects. Type conversion (casting) changes data from one type to another:

age = "16"              # String
ageInt = int(age)       # Convert to integer
price = 19.99           # Real
priceStr = str(price)   # Convert to string

Constants and why they matter

Constants prevent accidental changes to important values. They make code easier to maintain because you only need to change the value in one place.

VAT_RATE = 0.20         # By convention, use CAPITALS
PI = 3.14159
MAX_STUDENTS = 30

If VAT changes from 20% to 15%, you only change one line instead of searching through hundreds of lines of code.

Selection statements

Selection controls program flow based on conditions. The condition always evaluates to True or False.

If statements execute code only when a condition is true:

if temperature > 30:
    print("Heat warning in effect")

If-else statements provide an alternative action:

if age >= 18:
    print("You can vote")
else:
    print("Too young to vote")

If-elif-else statements check multiple conditions in sequence:

if score >= 70:
    grade = "A"
elif score >= 60:
    grade = "B"
elif score >= 50:
    grade = "C"
else:
    grade = "Fail"

Comparison operators used in conditions:

  • == equal to
  • != not equal to
  • > greater than
  • < less than
  • >= greater than or equal to
  • <= less than or equal to

Logical operators combine multiple conditions:

  • AND — both conditions must be true
  • OR — at least one condition must be true
  • NOT — reverses the Boolean value
if age >= 16 AND age < 18:
    print("You can get a part-time job")

if country == "UK" OR country == "Jamaica":
    print("English speaking nation")

Iteration (loops)

Iteration repeats code until a condition is met or a specific number of times.

For loops repeat a known number of times:

for i in range(5):
    print(i)            # Prints 0, 1, 2, 3, 4

for name in ["Sarah", "Marcus", "Priya"]:
    print("Welcome", name)

Use for loops when you know how many iterations you need.

While loops repeat while a condition remains true:

password = ""
while password != "secure123":
    password = input("Enter password: ")

count = 0
while count < 10:
    print(count)
    count = count + 1

Use while loops when the number of iterations depends on user input or changing conditions.

Nested loops place one loop inside another:

for row in range(3):
    for col in range(4):
        print("*", end="")
    print()

This produces a 3×4 grid of asterisks. The inner loop completes all iterations before the outer loop moves to its next iteration.

Arrays and lists

Arrays (called lists in Python) store multiple values under one variable name. Each element has an index position.

scores = [45, 67, 89, 72, 91]

Accessing elements uses square brackets with the index:

firstScore = scores[0]      # 45 (arrays start at index 0)
lastScore = scores[4]       # 91
scores[2] = 95              # Changes third element to 95

Array operations:

scores.append(88)           # Add element to end
length = len(scores)        # Get number of elements
scores.sort()               # Sort in ascending order

Traversing arrays means processing each element:

# Using a for loop
for score in scores:
    print(score)

# Using a while loop with index
i = 0
while i < len(scores):
    print(scores[i])
    i = i + 1

2D arrays store data in rows and columns like a table:

classroom = [
    ["Sarah", "Marcus", "Priya"],
    ["James", "Aisha", "Chen"],
    ["Kwame", "Leila", "Tom"]
]

# Access row 0, column 1
student = classroom[0][1]   # "Marcus"

String manipulation

Strings are sequences of characters. You can access individual characters using indices.

name = "Kingston"
firstChar = name[0]         # "K"
length = len(name)          # 8

String operations:

message = "Hello"
upper = message.upper()         # "HELLO"
lower = message.lower()         # "hello"
substring = message[1:4]        # "ell" (from index 1 to 3)

String concatenation joins strings together:

firstName = "Marcus"
surname = "Brown"
fullName = firstName + " " + surname    # "Marcus Brown"

Finding substrings:

email = "student@school.edu"
position = email.find("@")              # Returns 7
if "@" in email:
    print("Valid email format")

Worked examples

Example 1: Validation using selection and iteration

Question: Write a program that asks the user to enter a number between 1 and 10. The program should keep asking until a valid number is entered. [4 marks]

Solution:

number = 0
while number < 1 or number > 10:
    number = int(input("Enter a number between 1 and 10: "))
print("Valid number entered")

Mark scheme:

  • 1 mark: initialising variable or setting up while loop
  • 1 mark: correct condition using logical OR
  • 1 mark: converting input to integer
  • 1 mark: output when valid number entered

Example 2: Processing arrays

Question: A teacher stores five test scores in an array. Write code to: (a) Calculate and display the total of all scores [2 marks] (b) Find and display the highest score [2 marks]

Solution:

scores = [67, 82, 91, 74, 88]

# Part (a)
total = 0
for score in scores:
    total = total + score
print("Total:", total)

# Part (b)
highest = scores[0]
for score in scores:
    if score > highest:
        highest = score
print("Highest:", highest)

Mark scheme (a):

  • 1 mark: initialising total variable
  • 1 mark: correct loop to add all elements

Mark scheme (b):

  • 1 mark: initialising highest to first element
  • 1 mark: correct comparison logic in loop

Example 3: Nested selection

Question: A cinema charges different prices based on age:

  • Under 12: £5.00
  • 12-17: £7.50
  • 18-64: £10.00
  • 65 and over: £6.50

Write code to input an age and display the correct ticket price. [5 marks]

Solution:

age = int(input("Enter age: "))

if age < 12:
    price = 5.00
elif age < 18:
    price = 7.50
elif age < 65:
    price = 10.00
else:
    price = 6.50

print("Ticket price: £", price)

Mark scheme:

  • 1 mark: input with appropriate prompt
  • 1 mark: conversion to integer
  • 3 marks: correct elif structure covering all four conditions (1 mark per condition, partial credit allowed)
  • 1 mark: appropriate output

Common mistakes and how to avoid them

  • Using = instead of == in conditions — Remember that = assigns a value, while == compares values. Write if score == 100: not if score = 100:

  • Off-by-one errors with arrays — Arrays start at index 0, not 1. An array with 5 elements has indices 0-4. Trying to access scores[5] when the array has 5 elements causes an error.

  • Infinite loops from incorrect conditions — Always ensure your while loop condition will eventually become false. If you write while count < 10: but never change count inside the loop, it runs forever.

  • Wrong indentation in Python — Python uses indentation to show which code belongs inside loops and if statements. All lines inside a loop must be indented by the same amount (usually 4 spaces).

  • Comparing strings and integers without conversion"16" is not the same as 16. Convert user input to the correct data type: age = int(input("Age: "))

  • Forgetting to increment loop counters — In while loops, you must manually update the counter: count = count + 1. Forgetting this creates an infinite loop.

Exam technique for "Programming: Concepts and Constructs"

  • "Write code" questions usually award 1 mark per correct programming construct. Show your working by writing clear, properly indented code even if you're unsure. Partial marks are available.

  • "Identify the error" questions require you to state what's wrong AND how to fix it. Simply underlining incorrect code without explanation earns 0 marks.

  • "Trace/dry run" questions ask you to follow code line-by-line and record variable values. Use a table with columns for each variable and rows for each iteration. Show every step even if values don't change.

  • Command words matter: "State" needs a brief answer, "Explain" requires a reason or justification, "Write" means produce code. Always read the command word carefully and respond appropriately.

Quick revision summary

Programming concepts form the foundation of all computer programs. Variables store data of specific types (integer, real, Boolean, character, string) while constants hold fixed values. Selection statements (if/elif/else) control program flow using conditions and comparison operators. Iteration repeats code using for loops (known repetitions) or while loops (condition-based repetitions). Arrays store multiple values accessed by index position. String manipulation uses built-in operations like upper(), lower() and slicing. Master these constructs and you'll be able to write, trace and debug programs confidently in your WJEC exam.

Programming: Concepts and Constructs: common questions

What do you need to know about Programming: Concepts and Constructs for WJEC GCSE Computer Science?

Programming concepts form the foundation of all computer programs. Variables store data of specific types (integer, real, Boolean, character, string) while constants hold fixed values. Selection statements (if/elif/else) control program flow using conditions and comparison operators. Iteration repeats code using for loops (known repetitions) or while loops (condition-based repetitions). Arrays store multiple values accessed by index position. String manipulation uses built-in operations like upper(), lower() and slicing. Master these constructs and you'll be able to write, trace and debug programs confidently in your WJEC exam.

What are the most common mistakes in Programming: Concepts and Constructs?

Using = instead of == in conditions: Remember that = assigns a value, while == compares values. Write if score == 100: not if score = 100: Off-by-one errors with arrays: Arrays start at index 0, not 1. An array with 5 elements has indices 0-4. Trying to access scores[5] when the array has 5 elements causes an error. Infinite loops from incorrect conditions: Always ensure your while loop condition will eventually become false. If you write while count < 10: but never change count inside the loop, it runs forever.

Where can I practise Programming: Concepts and Constructs questions for free?

Kramizo has free WJEC GCSE Computer Science practice questions on Programming: Concepts and Constructs, each marked instantly with a full explanation. No card is required.

Free for GCSE students

Lock in Programming: Concepts and Constructs with real exam questions.

Free instantly-marked WJEC GCSE Computer Science practice — 45 questions a day, no card required.

Try a question →See practice bank