Ms Coetzee · Information Technology
12

Grade 12 Study Reference

A complete printable guide to Information Technology for Grade 12 - practical Delphi programming and theory.

Practical  •  Theory  •  Term Planner  •  Exam Extras
CAPS-aligned · Printable booklet edition

Contents — Grade 12

Grade 12 · Practical

SQL — Structured Query Language Grade 12

SQL (pronounced "S-Q-L" or "sequel") is the language used to communicate with a database. It lets you retrieve, add, update and delete records. In Delphi, SQL is added to a TADOQuery component.

T1Term 1 · SQL Basics, SELECT & WHERE Queries
What is SQL?

Think of a database as a massive spreadsheet with thousands of rows. SQL is how you ask the database a question: "Give me all students in Grade 12 with a mark above 80, sorted by surname." Without SQL, you would have to scroll through every row manually.

Anatomy of a SQL Statement

SELECT Name, Surname, Mark FROM tblStudents WHERE Grade = 12 ORDER BY Surname Which fields Which table Filter condition Sort order

Using SQL in Delphi

SQL goes into the SQL property of a TADOQuery component. Always close the query before changing the SQL, then open it again.

Delphi — two ways to run a query
// Method 1: assign as one string
qryStudents.Close;
qryStudents.SQL.Text := 'SELECT * FROM tblStudents WHERE Grade = 12';
qryStudents.Open;

// Method 2: build line-by-line (easier to read for long queries)
qryStudents.Close;
qryStudents.SQL.Clear;
qryStudents.SQL.Add('SELECT Name, Surname, Mark');
qryStudents.SQL.Add('FROM tblStudents');
qryStudents.SQL.Add('WHERE Grade = 12');
qryStudents.SQL.Add('ORDER BY Surname ASC');
qryStudents.Open;

SELECT — Choosing What to Display

SQL
SELECT * FROM tblCD;                      -- all fields, all records
SELECT CDName, Artist FROM tblCD;          -- only these two fields
SELECT DISTINCT Genre FROM tblCD;          -- each genre shown once only
SELECT TOP 5 * FROM tblCD;               -- first 5 records only

WHERE — Filtering Records

The WHERE clause is how you filter — like asking "show me only the records that match this condition."

SQL — comparison operators
WHERE Genre = "Rock"             -- exact match (text in double quotes)
WHERE Price < 100               -- numbers (no quotes)
WHERE Grade <> 11              -- not equal
WHERE Mark >= 50              -- greater than or equal
WHERE Genre = "Pop" AND Price < 100       -- both must be true
WHERE Genre = "Pop" OR Genre = "Rock"     -- either can be true

Operator Precedence in Compound Conditions

When a WHERE clause mixes AND and OR, SQL doesn't just evaluate left to right — it follows a fixed order of precedence, same as in maths:

OrderOperator(s)
1 (first)Parentheses ( )
2Multiplication, division
3Subtraction, addition
4NOT
5AND
6 (last)OR

AND is evaluated before OR, so a mixed condition may not filter the way you expect unless you add brackets to force the order you want.

SQL — AND evaluates before OR
WHERE Genre = "Pop" OR Genre = "Rock" AND Price < 100
-- reads as: Genre = "Pop"  OR  (Genre = "Rock" AND Price < 100)
-- ALL Pop CDs are included, regardless of price!

-- To make BOTH genres respect the price limit, use brackets:
WHERE (Genre = "Pop" OR Genre = "Rock") AND Price < 100
When in doubt, add brackets

You don't have to memorise the precedence table if you always wrap OR conditions in brackets when combining them with AND. Brackets make your intention explicit and remove any ambiguity — for the reader and for the database.

Special WHERE Operators

OperatorMeaningExample
LIKEPattern match. % = any chars, _ = one charWHERE Name LIKE "S%" — starts with S
INMatch any value in a listWHERE Genre IN ("Rock","Pop","Jazz")
BETWEENWithin a range (inclusive for numbers)WHERE Price BETWEEN 50 AND 150
IS NULLField is empty/blankWHERE CellNo IS NULL
IS NOT NULLField has a valueWHERE CellNo IS NOT NULL
#date#Date values use # symbolsWHERE OrderDate = #2024-05-01#
Dates can be misread — use yyyy/mm/dd

Access SQL can misinterpret a date written as dd/mm/yyyy, reading it as month/day/year instead. Writing the year first removes the ambiguity: prefer #2024/05/01# (yyyy/mm/dd) over #01/05/2024#.

LIKE wildcard examples
WHERE CDName LIKE "S%"        -- starts with S
WHERE CDName LIKE "%love%"    -- contains the word "love"
WHERE CDName LIKE "%s"        -- ends with s
WHERE Code   LIKE "A__"       -- starts with A followed by exactly 2 chars

ORDER BY — Sorting Results

SQL
SELECT * FROM tblCD ORDER BY Artist;             -- ascending (default)
SELECT * FROM tblCD ORDER BY Price DESC;        -- most expensive first
SELECT * FROM tblCD ORDER BY Genre, CDName ASC; -- sort by genre, then name

Calculated Fields & Aliases

You can do maths inside a SELECT and give the result a name using AS.

SQL
SELECT Name, Price, Price * 1.15 AS PriceWithVAT FROM tblProducts;
SELECT Name, Mark, ROUND(Mark / 2, 0) AS HalfMark FROM tblStudents;

Aggregate Functions — Calculating Summaries

FunctionWhat it calculatesExample
COUNT(*)Number of recordsSELECT COUNT(*) FROM tblStudents
SUM(field)Total of numeric fieldSELECT SUM(Mark) FROM tblResults
AVG(field)Average of numeric fieldSELECT AVG(Mark) FROM tblResults
MIN(field)Lowest valueSELECT MIN(Price) FROM tblProducts
MAX(field)Highest valueSELECT MAX(Price) FROM tblProducts
SQL — GROUP BY and HAVING
-- Count students per grade
SELECT Grade, COUNT(*) AS Total
FROM tblStudents
GROUP BY Grade;

-- Only show groups with more than 10 students
SELECT Grade, COUNT(*) AS Total
FROM tblStudents
GROUP BY Grade
HAVING COUNT(*) > 10;
WHERE vs HAVING

WHERE filters individual records before grouping. HAVING filters groups after GROUP BY. If you have both, WHERE runs first.

SQL String & Math Functions

FunctionReturnsExample
LEN(field)Character countSELECT LEN(Name) FROM tblStudents
LEFT(field, n)First n charactersLEFT(Surname, 3) → first 3 letters
RIGHT(field, n)Last n charactersRIGHT(IDNo, 4)
MID(field, start, n)Substring from positionMID(IDNo, 3, 2) → month of birth (position 1–2 is the year)
ROUND(field, dec)Rounded valueROUND(Avg, 2) → 2 decimal places
INT(field)Integer part (no decimal)INT(75.8) = 75
FORMAT(field, "0.00")Formatted stringFORMAT(Price, "R0.00")

Date Functions

SQL — date examples
SELECT Name, YEAR(BirthDate) AS BirthYear FROM tblStudents;
SELECT * FROM tblOrders WHERE MONTH(OrderDate) = 12;     -- December orders
SELECT * FROM tblStudents WHERE YEAR(BirthDate) = 2008;

INSERT, UPDATE, DELETE

SQL — modifying data
-- Add a new record
INSERT INTO tblStudents (Name, Surname, Grade)
VALUES ("Alice", "Smith", 12);

-- Change existing data
UPDATE tblStudents
SET Grade = 12
WHERE StudentID = 45;

-- Remove a record
DELETE FROM tblStudents
WHERE StudentID = 45;
Always use WHERE with UPDATE and DELETE

Without a WHERE clause, UPDATE changes every record and DELETE removes every record in the table. Always double-check your condition.

Building an INSERT String with QuotedStr

Instead of a parameterised query, you will sometimes build the whole SQL statement as one string by joining Delphi variables onto it directly. Text values need quotes around them in the final SQL string — the QuotedStr function wraps a string value in quotes for you, so you don't have to type them by hand.

Delphi — INSERT built with string concatenation + QuotedStr
qryStudents.Close;
qryStudents.SQL.Text := 'INSERT INTO tblStudents (Name, Surname) VALUES (' +
  QuotedStr(edtName.Text) + ', ' + QuotedStr(edtSurname.Text) + ')';
qryStudents.ExecSQL;   // use ExecSQL (not Open) for INSERT/UPDATE/DELETE — they don't return records
QuotedStr vs parameters

QuotedStr is a quick way to build a query from a string variable, but a parameterised query (below) is the safer, preferred technique — it avoids manually matching quotes and is more resistant to SQL injection.

Parameterised Queries

Instead of hardcoding a value, use a parameter that is filled in by the user at runtime.

Delphi — parameterised query (by name method)
qryStudents.Close;
qryStudents.SQL.Clear;
qryStudents.SQL.Add('SELECT * FROM tblStudents');
qryStudents.SQL.Add('WHERE Grade = :pGrade');   // :pGrade is the parameter
qryStudents.Parameters.ParamByName('pGrade').Value := sedGrade.Value;
qryStudents.Open;

SQL in Delphi — Reading Field Values

Delphi
// Read a field value from the current record
sName   := qryStudents['Name'];
iGrade  := qryStudents['Grade'];
rMark   := qryStudents['Average'];

// Loop through all records
qryStudents.First;
while not qryStudents.Eof do
begin
  memOut.Lines.Add(qryStudents['Name'] + ' ' + qryStudents['Surname']);
  qryStudents.Next;
end;

Worked Example — A Search Screen

A classic Paper 1 task: the user types (part of) a surname into edtSearch and clicks a button. The program must build a parameterised query from that input, run it, list every match in memOut, and report how many were found. This combines user input, SQL, looping a dataset and string output.

Delphi — search button click
procedure TfrmMain.btnSearchClick(Sender: TObject);
var
  iFound : integer;
