Programming Fundamentals
Unit 2.2 is the heavy-lifting programming unit. Master variables, iteration, arrays, SQL, and subprogrammes using robust high-level language techniques.
Concept Explorer: Variables vs Constants in Memory
A high-level language allocates RAM slots. Constants are locked, whereas Variables can be updated while the programme runs. Try updating them below!
let score = 0
Modules
1. Core Concepts & Operators
Sequence, Selection, Iteration, and Arithmetic/Boolean logic.
2. Data Types & Casting
Integers, Reals, Booleans, Strings, Characters, and type conversion.
3. String Manipulation & Random
Slicing substrings, concatenation, and executing random generation modules.
4. Data Structures
1D and 2D Static Arrays, Database Emulation, and Data Records.
5. Subprogrammes
Functions vs Procedures, Parameters, and Global vs Local Variable scope.
6. File Handling
Opening, Reading, and Writing to persistent text files.
7. Databases & SQL
Retrieving data using SELECT, FROM, and WHERE queries.
Interactive Practical Labs
Put your theory into practice. Launch the Python development environments below to write, test, and debug real algorithms.
Check Your Understanding
1. What is the fundamental difference between a Variable and a Constant?
2. An algorithm relies on evaluating True / False logic gates. What specific operator type is this known as?
Written Exam Scenario (AO2/AO3)
Stretch (Grade 9)"A school is designing a grading system algorithm. The passing grade will always be 50 marks. Explain why the developer should declare the passing grade as a Constant rather than a Variable." (3 marks)
1. Protection: Declaring the passing grade as a constant protects it from being accidentally overwritten or changed by bugged code during runtime, improving the robustness of the programme.
2. Readability: Using a named constant (e.g., `PASS_MARK`) instead of typing '50' everywhere makes the code much easier for a human to read and understand.
3. Easy Maintenance: If the government changes the pass mark to 55 next year, the developer only has to change the constant definition once at the top of the code, rather than hunting for multiple '50's scattered throughout thousands of lines of algorithm.