What are the primitive data types, and how do the three programming constructs build any algorithm?
Programming principles: primitive and composite data types, variables and constants, scope and lifetime, and the three programming constructs of sequence, selection and iteration used to build structured programs.
An Eduqas Component 1 answer on programming principles: the primitive data types, variables versus constants, local versus global scope and lifetime, type conversion, and the three programming constructs sequence, selection and iteration.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
Eduqas wants you to know the primitive data types and when to use each, the difference between variables and constants, scope and lifetime (local versus global), type conversion, and how the three constructs (sequence, selection, iteration) build any structured program.
The answer
Primitive and composite data types
Variables, constants, scope and lifetime
The three programming constructs
Examples in context
Choosing the right type is a daily decision: a temperature sensor reads a real, a record count is an integer, an "is logged in" flag is a Boolean. The three constructs appear in every program ever written, and recognising them in pseudocode is essential for the algorithm questions. Scope discipline (locals over globals) is the foundation of the object-oriented and modular techniques in the next dot points, where encapsulation formalises the idea of keeping data local to where it belongs.
Try this
Q1. State the most suitable primitive type for a temperature reading such as . [1 mark]
- Cue. Real (float), because it has a fractional part.
Q2. Define the scope of a local variable. [1 mark]
- Cue. It can be accessed only within the subroutine in which it is declared.
Q3. Name the three programming constructs. [3 marks]
- Cue. Sequence, selection and iteration.
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 20194 marksState the most appropriate primitive data type for each of the following, justifying your choice: a person's age, a bank balance, whether a light is on, and a postcode.Show worked answer →
Age: integer, because age is a whole number (1 mark).
Bank balance: real (floating point), because money has a fractional part such as pence (1 mark).
Whether a light is on: Boolean, because it has exactly two states, true or false (1 mark).
Postcode: string (or character sequence), because it contains letters and digits and is not used in arithmetic (1 mark).
Markers reward the correct type for each with a brief justification. A common error is choosing integer for money (loses pence) or for a postcode (cannot hold letters).
Eduqas 20215 marksExplain the difference between a local variable and a global variable, including their scope and lifetime, and give one advantage of using local variables.Show worked answer →
Scope (up to 2 marks): a local variable is declared inside a subroutine and can only be accessed within it; a global variable is declared in the main program and can be accessed anywhere in the program.
Lifetime (up to 2 marks): a local variable exists only while its subroutine is executing and is destroyed when the subroutine ends; a global variable exists for the whole run of the program.
Advantage (up to 1 mark): local variables avoid unintended side effects because they cannot be changed from elsewhere, which makes code easier to debug and subroutines reusable.
Markers reward the access (scope) distinction, the existence (lifetime) distinction, and a valid advantage of local variables (encapsulation, fewer side effects, reuse).
Related dot points
- Logical operations: the logic gates (AND, OR, NOT, NAND, NOR, XOR) and their truth tables, building and reading truth tables for expressions, the laws of Boolean algebra and De Morgan's laws, and simplifying expressions with Karnaugh maps.
An Eduqas Component 1 answer on logical operations: the six logic gates and their truth tables, building truth tables for expressions, simplifying with the laws of Boolean algebra and De Morgan's laws, and using Karnaugh maps to minimise a Boolean expression.
- Procedural and object-oriented programming: subroutines (procedures and functions) with parameters and return values, and the object-oriented concepts of classes and objects, encapsulation, inheritance and polymorphism.
An Eduqas Component 1 answer on programming paradigms: procedures and functions with parameters passed by value or reference, and the object-oriented concepts of classes, objects, encapsulation, inheritance and polymorphism, with their benefits for large programs.
- Static data structures: one- and multi-dimensional arrays, records (structs), tuples and sets, how they are stored contiguously in memory, address calculation for array elements, and choosing the appropriate structure for a task.
An Eduqas Component 1 answer on static data structures: one- and multi-dimensional arrays, records, tuples and sets, how they are stored contiguously in memory, calculating the address of an array element, and choosing the right structure for a problem.
- Program construction and translators: compilers, interpreters and assemblers and their differences, the distinction between source, object and executable code, and the stages of compilation (lexical analysis, syntax analysis, semantic analysis, code generation and optimisation).
An Eduqas Component 1 answer on translators: how compilers, interpreters and assemblers differ, the distinction between source, object and executable code, and the stages of compilation from lexical analysis through syntax and semantic analysis to code generation and optimisation.
- Testing and correctness: the types of program error (syntax, runtime and logic), test strategies and test data (normal, boundary and erroneous), trace tables and dry runs, and validation and verification of input data.
An Eduqas Component 1 answer on testing and correctness: syntax, runtime and logic errors, choosing normal, boundary and erroneous test data, dry runs with trace tables, and the difference between validation and verification of input.