begin
  memOut.Clear;
  iFound := 0;

  // 1. Build a parameterised query from the user's input
  qryStudents.Close;
  qryStudents.SQL.Clear;
  qryStudents.SQL.Add('SELECT Name, Surname, Grade, Average');
  qryStudents.SQL.Add('FROM tblStudents');
  qryStudents.SQL.Add('WHERE Surname LIKE :pName');
  qryStudents.SQL.Add('ORDER BY Surname ASC');
  // add a wildcard so 'coe' matches 'Coetzee'
  qryStudents.Parameters.ParamByName('pName').Value := edtSearch.Text + '%';
  qryStudents.Open;

  // 2. Loop through the result set and display each record
  qryStudents.First;
  while not qryStudents.Eof do
  begin
    memOut.Lines.Add(qryStudents['Name'] + ' ' + qryStudents['Surname']
                     + '  (Gr ' + IntToStr(qryStudents['Grade'])
                     + ', ' + FloatToStrF(qryStudents['Average'], ffFixed, 4, 1) + '%)');
    Inc(iFound);
    qryStudents.Next;
  end;

  // 3. Report how many were found
  if iFound = 0 then
    ShowMessage('No learner found starting with "' + edtSearch.Text + '".')
  else
    lblCount.Caption := IntToStr(iFound) + ' learner(s) found';
end;
Why a parameter, not string-joining?

Using :pName and ParamByName is safer and cleaner than gluing the user's text straight into the SQL string — it avoids quote/type errors and blocks SQL injection (see Cybercrime). The wildcard '%' is added to the value, so a partial surname still matches.

Grade 12 · Practical

SQL — Joining Tables Grade 12

In SA IT CAPS, joining two tables is done using the WHERE clause method — listing both tables in FROM and linking them with a matching condition in WHERE. This is the only join method required for CAPS.

T1Term 1 · Joining Tables With WHERE
CAPS Method: WHERE Clause — Not INNER JOIN

The official SA IT CAPS specifies the WHERE method for single joins. The CAPS document states: “Create a join query (single joins) using WHERE”. Do NOT use the INNER JOIN keyword in exams.

Why Join Tables?

A relational database splits related data across tables. For example, a student record stores a ClassID but the class name lives in a separate table. To display both together, you join the tables.

Syntax

SQL — WHERE join syntax
SELECT TableA.Field1, TableB.Field2
FROM TableA, TableB
WHERE TableA.KeyField = TableB.KeyField;

Both tables appear in FROM, separated by a comma. The WHERE clause links the tables on their shared key field.

Examples

Example 1 — Students with their class names

SQL
SELECT tblStudents.Name, tblStudents.Surname, tblClasses.ClassName
FROM tblStudents, tblClasses
WHERE tblStudents.ClassID = tblClasses.ClassID;

Example 2 — With extra filtering and sorting

SQL
SELECT tblStudents.Name, tblStudents.Surname, tblClasses.ClassName
FROM tblStudents, tblClasses
WHERE tblStudents.ClassID = tblClasses.ClassID
AND tblStudents.Grade = 12
ORDER BY tblStudents.Surname ASC;
Adding extra conditions

Use AND after the join condition to filter results further. The join condition always comes first in WHERE.

Example 3 — Join with GROUP BY and COUNT

SQL — count students per class
SELECT tblClasses.ClassName, COUNT(tblStudents.StudentID) AS Total
FROM tblStudents, tblClasses
WHERE tblStudents.ClassID = tblClasses.ClassID
GROUP BY tblClasses.ClassName
ORDER BY Total DESC;

Example 4 — Using LIKE with a join

SQL
SELECT tblBooks.Title, tblAuthors.AuthorName, tblBooks.Price
FROM tblBooks, tblAuthors
WHERE tblBooks.AuthorID = tblAuthors.AuthorID
AND tblBooks.Title LIKE "IT%"
ORDER BY tblBooks.Price DESC;

Using a Join in Delphi (TADOQuery)

Delphi
qryData.Close;
qryData.SQL.Clear;
qryData.SQL.Add('SELECT tblStudents.Name, tblStudents.Surname, tblClasses.ClassName');
qryData.SQL.Add('FROM tblStudents, tblClasses');
qryData.SQL.Add('WHERE tblStudents.ClassID = tblClasses.ClassID');
qryData.SQL.Add('AND tblStudents.Grade = 12');
qryData.Open;

Cartesian Product Warning

Never forget the join condition

If you list two tables in FROM but omit the WHERE link condition, SQL returns every possible combination of rows (a Cartesian product). For two tables with 100 rows each, this produces 10,000 rows — all incorrect. Always include WHERE TableA.Key = TableB.Key.

Common Mistakes

MistakeEffectFix
Missing join condition in WHERECartesian product (massive wrong result)Always link: WHERE tblA.Key = tblB.Key
Ambiguous field name (e.g. just Name when both tables have it)SQL errorAlways prefix: tblStudents.Name
Not calling qryData.Close before changing SQLRuntime errorAlways close first
Grade 12 · Practical

Object-Oriented Programming (OOP) Grade 12

OOP lets you model real-world things as objects in code. Think of a class as a blueprint (like architectural plans for a house) and an object as the actual building made from that plan. One blueprint, many buildings — one class, many objects.

T2Term 2 · Classes, Objects & Core OOP Concepts
ANALOGY — OOP is a taxi

Every part of OOP maps neatly onto a taxi:

  • Class = the design of a taxi — the plans that say what every taxi has and can do. There is only one design.
  • Object (instance) = one actual taxi on the road, e.g. the one with registration CA 123‑456. From the one design you can build many taxis.
  • Attributes = what a taxi has: make, registration, colour, number of seats, fuel level, current speed.
  • Methods = what a taxi does: StartEngine, Drive, Stop, PickUp, DropOff, Hoot.
  • Constructor (Create) = building a brand-new taxi at the factory and giving it its starting details (make, registration).
  • Encapsulation = you drive with the steering wheel and pedals (public methods); you never reach into the engine (private attributes). The engine is hidden under the bonnet — and that keeps it safe.
  • Accessor (getter) = the fuel gauge lets you read the fuel level without touching the tank. Mutator (setter) = filling up at the petrol station changes the fuel level in a controlled way.
  • Inheritance = a taxi is‑a vehicle: it inherits "drive" and "stop" from a general TVehicle, then adds its own meter and passenger seats.
  • Polymorphism = tell any vehicle to Hoot and each does it its own way — a sedan taxi beeps, a minibus blares.
TCat class structure in Delphi's code view
TCat class structure in Delphi's code view

Core OOP Concepts

TermDefinition
ClassA blueprint or template that describes what an object looks like and can do
ObjectA specific instance of a class (like one particular cat — Whiskers)
AttributeA variable that stores data about the object (e.g. fName, fAge)
MethodA procedure or function that belongs to the class (e.g. GetName, SetAge)
ConstructorSpecial method Create that creates an instance and sets initial values
EncapsulationHiding private data inside a class; only accessible through public methods
InheritanceA new class inherits all attributes and methods of an existing (parent) class
PolymorphismThe same method name behaves differently in different classes
You already use OOP!

In Delphi, every component is an object. TButton is a class; btnOK is an object. TForm is a class; Form1 is an object. OOP lets you create your own custom classes.

One Class, Many Objects

A class is defined once. You can create as many objects (instances) from it as you need — each with its own data.

TCat (CLASS) Blueprint / Template - fName : String - fAge : Integer + Create(sName, iAge) + GetName : String + ToString : String Create objCat1 (Object) fName = 'Whiskers' fAge = 3 objCat1 := TCat.Create('Whiskers', 3); objCat2 (Object) fName = 'Felix' fAge = 5 objCat2 := TCat.Create('Felix', 5); objCat3 (Object) fName = 'Shadow' fAge = 1 objCat3 := TCat.Create('Shadow', 1); Same class TCat — three different objects with different data. The class defines the structure; objects hold the actual values.

UML Class Diagram

Before coding a class, design it using a UML (Unified Modeling Language) diagram — a rectangle divided into 3 sections.

TCat Private attributes (data) - fName : String - fAge : Integer - fWeight : Real Public methods (behaviour) + Create(sName: String; iAge: Integer) + GetName : String + SetName(sName: String) + ToString : String - = private (hidden) + = public (accessible)

Encapsulation

Keep attributes private — hidden from the outside world. Only expose them through controlled public methods (getters and setters). This protects data from accidental or invalid changes.

PUBLIC — accessible from outside the class GetName : String SetName(s: String) GetAge : Integer ToString : String PRIVATE — hidden inside class - fName : String - fAge : Integer - fWeight : Real
Delphi — encapsulation
private
  fName: string;         // hidden from outside — direct access blocked
public
  procedure SetName(s: string);  // controlled write access (can include validation)
  function  GetName: string;     // controlled read access

Inheritance

A child class inherits all attributes and methods from a parent class, and can add or override its own. This avoids repeating code.

TAnimal - fName : String + Speak (virtual) is-a is-a TDog inherits fName from TAnimal + Speak (override) → 'Woof!' TCat inherits fName from TAnimal + Speak (override) → 'Meow!'
Delphi — inheritance
type
  TAnimal = class
    procedure Speak; virtual;  // can be overridden in child classes
  end;

  TDog = class(TAnimal)       // inherits everything from TAnimal
    procedure Speak; override;  // replaces TAnimal.Speak
  end;

  TCat = class(TAnimal)
    procedure Speak; override;
  end;

Polymorphism

The same method name (Speak) behaves differently depending on the type of object. "Many forms" — poly = many, morph = form.

ObjectMethod CalledResult
objAnimal.SpeakTAnimal.Speak'Animal sound...'
objDog.SpeakTDog.Speak (overridden)'Woof!'
objCat.SpeakTCat.Speak (overridden)'Meow!'
Delphi — polymorphism
procedure TAnimal.Speak;
begin
  ShowMessage('Animal sound...');
end;

procedure TDog.Speak;
begin
  ShowMessage('Woof!');
end;

procedure TCat.Speak;
begin
  ShowMessage('Meow!');
end;

Types of Methods

