Programming Fundamentals

GCSE Computer Science · Programming

What programming fundamentals covers

Every program, in any language, is built from a small set of core building blocks. The three basic programming constructs are sequence, selection and iteration, and they work with variables, constants, operators and data types.

Variables and constants

  • A variable is a named store for a value that can change while the program runs (e.g. score).
  • A constant is a named store for a value that stays fixed (e.g. PI = 3.14).
  • Assignment puts a value into a variable, usually with = or : score = 0.

Data types

The data type tells the computer what kind of value is stored and what can be done with it.

Data typeStoresExample
IntegerWhole numbers7, -3
Real / FloatNumbers with decimals3.14, -0.5
BooleanTrue or FalseTrue
Character (char)A single character'A'
StringText (a sequence of characters)"hello"

Choosing the right type saves memory and prevents errors (e.g. don't store money as an integer if you need pence).

Operators

  • Arithmetic: + − * /, plus ^ (power), MOD (remainder) and DIV (integer division). Example: 17 MOD 5 = 2, 17 DIV 5 = 3.
  • Comparison: == (equal to), != (not equal), <, >, <=, >= — these give a Boolean result.
  • Logical (Boolean): AND, OR, NOT — combine conditions.

The three constructs

Sequence

Instructions carried out one after another, in order.

input name
output "Hello " + name

Selection

The program chooses between paths using a condition (IF … ELSE).

if score >= 50 then
   output "Pass"
else
   output "Fail"
endif

Iteration (loops)

Instructions are repeated — either a set number of times or while a condition holds (covered in detail in the next note).

Input, processing, output

Most programs follow input → process → output: take data in, do something with it, and produce a result. Comments (# like this) explain code but are ignored by the computer.

Worked example

What is 23 MOD 7 and 23 DIV 7?

  • 23 DIV 7 = 3 (7 goes into 23 three whole times).
  • 23 MOD 7 = 2 (the remainder). ✓

Common mistakes

  • Confusing = (assignment) with == (comparison).
  • Mixing up MOD (remainder) and DIV (whole-number result).
  • Storing a decimal value in an integer variable and losing the fraction.

Exam tips

  • Learn the five data types with an example of each — a frequent question.
  • Be ready to state why a particular data type is suitable for given data.
  • Know MOD and DIV — they appear often (e.g. finding if a number is even: n MOD 2 = 0).

Key facts to remember

  • Variable = value that can change; constant = fixed value.
  • Data types: integer, real/float, Boolean, character, string.
  • Three constructs: sequence (in order), selection (IF), iteration (loops); operators include arithmetic, comparison and logical (AND/OR/NOT).
Don't understand a part?

Sign in and ask our AI tutor to explain any passage in plain English.

Try AI explanations →

More on Programming

Selection and Iteration Arrays, Lists and Records Subroutines: Functions and Procedures String Manipulation

← All GCSE Computer Science notes