Method TypeKeywordDescription
ConstructorconstructorCreates the object and sets initial attribute values. Called on the class name: TCat.Create(...)
Accessor (getter)functionReturns the value of a private attribute. Read-only access.
Mutator (setter)procedureUpdates the value of a private attribute. Can include validation.
ToStringfunctionReturns a string representation of the object's state — used for display.
AuxiliaryprivateInternal helper methods used by other methods, not accessible from outside.
What does an auxiliary method actually do?

An auxiliary method is a private helper that does one small job for an accessor or mutator, so that method doesn't get cluttered with extra logic. It takes the data it's given, processes it, and returns the result — it never changes the object's attributes itself. Using auxiliary methods reduces complexity inside a class and keeps each method focused on a single task.

Delphi — an auxiliary method used by ToString
private
  function FormatWeight(rWeight: real): string;  // auxiliary — helper only, not called from outside the class
public
  function ToString: string;

// ...
function TCat.FormatWeight(rWeight: real): string;
begin
  Result := FloatToStrF(rWeight, ffFixed, 4, 1) + 'kg';  // just formats — doesn't change fWeight
end;

function TCat.ToString: string;
begin
  Result := fName + ', ' + FormatWeight(fWeight);  // ToString calls the auxiliary method
end;

How to Create a Class in Delphi

  1. Go to File → New → Unit – Delphi to create a new blank unit.
  2. Save it in the same folder as your project (e.g. UCar.pas).
  3. Type the class structure in the interface section (see template below).
  4. Press Ctrl+Shift+C — Delphi auto-generates the method bodies in the implementation section.
  5. Fill in the code inside each method body.
  6. In your main form unit, add the unit name to the uses clause (e.g. uses ..., UCar;).
Ctrl+Shift+C is your best friend!

After writing the class declaration in the interface section, press Ctrl+Shift+C and Delphi automatically creates all the empty method implementations in the implementation section. You just fill in the code.

Complete Class Example — TCat

Delphi — TCat unit (UCat.pas)
unit UCat;

interface

type
  TCat = class
  private
    fName   : string;
    fAge    : integer;
    fWeight : real;
  public
    constructor Create(sName: string; iAge: integer; rWeight: real);
    function    GetName   : string;
    function    GetAge    : integer;
    function    GetWeight : real;
    procedure   SetName(sNew: string);
    function    ToString  : string;
  end;

implementation

constructor TCat.Create(sName: string; iAge: integer; rWeight: real);
begin
  fName   := sName;
  fAge    := iAge;
  fWeight := rWeight;
end;

function TCat.GetName : string;
begin
  Result := fName;
end;

function TCat.GetAge : integer;
begin
  Result := fAge;
end;

function TCat.GetWeight : real;
begin
  Result := fWeight;
end;

procedure TCat.SetName(sNew: string);
begin
  fName := sNew;
end;

function TCat.ToString : string;
begin
  Result := fName + ', Age: ' + IntToStr(fAge)
          + ', Weight: ' + FloatToStr(fWeight) + 'kg';
end;

end.

Practice Example — TCar Class

This is the kind of class you will write in a Grade 12 exam. Study the pattern carefully — constructor, accessors, mutator, ToString.

Delphi — UCar.pas (complete working class)
unit UCar;

interface

type
  TCar = class
  private
    fMake  : string;    // e.g. 'Toyota'
    fYear  : integer;   // e.g. 2022
  public
    constructor Create(sMake: string; iYear: integer);
    function    GetMake  : string;
    function    GetYear  : integer;
    procedure   SetMake(sNewMake: string);
    function    ToString : string;
  end;

implementation

constructor TCar.Create(sMake: string; iYear: integer);
begin
  fMake := sMake;
  fYear := iYear;
end;

function TCar.GetMake : string;
begin
  Result := fMake;
end;

function TCar.GetYear : integer;
begin
  Result := fYear;
end;

procedure TCar.SetMake(sNewMake: string);
begin
  fMake := sNewMake;    // could add validation here (e.g. check not empty)
end;

function TCar.ToString : string;
begin
  Result := fMake + ' (' + IntToStr(fYear) + ')';
  // Output example: 'Toyota (2022)'
end;

end.

Using TCar in the Main Form

Delphi — main form unit
// 1. Add UCar to uses clause of the main form
uses
  ..., UCar;

// 2. Declare object variable (global or local)
var
  objCar : TCar;

// 3. Create the object — in a button click or FormCreate
objCar := TCar.Create('Toyota', 2022);

// 4. Read values using accessors
lblMake.Caption := objCar.GetMake;                 // 'Toyota'
lblYear.Caption := IntToStr(objCar.GetYear);       // '2022'
memOut.Lines.Add(objCar.ToString);                 // 'Toyota (2022)'

// 5. Update a value using mutator
objCar.SetMake('Honda');
lblMake.Caption := objCar.GetMake;                 // 'Honda'
Creating an object from the TCat class
Creating an object from the TCat class
Always create before use!

Always call Create before using any other method. The object does not exist until it is created. Also make sure the class unit name is in the uses clause of your main form.

Using a Class in the Main Form

Delphi — main form (TCat example)
uses
  ..., UCat;

var
  objCat : TCat;

// Create the object
objCat := TCat.Create('Whiskers', 3, 4.2);

// Use its accessors
lblName.Caption := objCat.GetName;           // 'Whiskers'
lblAge.Caption  := IntToStr(objCat.GetAge);  // '3'
memOut.Lines.Add(objCat.ToString);           // 'Whiskers, Age: 3, Weight: 4.2kg'

// Update via mutator
objCat.SetName('Felix');
lblName.Caption := objCat.GetName;           // 'Felix'

Dynamic Components — Creating Controls at Runtime

You already know that every Delphi control is an object of a class (a button is a TButton, a label is a TLabel). Because they are classes, you can create them in code while the program is running using the same Create constructor you use for your own classes — instead of dragging them onto the form at design time.

This is called creating a dynamic component. It is useful when you don't know in advance how many controls you need (e.g. one button per record loaded from a file).

The Four Steps

  1. Create the object from its class, passing the owner (usually the form).
  2. Set the Parent so Delphi knows where to draw it (which form/panel).
  3. Set properties like position, size and caption.
  4. Assign an event handler so it actually does something when clicked.
Delphi — create a button at runtime
var
  btnDynamic : TButton;
begin
  // 1. Create the object (Form1 is the owner – frees it automatically)
  btnDynamic := TButton.Create(Form1);

  // 2. Set the Parent so it appears on the form
  btnDynamic.Parent := Form1;

  // 3. Set properties
  btnDynamic.Left    := 50;
  btnDynamic.Top     := 50;
  btnDynamic.Width   := 100;
  btnDynamic.Height  := 30;
  btnDynamic.Caption := 'Click Me';

  // 4. Assign an event handler (a procedure you wrote)
  btnDynamic.OnClick := btnDynamicClick;
end;

// The handler the button will run when clicked
procedure TForm1.btnDynamicClick(Sender: TObject);
begin
  ShowMessage('Dynamic button clicked!');
end;
Owner vs Parent — what's the difference?

Owner (the argument to Create) is responsible for freeing the component from memory when the form closes. Parent decides where on screen the component is drawn. They are usually the same form, but not always (e.g. Owner = Form, Parent = a Panel on that form).

Avoid memory leaks

If you create a component with Create(nil) (no owner), you must free it yourself with btnDynamic.Free; when you are done, otherwise it stays in memory. Passing the form as the owner lets Delphi clean up for you automatically.

Grade 12 · Practical

2D Arrays Grade 12

A two-dimensional array stores data in a grid of rows and columns — like a table or spreadsheet. Each element is accessed using two indices: [row, column].

T2Term 2 · 2D Arrays — Declaration & Processing

What is a 2D Array?

A two-dimensional (2D) array is a single variable that stores many values arranged in a grid of rows and columns. Where an ordinary (one-dimensional) array is like a single shopping list running down the page, a 2D array is like a whole spreadsheet — a block of cells where every value sits at the crossing point of a row and a column.

Analogy: think of a spreadsheet such as Excel. To find a cell you give a column letter and a row number — for example C5. A 2D array works exactly the same way, except we use two numbers: the first for the row and the second for the column. So myArray[2,3] means "the value in row 2, column 3", just like clicking one cell in a grid.

PURPOSE

We use 2D arrays to store tables of data that naturally have rows and columns — for example a class register of marks where each row is a learner and each column is a subject, a seating plan, a noughts-and-crosses board, or temperatures recorded for each day across several weeks. One neat variable holds the whole table instead of dozens of separate variables.

Why Do We Use 2D Arrays?

Declaration

Before you can use a 2D array you must declare it, telling Delphi how many rows and columns it has and what type of data each cell holds. You give two ranges in the square brackets: the first range is the rows and the second is the columns.

Syntax
var
  arrName : array [rowStart..rowEnd, colStart..colEnd] of DataType;
Delphi — 2x3 integer array
var
  myArray : array [1..2, 1..3] of Integer;

The example above creates a grid with 2 rows and 3 columns, giving 6 integer cells in total. Note: the ranges can start at any number, but in CAPS we almost always start at 1 so that "row 1" really is the first row.

Visualising a 2D Array

The table below shows how the index numbers map onto the grid. Read it like a spreadsheet: pick a row down the side and a column across the top, and the cell where they meet is the array element you are referring to.

Col 1Col 2Col 3
Row 1myArray[1,1]myArray[1,2]myArray[1,3]
Row 2myArray[2,1]myArray[2,2]myArray[2,3]

Populating a 2D Array

Populating means putting values into the cells. There are two common ways: assigning each cell one by one (fine for a few known values), or using nested loops to fill the whole grid quickly.

Fixed values

Here we set each cell directly by naming its row and column. This is clear but tedious — imagine doing it for a 30 × 6 register. Use it only when you have a handful of specific values to place.

Delphi
myArray[1,1] := 10;  myArray[1,2] := 20;  myArray[1,3] := 30;
myArray[2,1] := 40;  myArray[2,2] := 50;  myArray[2,3] := 60;

Nested FOR loops (most common)

This is the technique you will use most often. The outer loop moves through the rows; for each row the inner loop moves through every column. The result is that the inner loop runs completely for each turn of the outer loop, so the code visits every cell, one full row at a time — exactly like reading a spreadsheet left-to-right, then dropping down to the next line.

Delphi
var
  myArray : array [1..3, 1..4] of Integer;
  r, c    : Integer;
begin
  for r := 1 to 3 do
    for c := 1 to 4 do
      myArray[r, c] := r * c;   // e.g. row 2, col 3 = 6
end;

Displaying a 2D Array

To show the grid neatly we again use nested loops, but this time we build up one line of text per row. For each row we start with an empty string, add every column value to it (padding each so the columns line up), and only then add the finished line to the memo. Important Rule: the line is built inside the inner loop but written out in the outer loop — that is what keeps each row on its own line.

Delphi — display as table in memo
var
  sLine: string;
  r, c:  Integer;
begin
  memOut.Clear;
  for r := 1 to 3 do
  begin
    sLine := '';
    for c := 1 to 4 do
      sLine := sLine + IntToStr(myArray[r,c]).PadLeft(5);
    memOut.Lines.Add(sLine);
  end;
end;

Calculations on 2D Arrays

A big reason for using a grid is to add things up. The trick is knowing which index to fix and which to vary. If you think of the class register again: a row total is one learner's marks added across all subjects, while a column total is one subject's marks added across all learners.

Row total

To total a single row we fix the row number (here row 1) and let the column index c change. The loop walks across that one row, adding each cell to a running total. This answers "what is everything in this row added together?" — for example one learner's total mark.

Delphi — total of row 1
iTotal := 0;
for c := 1 to 4 do
  iTotal := iTotal + myArray[1, c];

Column total

Now we do the opposite: we fix the column number (here column 2) and let the row index r change. The loop runs straight down that one column, adding each cell. This answers "what is everything in this column added together?" — for example the total of all learners' marks for one subject.

Delphi — total of column 2
iTotal := 0;
for r := 1 to 3 do
  iTotal := iTotal + myArray[r, 2];

Grand total of all elements

To add up every cell in the whole grid we need nested loops again — the outer loop for rows, the inner loop for columns — so the running total picks up each cell exactly once. This is how you would work out the grand total of all marks for the entire class across all subjects.

Delphi
iTotal := 0;
for r := 1 to 3 do
  for c := 1 to 4 do
    iTotal := iTotal + myArray[r, c];

Worked Example — Class Register Report

A full exam question ties the pieces together: a 2D array of marks, a parallel 1D array of names, nested loops, and both a row and a column calculation. Here the grid arrMark holds marks for each learner (rows) across 4 subjects (columns), and arrName holds the matching learner names.

Delphi — global declarations
const
  LEARNERS = 5;
  SUBJECTS = 4;
var
  arrMark : array[1..LEARNERS, 1..SUBJECTS] of Integer;   // the grid: row = learner, col = subject
  arrName : array[1..LEARNERS] of string;              // parallel to the rows

arrName[r] is the name of the learner whose marks are in arrMark[r, 1..SUBJECTS] — the name array runs parallel to the rows of the grid.

Part (a) — Each learner's average (a row calculation)

Fix the row (one learner) and loop across the columns to total their subjects, then divide.

Delphi — print name + average per learner
var
  r, c, iRowTotal : Integer;
  rAvg            : Real;
begin
  for r := 1 to LEARNERS do
  begin
    iRowTotal := 0;
    for c := 1 to SUBJECTS do
      iRowTotal := iRowTotal + arrMark[r, c];
    rAvg := iRowTotal / SUBJECTS;
    memOut.Lines.Add(arrName[r] + ': ' +
                     FloatToStrF(rAvg, ffFixed, 4, 1) + '%');
  end;
end;

Part (b) — The best subject (a column calculation + finding a max)

Now fix each column (one subject) and loop down the rows to average that subject across all learners, keeping track of the highest.

Delphi — subject with the highest class average
var
  r, c, iColTotal, iBestCol : Integer;
  rColAvg, rBestAvg         : Real;
begin
  iBestCol := 1;
  rBestAvg := 0;
  for c := 1 to SUBJECTS do
  begin
    iColTotal := 0;
    for r := 1 to LEARNERS do
      iColTotal := iColTotal + arrMark[r, c];
    rColAvg := iColTotal / LEARNERS;
    if rColAvg > rBestAvg then
    begin
      rBestAvg := rColAvg;
      iBestCol := c;               // remember WHICH subject
    end;
  end;
  ShowMessage('Best subject: column ' + IntToStr(iBestCol) +
              ' (average ' + FloatToStrF(rBestAvg, ffFixed, 4, 1) + '%)');
end;
The pattern to remember

Row calculation → fix the row, loop the columns (one learner across all subjects). Column calculation → fix the column, loop the rows (one subject down all learners). To find a "best/worst", store the index as you go — that index links straight back to the parallel arrName.

Grade 12 · Practical

Recursion in Delphi Grade 12

Recursion is when a function or procedure calls itself repeatedly until a base condition is met. It is a powerful technique for problems that can be broken down into smaller versions of the same problem.

T3Term 3 · Recursive Functions & Base Cases

What is Recursion?

Recursion is when a function calls itself to solve a smaller version of the same problem, again and again, until the problem becomes so small it can be answered directly.

Analogy: picture a set of Russian nesting dolls. You open the biggest doll and find a smaller doll inside, open that and find a smaller one still, and you keep going until you reach the tiny doll that does not open. Recursion works the same way — each call opens up a slightly smaller version of the problem, and the smallest doll (the one that does not open) is the point where you stop.

A recursive routine is one that calls itself. Every recursive solution must have two parts:

Always have a base case

A recursive function without a base case will call itself forever, causing a stack overflow error and crashing the program.

Example 1 — Factorial

Factorial of n (written n!) = n × (n-1) × (n-2) × … × 1. Example: 5! = 5 × 4 × 3 × 2 × 1 = 120

Delphi — recursive factorial
function Factorial(n: Integer): Integer;
begin
  if n <= 1 then           // base case: factorial of 0 or 1 is 1
    Result := 1
  else                      // recursive case
    Result := n * Factorial(n - 1);
end;

// Calling it:
lblResult.Caption := IntToStr(Factorial(5));  // = 120

Trace — how Factorial(4) executes

Trace
Factorial(4)
  = 4 * Factorial(3)
      = 3 * Factorial(2)
          = 2 * Factorial(1)
              = 1        ← base case reached
          = 2 * 1 = 2
      = 3 * 2 = 6
  = 4 * 6 = 24

Example 2 — Sum of 1 to N

Delphi — recursive sum
function SumToN(n: Integer): Integer;
begin
  if n <= 0 then
    Result := 0           // base case
  else
    Result := n + SumToN(n - 1);  // recursive case
end;

// SumToN(4) = 4 + 3 + 2 + 1 + 0 = 10

Example 3 — Power (x to the power of n)

Delphi
function PowerOf(base, exp: Integer): Integer;
begin
  if exp = 0 then
    Result := 1                            // base case: x^0 = 1
  else
    Result := base * PowerOf(base, exp - 1); // recursive
end;

// PowerOf(2, 4) = 2*2*2*2 = 16

Example 4 — Fibonacci Sequence

Each number is the sum of the previous two: 0, 1, 1, 2, 3, 5, 8, 13…

Delphi
function Fibonacci(n: Integer): Integer;
begin
  if n <= 1 then
    Result := n                            // base cases: F(0)=0, F(1)=1
  else
    Result := Fibonacci(n - 1) + Fibonacci(n - 2);
end;

Recursion vs Iteration

RecursionIteration (loop)
How it worksFunction calls itselfLoop repeats a block
Code clarityOften more elegant for naturally recursive problemsUsually easier to trace and debug
Memory useUses call stack (risk of stack overflow for large n)Constant memory use
SpeedCan be slower due to function call overheadGenerally faster
Best forTree traversal, divide-and-conquer algorithmsSimple counting and totalling

Key Rules for Writing Recursive Functions

  1. Always define a base case that returns a value without calling itself
  2. Each recursive call must move toward the base case (e.g. decrease n by 1)
  3. Test with small values first — trace through manually
  4. Use a function (not procedure) so it can return a value
Grade 12 · Theory

Data Collection & Warehousing Grade 12

Modern databases are fed by many automated data collection methods. Large organisations store historical data in warehouses for analysis and decision-making.

T1Term 1 · Data Collection & Warehousing

Methods of Data Collection

Data collection is the process of gathering raw facts and figures from many different sources so that they can be stored, processed and turned into useful information. In the old days a person sat with a clipboard and wrote everything down by hand. Today most data is collected automatically — every time you swipe a card, drive under an e-toll gantry or tap a website, data is being captured about you without anyone writing a single thing.

WHY THIS MATTERS

A database is only as good as the data inside it. The more accurate, complete and up-to-date the collected data is, the better the decisions an organisation can make. Automated collection means more data, collected faster, with fewer human mistakes.

Example: When you scan your Pick n Pay Smart Shopper card at the till, the shop instantly records what you bought, when, where and for how much — that single swipe feeds a database that the shop later uses to send you targeted specials.

MethodDescriptionExample
Forms (manual)User types data directly into a formSchool registration, job application
Web formsOnline interactive pages with GUI components (dropdowns, checkboxes)Online survey, account sign-up
RFID tagsWireless chips store ID data, read without contactLibrary books, inventory, e-toll, access cards
Digital sensorsGather environmental data automaticallyTemperature sensors, motion detectors
CookiesSmall files stored by websites to record browsing behaviour and preferencesLogin sessions, shopping carts, ad targeting
Transaction trackingRecords each purchase: date, time, location, product, amountCredit card transactions, loyalty cards
Mobile appsCollect app usage, location, device dataUber location tracking, fitness app steps

Static vs Dynamic Location Data

TypeDescriptionExample
StaticFixed, does not change once recordedAddress of a shop, GPS coordinates of a landmark
DynamicChanges as the object moves, updated continuouslyUber driver location, delivery truck tracking

Data Warehousing

A data warehouse is a large central storage system that collects and consolidates historical data from many separate source databases into one single place, so that it can be analysed for trends and decision-making.

Think of it like this: a normal database is like the till at one Pick n Pay branch — it records today's sales as they happen. A data warehouse is like head office in Cape Town, where the sales from every branch in the country, going back many years, are all poured into one giant store. Head office does not use this to ring up a sale; they use it to spot the big picture — which products sell best in winter, which branches are growing, where to open the next store.

KEY CHARACTERISTICS

Central – one single store that brings many sources together.
Historical – it keeps years of old data, not just today's transactions.
Read-mostly – data is loaded in and then read for reports; it is not constantly changed.
Subject-oriented – organised around topics like "sales" or "customers" for easy analysis.

Note: Because a warehouse holds so much data from so many sources, the data must first be cleaned and put into a consistent format before it is loaded in — otherwise the same customer might appear three different ways and the analysis would be wrong.

DatabaseData Warehouse
PurposeDay-to-day transactionsHistorical analysis and reporting
DataCurrent transactions onlyHistorical data from many sources
OperationsRead + write (INSERT, UPDATE, DELETE)Mostly read (SELECT, reports)
Used byOperational staffAnalysts, management, BI tools

Data Mining

Data mining is the process of analysing very large datasets to discover hidden patterns, trends and useful relationships that a human could never spot by eye. The name is a good clue: just as a gold miner digs through tonnes of rock to find a few grams of gold, data mining digs through millions of records to find the valuable nuggets of knowledge buried inside.

Why Do Companies Mine Data?

Companies collect enormous amounts of data, but raw data on its own is useless — it is just numbers and words. Data mining turns that raw data into insight they can act on. For example, Pick n Pay's Smart Shopper data might reveal that customers who buy nappies on a Friday evening also tend to buy snacks — so the shop places those products near each other and increases sales. Nobody told the computer to look for that link; the pattern was mined out of the data.

Process

  1. Extract relevant data — use SQL to pull only the required subset
  2. Look for patterns — analyse for trends, correlations, anomalies
  3. Discover knowledge — turn patterns into actionable insights

Applications

Caring for Data

Caring for data means protecting the accuracy, security and availability of an organisation's data throughout its life. Data is one of the most valuable assets a company owns — often worth more than its buildings or equipment — because decisions, money and reputations all depend on it. Poor data leads to poor decisions, and lost data can shut a business down completely.

IMPORTANT RULE

"Garbage in, garbage out." If incorrect data goes into the system, only incorrect information can come out — no matter how clever your analysis is. This is why validation and verification at the point of capture are so important.

Below are the main ways an organisation looks after its data. Notice how each one protects against a different danger — wrong data, lost data, or stolen data.

Grade 12 · Theory

Relational Databases & Normalisation Grade 12

A relational database stores data in structured tables linked together. Normalisation is the process of cleaning up a database design to remove repetition and prevent errors.

T1Term 1 · Relational Databases & Normalisation

What is a Relational Database?

A relational database stores data in tables (also called relations). Each table represents one type of thing — for example, a table for students, a separate table for subjects. Tables are then linked together using key fields.

tblStudents StudentID Name ClassID 🔑 1 Alice C01 2 Bob C02 3 Carol C01 PK: StudentID FK: ClassID → tblClasses FK links to PK tblClasses ClassID ClassName 🔑 C01 12A C02 12B PK: ClassID

Key Fields

Key TypeDescriptionExample
Primary Key (PK)Uniquely identifies each record. No duplicates, no blanks.StudentID in tblStudents
Foreign Key (FK)A field that links to the primary key of another table. Creates the relationship.ClassID in tblStudents → links to tblClasses
Composite KeyTwo or more fields combined to create a unique identifierStudentID + SubjectID in tblMarks
Alternate KeyCould be a primary key but wasn't chosen as oneEmail address (also unique, but ID was chosen as PK)

Referential Integrity

Referential integrity is a rule that ensures relationships between tables remain consistent. It means: a foreign key value must always match an existing primary key value in the related table.

Example of violating referential integrity

If ClassID C03 doesn't exist in tblClasses, you cannot add a student with ClassID = C03. The database will reject this to prevent orphan records (records with no matching parent).

Entity Relationship Diagram (ERD)

An ERD is a diagram that shows the entities (tables) in a database and the relationships between them. Each box is a table; the line between boxes shows how they relate. You are often asked to draw one in the exam, so practise the crow's-foot notation below.

tblBooks BookID (PK) Title Author Genre 1 tblLoans LoanID (PK) BookID (FK) DateBorrowed DateReturned

The relationship is created by putting the primary key of the "one" table into the "many" table as a foreign key (here BookID links tblBooks to tblLoans).

Types of Relationships

RelationshipMeaningExample
One-to-One (1:1)One record links to exactly one record in the other tableOne person ↔ one ID number
One-to-Many (1:∞)One record links to many records in the other tableOne book can appear in many loans
Many-to-Many (∞:∞)Many records link to many records — resolved with a third "link" tableStudents ↔ Activities (via a link table)
Many-to-many needs a link table

A relational database can't store a many-to-many relationship directly. You break it into two one-to-many relationships using a junction/link table (e.g. tblLoans links books and borrowers).

Physical vs Logical Integrity

TypeWhat it protectsHow it is ensured
Physical integrityThe data is not lost or damaged by hardware failure, power loss or disasterRAID, UPS, regular backups, off-site storage
Logical integrityThe data stays correct, consistent and valid within the databaseValidation rules, referential integrity, record locking
Record locking

Record locking temporarily "locks" a record while one user is editing it, so that a second user cannot change the same record at the same time. This prevents two users overwriting each other's changes and keeps the data consistent (a key way to protect logical integrity in a multi-user database).

Database Anomalies

When a database is poorly designed (not normalised), three types of errors can occur when working with data:

AnomalyWhen it happensExample
Insertion anomalyYou can't add new data without first adding other unrelated dataCan't add a new class until at least one student enrols in it
Deletion anomalyDeleting one record accidentally removes other important dataDeleting the only student in a class also deletes the class's information
Modification anomalyChanging one value means updating many rows — and missing some creates inconsistencyA teacher's name appears in 50 student records; update one and the others are wrong
The fix: Normalisation

Normalisation splits large, messy tables into smaller, focused tables and links them properly. This eliminates all three anomalies.

Normalisation — The Three Normal Forms

Normalisation is the systematic process of organising the fields and tables of a relational database, by applying a set of rules called normal forms, in order to reduce data redundancy and prevent insertion, deletion and modification anomalies.

Think of it this way

Imagine one giant spreadsheet where every order repeats the customer's full name, address and phone number. If a customer moves house you must change it in dozens of rows — and if you miss one, the data disagrees with itself. Normalisation is like splitting that mess into tidy, single-topic tables: one Customers table (each customer stored once) and one Orders table that just points back with the customer's ID (a foreign key). Now a change is made in one place only. The three normal forms are simply three tidy-up rules you apply in order.

First Normal Form (1NF)

A table is in 1NF when:

Not in 1NF:

StudentIDNameSubjects
1AliceMaths, IT, English

❌ Problem: Three values in one cell (Subjects column)

In 1NF:

StudentIDNameSubject
1AliceMaths
1AliceIT
1AliceEnglish

Second Normal Form (2NF)

A table is in 2NF when it is in 1NF AND every non-key field depends on the whole primary key (not just part of it). This only matters when the primary key is a composite key.

Example violation:

StudentID (PK)SubjectID (PK)StudentNameMark
1ITAlice85

❌ Problem: StudentName only depends on StudentID, not on (StudentID + SubjectID) together

In 2NF — split the table:

StudentID (PK)StudentName
1Alice
StudentID (PK+FK)SubjectID (PK)Mark
1IT85

Third Normal Form (3NF)

A table is in 3NF when it is in 2NF AND no non-key field depends on another non-key field (no transitive dependency).

Example violation:

StudentID (PK)NameGradeLevelGradeDescription
1Alice12Matric

❌ Problem: GradeDescription depends on GradeLevel (a non-key field), not on StudentID

In 3NF — split it:

StudentID (PK)NameGradeLevel (FK)
1Alice12
GradeLevel (PK)GradeDescription
12Matric

Quick Normalisation Checklist

Normal FormCheck forFix by
1NFMultiple values in one cell? Repeating columns?Split into separate rows; add PK
2NFNon-key field depends on only PART of the composite PK?Move that field to its own table
3NFNon-key field depends on another non-key field?Move the dependency to its own table

Good Database Characteristics

CharacteristicMeaning
Data integrityData is accurate, consistent and complete throughout its lifecycle
Data independenceChanging the database structure doesn't break the programs that use it
Data redundancyMinimum — the same data should not be stored in multiple places
Data securityOnly authorised users can access or modify data
Ease of maintenanceThe database design makes it simple to insert, update and delete without causing problems
Grade 12 · Theory

Hardware & Performance Grade 12

Mobile device hardware, factors that affect computer performance, and choosing the right system for a user's needs.

T1Term 1 · Mobile Hardware & Performance Factors

Mobile Technology Hardware

Smartphones have similar hardware to desktops but in miniaturised form. Key differences:

ComponentDesktopSmartphone
CPUSeparate chip; very powerful; many coresSoC (System on a Chip) — CPU+GPU+modem+RAM in one chip
InputKeyboard and mouseTouchscreen; virtual keyboard
DisplayLarge external monitorSmall built-in touchscreen
ConnectivityWired NIC or Wi-Fi cardBuilt-in Bluetooth, Wi-Fi, 4G/5G, GPS, NFC
BatteryPlugged in; no battery constraintLimited battery; performance vs battery trade-off

Mobile Constraints

Factors Influencing Computer Performance

FactorHow it affects performance
CPU clock speed (GHz)Higher = more instructions per second; faster processing
CPU coresMore cores = better multitasking and parallel processing
RAM amount and speedMore RAM = more programs running simultaneously; higher speed = faster data transfer to CPU
Cache size (L1/L2/L3)Larger cache = CPU waits less for data from RAM
GPU clock speedHigher GPU speed = faster graphics rendering; important for gaming and video
Storage type (HDD vs SSD)SSD gives dramatically faster boot times and application loading
NIC speed (Mbps)Faster NIC = faster downloads, streaming, network file transfers
Operating systemOutdated OS causes compatibility issues, security risks and slower operation

HDD vs SSD — Summary

FeatureHDDSSD
SpeedSlow (mechanical)Very fast
DurabilityFragile (moving parts)Durable (no moving parts)
NoiseAudible spinningSilent
Cost per GBCheaperMore expensive
Boot timeLong (30–60 seconds)Very short (5–15 seconds)

Motivating a Computer System for a User

When recommending a computer, match the components to the user's needs:

User typeRecommended specs
Office/admin workerModerate CPU, 8GB RAM, SSD, integrated graphics
Graphic designer / video editorFast multi-core CPU, 16–32GB RAM, dedicated GPU, large SSD
GamerFast CPU, 16GB+ RAM, high-end dedicated GPU, fast SSD
StudentMid-range CPU, 8GB RAM, SSD, Wi-Fi, long battery (laptop)
Server / database hostMany cores, large ECC RAM, RAID storage, redundant power
Grade 12 · Theory

Cloud Computing, AI, VR & AR Grade 12

Grade 12 Term 2 theory: cloud computing, Artificial Intelligence, Virtual Reality, Augmented Reality, Mixed Reality and virtualisation — all new Software topics in the updated CAPS.

T2Term 2 · Cloud Computing, AI, VR & AR

Artificial Intelligence (AI)

AI refers to computer systems that can perform tasks that normally require human intelligence — such as learning, reasoning, decision-making and pattern recognition.

What is AI used for?

Advantages of AI

Disadvantages and Limitations of AI

Cloud Computing

Software, storage and computing power delivered as a service over the Internet, rather than installed locally.

ANALOGY — cloud computing is like electricity

You don't build a power station in your back yard — you just plug into the wall and pay for what you use, and someone else runs the generators. Cloud computing works the same way: instead of buying and maintaining your own servers, you rent storage and computing power from a provider (Google, Microsoft, Amazon) over the internet and pay only for what you use. It scales up when you need more and down when you don't, exactly like drawing more or less electricity from the grid.

AdvantageDisadvantage
Scalable — capacity grows automaticallyRequires internet connection
Affordable — pay only for what you useDowntime affects all users
Accessible from any device anywhereSecurity and privacy concerns
Maintained by experts; always updatedOngoing subscription costs
Easy collaboration between usersLimited control over infrastructure

SaaS — Software as a Service

Applications accessed via browser with no local installation. Examples: Google Docs, Microsoft 365, Gmail.

Effect on Hardware

Cloud reduces the need for powerful local hardware — thin clients and low-spec devices can run complex software via the cloud. Businesses no longer need to buy expensive servers.

Virtualisation

Running multiple virtual machines on a single physical computer. Each VM has its own OS, RAM, storage and apps, isolated from others.

Benefits

Virtual Reality (VR)

A fully artificial, immersive 3D environment created by software. The user is completely cut off from the real world.

Use CaseExample
TrainingMilitary simulations, surgical training
EducationVirtual field trips, interactive lessons
EntertainmentVR gaming, virtual cinemas
HealthcarePhobia treatment, pain management
EngineeringVirtual prototypes, architectural walkthroughs

Hardware Requirements for VR

Limitations of VR

Augmented Reality (AR)

Overlays computer-generated content on the real world — you still see reality, with digital elements added.

Use CaseExample
RetailPreview furniture in your room before buying
TrainingStep-by-step repair instructions overlaid on equipment
NavigationAR arrows overlaid on road view
MarketingInteractive product advertisements

Hardware Requirements for AR

Limitations of AR

Grade 12 · Theory

Internet Technologies Grade 12

How the web works under the hood — search technologies, web technologies, online applications, and how data is stored and processed online.

T3Term 3 · Internet & Web Technologies

Search Technologies

TypeDescription
Keyword searchMatches exact words in the query
Semantic searchUnderstands meaning and context behind words — interprets user intent, not just keywords
Mediated searchA middleman system filters results for a specific database or organisation (e.g. Google Scholar)
SEOSearch Engine Optimisation — techniques to make websites rank higher in search results (keywords, speed, mobile-friendly, backlinks)

Static vs Dynamic Websites

StaticDynamic
ContentFixed HTML — changes only if developer edits filesGenerated on demand from a database
DatabaseNoYes
ExamplesSimple portfolio, business info pageOnline shop, social media, news sites
Security riskLowHigher (SQL injection, data breaches)

Web Technologies

TechnologyRoleExample
HTMLStructure and content of web pagesHeadings, paragraphs, links, images
CSSVisual styling — colours, fonts, layoutBlue buttons, responsive grid
JavaScriptClient-side interactivity; runs in the browserForm validation, dropdown menus, AJAX
PHPServer-side scripting; processes forms, talks to databasesLogin authentication, database queries
SQLQuery and manage database dataSELECT user data, INSERT orders
XMLStructured data exchange between systemsProduct data feeds between websites

Storing Data Online

Running Instructions

Client-side (browser)Server-side (web server)
LanguageJavaScript, AJAXPHP, Python, Node.js
PurposeReal-time page updates, validation, animationsAuthentication, database access, processing
AJAXUpdates parts of a page without reloading

HTTP vs HTTPS

HTTPHTTPS
EncryptionNone — data sent in plain textSSL/TLS encryption
PadlockNo padlock in browserPadlock icon shown
UseNon-sensitive public pagesLogin, banking, shopping — any sensitive data
Grade 12 · Theory

Networks & Remote Access Grade 12

Essential network components, internet connection methods, file sharing, and remote access technologies.

T3Term 3 · Networks & Remote Access

Essential Network Hardware

ComponentFunction
NICNetwork Interface Card — hardware that connects a device to a network (wired or wireless)
SwitchConnects devices on a LAN and forwards data only to the intended device (not broadcast like a hub)
RouterConnects different networks; routes packets; assigns IP addresses; acts as gateway to ISP
ModemConverts digital signals to analogue for telephone lines (and back); connects to ISP
Wireless access pointEnables wireless devices to connect to a wired network via Wi-Fi
All-in-one home routerCombines modem + router + switch + Wi-Fi access point in one device

Wired Communication Media

MediumSpeedRangeNotes
UTP cable (Ethernet)Up to 10 Gbps100m per segmentCommon in offices and schools; easy to install
Fibre opticUp to TbpsKilometresUses light; most secure; expensive to install
CoaxialModerateHundreds of metersOlder standard; still used in some broadband

Connecting to the Internet

TechnologyDescriptionSpeed
ADSLUses telephone copper lines; download faster than uploadUp to ~20 Mbps
FibreLight through fibre optic cables; fastest and most reliable100 Mbps–1 Gbps+
WiMAXLong-range wireless; used in rural/remote areasModerate
4G/LTEMobile broadband; widely available5–100 Mbps
5GNew generation mobile; very low latency; supports IoT50 Mbps–10 Gbps

File and Folder Sharing

On a network, users can share resources. Access can be restricted by permission level:

Permission LevelWhat the user can do
No accessCannot see the shared resource
Read-onlyCan view/copy files but not modify or delete
Read/WriteCan view, copy, modify files
Full control (Admin)Can do everything including change permissions

Remote Access

Accessing a device or network from a physically different location.

ANALOGY — a VPN is an armoured van

Sending private data across the open internet is like carrying cash through a busy public street — anyone could grab it. A VPN is like an armoured van driving through that same street: it builds a sealed, encrypted "tunnel" so that, even though your data travels over the public internet, no one on the outside can see or reach what is inside. That is how an employee at home can safely reach the private company network.

TypeDescriptionExample
LAN remote accessAccess another computer in the same buildingShared folder on school server
Internet remote accessAccess home/work resources from anywhereGoogle Drive, OneDrive, Remote Desktop
VPNEncrypted tunnel over internet; secure remote access to private networkEmployee working from home via company VPN

Cloud Storage and Sharing

BitTorrent (Peer-to-Peer Sharing)

Files are split into small pieces and downloaded simultaneously from many peers.

Grade 12 · Theory

Communication Technologies Grade 12

This page focuses on how data is kept safe as it travels across a network — VPNs, encryption, digital certificates and authentication. For network hardware, internet access technologies and general remote access, see Networks & Remote Access.

T3Term 3 · VPNs, Encryption & Secure Communication

VPN — Virtual Private Network

A VPN creates an encrypted tunnel over the Internet, allowing secure remote access to a private network. (See Networks & Remote Access for the armoured-van analogy and a worked example.)

Encryption & Security

ConceptDescription
EncryptionConverts readable data into unreadable code. Only someone with the correct key can decrypt it.
SSL/TLSProtocol securing communication between browser and server (HTTPS). Uses public/private key pairs.
Digital certificateIssued by a trusted Certificate Authority. Verifies the website is legitimate.
FirewallFilters incoming and outgoing traffic based on security rules
MFAMulti-Factor Authentication — requires password + second factor (OTP, fingerprint)
OTPOne-Time PIN — valid for one login only; prevents replay attacks

Email & Messaging Security

ConceptDescription
Spam filteringAutomatically detects and quarantines unsolicited/junk email before it reaches the inbox
Email encryptionEncrypts the message content so only the intended recipient's key can decrypt and read it
End-to-end encryptionUsed by apps like WhatsApp/Signal — only the sender and recipient can read the message, not even the service provider
Digital signatureConfirms a message really came from the claimed sender and was not altered in transit
Grade 12 · Theory

Cybercrime & Safeguards Grade 12

Types of cybercrime, the people who commit them, their effects on individuals and organisations, and the safeguards used to prevent them.

T2Term 2 · Cybercrime Types & Safeguards

Computer Criminals

TypeDescription
HackerGains unauthorised access to systems. White hat (ethical) vs Black hat (malicious).
CrackerBreaks software protection or encryption for illegal access or distribution
Script kiddieUses pre-written tools without understanding them; less skilled
Insider threatCurrent or former employee who misuses access privileges
CybercriminalCommits crime for financial gain (fraud, ransomware, identity theft)
Cyber gangAn organised group of criminals who work together to carry out large-scale cyberattacks
Virus authorA person who writes and releases malware such as viruses and worms

Types of Cybercrime

CrimeDescription
Identity theftStealing personal information to impersonate someone (open accounts, get loans)
PhishingFake emails that look official to steal credentials
PharmingRedirecting users to fake websites to steal information
RansomwareEncrypts victim's data; demands payment to restore access
Business data theftStealing trade secrets, customer databases, or financial records
SQL InjectionInserting malicious SQL via web forms to manipulate or steal database data
DDoS attackDistributed Denial of Service — overwhelming a server with traffic to take it offline
Online fraudScams, fake auctions, advance-fee fraud (419 scams)
CyberbullyingHarassment, threats or humiliation via digital channels
PiracyIllegally copying, distributing or using copyrighted software/media
Bandwidth theftUsing someone else's network/internet connection, or hotlinking their content, without permission
Theft of time & servicesUsing an employer's computers, internet or work time for personal or unauthorised purposes
Botnet / zombiesA network of infected computers ("zombies") secretly controlled by an attacker, often used for DDoS attacks or spam
Back doorA hidden way to bypass normal security and gain remote access to a system

Effects of Cybercrime

On Individuals

On Businesses

Safeguards Against Cybercrime

SafeguardHow it protects
Antivirus / AntimalwareDetects and removes malicious software
FirewallFilters unauthorised network traffic
EncryptionScrambles data so intercepted data is unreadable
Strong passwords + MFAMakes accounts much harder to compromise
Regular backupsAllows recovery after ransomware or data loss
Software updates / patchesFixes known vulnerabilities before criminals exploit them
User training / awarenessEducated users are less likely to click phishing links
Access controlLeast-privilege principle: users only access what they need
Input validationPrevents SQL injection by sanitising user input
Digital certificates + HTTPSVerifies website legitimacy; encrypts all data in transit

SA Legal Context

In South Africa, cybercrime is covered by:

Grade 12 · Theory

Social Implications Grade 12

How Big Data, data warehousing, globalisation and the 4IR affect society — privacy, employment, social media and the evolution of the web.

This topic comes back all year

Social implications are revisited every term rather than taught once. The sections below are grouped by the term where each topic is introduced on the Year Planner — but all of it stays examinable afterwards. A few sections (globalisation, decision-making systems, protecting your identity) don't map to a single Year Planner bullet, so they are grouped with the closest related term.

T1Term 1 · Big Data, Mining & Decision-Making

Social Implications of Big Data & Data Mining

Big Data is the term for datasets so enormous, fast-moving and varied that ordinary database tools cannot store or process them — think of every Facebook post, every WhatsApp message and every e-toll swipe in the country, all at once. When companies and governments mine this Big Data, the results affect real people's lives, and that brings both wonderful benefits and serious dangers.

Why Should We Care?

The same data that lets a hospital predict and prevent illness can also let an insurance company refuse you cover because your shopping habits suggest you eat unhealthily. The technology is neutral — it is how the data is used that creates the social problem. As IT students you must be able to argue both sides.

PositiveNegative
Healthcare: predict and prevent illnessPrivacy erosion — habits tracked without full consent
Fraud detection in bankingDiscrimination based on data profiles
Personalised education programmesSecurity breaches expose millions of records
Better government servicesData sold to third parties without user knowledge
Precision agriculture: monitoring soil, weather and crop data to improve yields (e.g. a Free State maize farmer using sensor data to decide when to irrigate)Small-scale farmers without access to this technology fall further behind larger commercial operations

Globalisation and the 4IR

AspectEffect
GlobalisationWorld interconnected economically and culturally; faster trade; outsourcing; cultural exchange; increased competition
4IR technologiesAI, machine learning, IoT, robotics, automation, biotechnology, AR/VR, Big Data
JobsRoutine jobs replaced by machines; new careers in data science, AI, cybersecurity
WorkersMust reskill constantly; digital literacy essential

Decision-making & Knowledge Systems

As the amount of data in the world explodes, organisations increasingly rely on software not just to store data, but to help people make decisions with it. Two related kinds of system come up in the exam, and they are easy to confuse.

SystemWhat it doesExample
Decision Support System (DSS)Analyses large amounts of data and presents it in a useful way (summaries, graphs, "what-if" models) so that a human can make a better-informed decision. It supports the decision — it does not make it.A retail manager using sales dashboards to decide which stores to stock for winter
Expert / knowledge-based systemCaptures the knowledge of human experts as a knowledge base of facts plus a set of rules (an inference engine), then uses them to give advice or a diagnosis — mimicking how an expert reasons.A medical system that suggests likely diagnoses from a patient's symptoms
DSS vs Expert system

A DSS hands the data to a person to decide; an expert system tries to reach the conclusion itself using stored expert knowledge. Both rely on good-quality data — "garbage in, garbage out".

T2Term 2 · Computer Management

Computer Management (Gr 12)

Key factors affecting computer performance and maintenance:

T3Term 3 · Global Problem-Solving, Social Media & Privacy

Distributed Computing Power — Solving Global Problems

Some problems are too big for any single computer — modelling climate change, searching for new medicines, or analysing astronomical data. Distributed computing splits one enormous task into many small pieces and shares them across thousands of computers (or cloud servers) that work on them at the same time, then combines the results.

Evolution of Social Media and its Effects

Privacy and Information Sharing

ConceptPrivacy implication
CookiesTrack browsing behaviour; can be used for targeted advertising
AnonymityEnables free expression; also enables cyberbullying and illegal activity
GUIDsGlobally Unique Identifiers track behaviour across websites and apps
Location dataApps continuously track movement; risk of stalking and profiling
File sharingPiracy is illegal and harms creators; but sharing also enables legal distribution

Protecting Your Online Identity

Grade 12 · Term Planner

Grade 12 — Year Planner Grade 12

Based on the 2026 IT CAPS. Grade 12 introduces SQL (Term 1), OOP & 2D arrays (Term 2). Paper 2 is cumulative across all Grades 10–12.

A year planner — not a test scope

This shows when each topic is taught during the year — it is not a list of what any single test covers. Any work done so far this year, plus the foundational work from earlier grades, can still be assessed, so don't study only the current term's topics.

Grade 12 Exam Structure

Paper 1 (3 hrs): Delphi programming — SQL, OOP, 2D arrays, recursion, file handling, arrays, general programming.
Paper 2 (3 hrs): All theory from Gr10–12.

T4
Term 4 • September – November — Final Exams
No new content — case studies, exam revision
🔬 Paper 1 High-Priority Areas
📘 Paper 2 High-Priority Areas
Grade 12 · Exam Resources

Exam Extras Out-of-CAPS

These topics are not explicitly required by CAPS but have appeared in NSC past papers (2015–2024). Knowing them can mean the difference between a pass and a distinction.

How to use this page

Items marked P1 appear in Paper 1 (practical/Delphi), P2 in Paper 2 (theory), and Both in either paper. These are supplementary — master your CAPS content first.

The Software Development Process

CAPS never teaches "how to plan a whole program" as one topic — instead it hands you the individual planning tools (IPO tables, TOE charts, pseudocode) at different points across Grade 10 and 11. Strung together in order, those tools form a complete process for turning a vague idea into a finished, working program. None of this is examinable on its own, but following it will make your PAT — and any open-ended practical question — far less overwhelming.

  1. Pin down exactly what the program must do. A one-line description ("a till program") is not enough to start coding from — write out every input the program will receive, every calculation or decision it must make, and every output it must produce. This is the same information an IPO table asks for (Grade 10 T1, Algorithms & Problem Solving), just applied to the whole program instead of one calculation.
  2. Sketch the interface before placing a single component. Decide which forms the user will see, what components sit on each one, and how the user moves between them. Keep the same layout, colours and button placement on every form — a program that looks different from screen to screen feels unfinished even when the code is solid.
  3. Map out which event triggers which task. For every button, checkbox or form event, list precisely what must happen when it fires — this is exactly what a TOE (Task–Object–Event) chart is for (also covered on the Algorithms & Problem Solving page). Doing this before writing code stops the common mistake of half-remembering what a button was supposed to do halfway through typing its handler.
  4. Break the plan into procedures and functions before typing the body of any of them. Decide which pieces of logic will repeat, which need a return value and which don't, and what needs to pass between them as parameters — this is where the Procedures & Functions (Grade 11 T2) content and the local-vs-global variable rules on that page earn their keep.
  5. Write the code in small, testable pieces rather than the whole program at once — build and run after every procedure or two so that when something breaks, you know it's in the last few lines you typed, not buried somewhere in 200 lines you haven't tested yet.
  6. Test with data designed to break it, not just data that works. Run the program with an empty text box, a negative number, the largest and smallest values it should accept, and anything else a careless user might type — this is the mindset behind the Input Validation content (Grade 10 T2). Where something goes wrong before you can even see the output, Delphi's debugger (breakpoints, F8 stepping, the Watch List — see Data Types & Variables) will show you exactly which line is responsible.
Why bother with all of this for a PAT?

A PAT is marked over months, revisited many times, and often built on by a partner or by future-you after a long break. Time spent planning up front — even just a page of notes on what each form does — is what makes it possible to pick the project back up in Term 4 and still understand your own Term 2 code.

Practical Extras — Paper 1 (Delphi)

These Delphi functions, components and techniques are not listed in CAPS but appear regularly in exam questions or are needed to solve exam problems efficiently.

P1

StringReplace()

Replaces all or first occurrence of a substring within a string.
s := StringReplace(s, 'old', 'new', [rfReplaceAll]);

P1

TStringList

A powerful list of strings — very useful for loading file lines into memory.
sl := TStringList.Create; sl.LoadFromFile('data.txt'); sl.Free;

P1

Format() function

Formats numbers/strings with precise control — Format('%.2f', [rVal]) gives 2 decimal places. More powerful than FloatToStrF.

P1

Random() & Randomize()

Generate random integers. Always call Randomize; first to seed the generator. Random(100) returns 0–99.

P1

TOpenDialog / TSaveDialog

Let users browse for files at runtime.
if OpenDialog1.Execute then sFile := OpenDialog1.FileName;

P1

DateToStr() & StrToDate()

Convert between TDate values and string representation. Used with TDateTimePicker.
sDate := DateToStr(dtpDate.Date);

P1

Try…Except…End (Exception Handling)

Catch runtime errors gracefully — e.g. invalid StrToInt input.
try iNum := StrToInt(edtNum.Text); except ShowMessage('Invalid'); end;

P1

Memo.Lines.Count

Returns the number of lines in a Memo. Often used in loops to process all memo lines.
for i := 0 to Memo1.Lines.Count - 1 do

P1

SameText() / CompareText()

Case-insensitive string comparison — avoids problems when user types 'yes', 'YES' or 'Yes'.
if SameText(sInput, 'yes') then

P1

IntToHex() & HexToInt()

Convert integers to hexadecimal strings and back. Sometimes tested in conjunction with number systems theory.
sHex := IntToHex(255, 4); // = '00FF'

P1

Odd() & Even() functions

Built-in boolean checks — cleaner than MOD 2.
if Odd(iNum) then // true if iNum is odd

P1

Break & Continue in loops

Break exits the loop immediately. Continue skips to the next iteration. Both appear in exam solutions — know the difference.

Theory Extras — Paper 2

These theory topics have appeared in NSC Theory papers but sit at the edge of or outside the formal CAPS scope. They typically appear in social implications or "current technology" questions.

P2

Artificial Intelligence (AI) & Machine Learning

AI appears regularly in social implications questions — automation of jobs, AI decision-making, bias in AI, chatbots. Not deeply technical — understand the concept and its social effects.

P2

Blockchain Technology

A distributed digital ledger of linked blocks. Used in cryptocurrency, supply chain, and secure records. Appeared in Gr12 theory papers. Know: what it is, how it works, and 2 uses.

P2

Deep Fakes

AI-generated fake videos or audio that appear authentic. Social implications question topic — impacts on trust, truth, and politics. Know the definition and two risks.

P2

Dark Web

A part of the internet not indexed by search engines, accessed via special software (Tor). Used for anonymity — legal and illegal uses. Appeared in theory cybercrime questions.

P2

Net Neutrality

The principle that all internet traffic should be treated equally — ISPs cannot throttle or prioritise certain content. A social/political IT topic.

P2

IPv6

The successor to IPv4 — uses 128-bit addresses (vs 32-bit) to solve address exhaustion. Format: 2001:0db8:85a3::8a2e:0370:7334. Know why it was introduced.

P2

RAID Levels (0, 1, 5)

RAID 0: speed (striping, no redundancy). RAID 1: mirroring (exact copy). RAID 5: striping with parity (balance of speed + fault tolerance). CAPS only mentions RAID in general — exams go deeper.

P2

Steganography

Hiding secret information within ordinary files (images, audio) without detection. Different from encryption — encryption scrambles data; steganography hides its existence. Appeared in theory questions.

P2

Smart Contracts

Self-executing contracts where terms are written in code on a blockchain. No middlemen needed. Related to blockchain technology — appeared in Gr12 social implications.

P2

Edge Computing

Processing data close to where it is generated (the "edge" of the network) rather than sending it all to a central cloud server. Reduces latency — important for IoT and 5G.

P2

Bus Network Topology

All devices share a single communication line (the bus). Not in the current CAPS but appeared in older papers. Advantage: cheap. Disadvantage: single point of failure; performance drops with more devices.

P2

Mesh Network Topology

Each device connects to several others, so data has more than one possible path. Not in the current CAPS (it sits under "network innovation"). Advantage: very reliable — traffic reroutes if a link fails. Disadvantage: expensive, many connections needed. It's how "mesh Wi-Fi" systems work.

P2

Social Engineering

Manipulating people (rather than systems) to reveal confidential information. Includes pretexting, baiting, tailgating. Appears in cybercrime theory questions.

Both

Number System Conversions

Exams frequently ask you to convert values — not just explain systems. Practise: decimal↔binary, decimal↔hex, binary↔hex. Know the place values (powers of 2 and 16).

P2

POPIA (Protection of Personal Information Act)

South African law governing how personal data must be collected, stored, and protected. Appears in privacy and legal implications questions. Know: what it is, who it protects, and 2 requirements.

P2

Cybercrimes Act (2020)

SA legislation that criminalises hacking, ransomware, online fraud, and malicious communications. Often referenced in cybercrime theory questions for Gr12.

P2

Digital Twins

A virtual replica of a physical object or system, updated in real time from sensor data. Used in engineering, manufacturing, and smart cities. Appeared in 4IR/IoT questions.

Complete Delphi Functions Quick Reference

A comprehensive reference of all Delphi functions you need to know — both CAPS-required and commonly appearing in exams.

String Functions

Function/ProcedureWhat it doesExample
Length(s)Returns number of charactersLength('Hello') = 5
Pos(find, source)Position of substring (0 if not found)Pos('lo','Hello') = 4
Copy(source, start, len)Extract substringCopy('Hello',2,3) = 'ell'
Insert(text, var s, pos)Insert text into string at positionInsert('!','Hello',6) → 'Hello!'
Delete(var s, pos, len)Remove characters from stringDelete(s,1,3)
UpperCase(s)All uppercaseUpperCase('hi') = 'HI'
LowerCase(s)All lowercaseLowerCase('HI') = 'hi'
Trim(s)Remove leading/trailing spacesTrim(' Hi ') = 'Hi'
StringReplace(s,old,new,flags)Replace substring(s)StringReplace(s,'a','e',[rfReplaceAll])
SameText(s1,s2)Case-insensitive comparison (boolean)SameText('Yes','yes') = True
Concat(s1,s2)Join two strings (same as +)Concat('Hel','lo')
s[i]Character at index i (1-based)s[1] = first character

Math Functions

FunctionWhat it doesExample
Sqr(x)x squared (x²)Sqr(4) = 16
Sqrt(x)Square rootSqrt(16) = 4
Power(base, exp)base to the power of expPower(2,8) = 256
Round(x)Round to nearest integerRound(4.6) = 5
Trunc(x)Remove decimal (truncate toward zero)Trunc(4.9) = 4
Ceil(x)Round UP to integerCeil(4.1) = 5
Floor(x)Round DOWN to integerFloor(4.9) = 4
Abs(x)Absolute valueAbs(-5) = 5
Random(n)Random integer 0 to n-1Random(6)+1 simulates a die
RandomizeSeed the random generator (call once)Call before Random()
Inc(x) / Inc(x,n)Increment by 1 or nInc(i) ≡ i := i+1
Dec(x) / Dec(x,n)Decrement by 1 or nDec(i,3) ≡ i := i-3
Odd(n)True if n is oddOdd(3) = True
PiReturns π (3.14159…)rArea := Pi * Sqr(r)

Type Conversion Functions

FunctionConvertsExample
StrToInt(s)String → IntegerStrToInt('42') = 42
StrToFloat(s)String → RealStrToFloat('3.14')
StrToIntDef(s, default)String → Integer (safe — returns default if invalid)StrToIntDef(edtNum.Text, 0)
IntToStr(n)Integer → StringIntToStr(42) = '42'
FloatToStr(r)Real → StringFloatToStr(3.14)
FloatToStrF(r, fmt, digits, dec)Formatted real → StringFloatToStrF(r, ffFixed, 6, 2)
Ord(c)Char → Integer (ASCII value)Ord('A') = 65
Chr(n)Integer → CharChr(65) = 'A'
UpCase(c)Single char to uppercaseUpCase('a') = 'A'
IntToHex(n, digits)Integer → Hex stringIntToHex(255,2) = 'FF'
DateToStr(d)TDate → StringDateToStr(Now)
FormatFloat(fmt, r)Real → formatted stringFormatFloat('#,##0.00', 1234.5)

Past Paper Patterns & Tips

Paper 1 (Practical) — What Always Appears

SectionWhat to expectCommon traps
Q1: General programmingStrings, loops, decisions, calculations (~30–40 marks)Off-by-one errors in loops; forgetting to initialise variables
Q2: Arrays & files1D/2D arrays, text file reading/writing (~20–25 marks)Using wrong index (0 vs 1-based); not closing file
Q3: OOPClass with constructor, accessors, mutators, toString (~25–30 marks)Calling Create on the object var (not class name); forgetting Result in functions
Q4: Database/SQLTADOQuery, SQL statements including JOIN (~20–25 marks)Not calling qry.Close before changing SQL; wrong JOIN ON condition
Recursion (Gr12)Write a recursive function; trace it (~10–15 marks)Missing base case; not returning Result

Paper 2 (Theory) — What Always Appears

TopicTypical mark allocationWhat examiners look for
Hardware & software15–20 marksSpecific advantages/disadvantages; real-world examples
Networks & internet20–25 marksCorrect terminology; topology advantages/disadvantages
Databases & normalisation20–30 marksCorrect normal form identification; proper primary/foreign key use
Social implications20–25 marksBalance of positive AND negative effects; specific examples
Cybercrime10–15 marks (Gr12)Correct crime type names; effects on both victim and business
Current technology (IoT, AI, VR)10–15 marks (Gr12)Practical application examples; social implications

General Exam Advice

Top 5 mark-saving habits
  • Read the question twice — "list" means bullet points, "explain" means a sentence or two
  • Never leave a practical question blank — partial marks are awarded for correct structure
  • In SQL: always check your WHERE condition matches the question's criteria exactly
  • In OOP: write the constructor first — it sets up all the attributes you'll use elsewhere
  • In theory: "advantage AND disadvantage" means you need both for full marks