← GOAT NOTESPreviewInformation Technology · Year SummaryENExam Revision →

INFORMATION TECHNOLOGY · GRADE 12

Year Summary: the whole Grade 10 to 12 subject in thirteen teaching sections, practical first. Delphi programming constructs, arrays, text files and algorithms coded from first principles, object-oriented programming and database programming for Paper 1; systems, networks, internet, data management, software engineering, social implications and emerging technologies for Paper 2; plus a full syntax, SQL and algorithm reference sheet.
CAPS-aligned · Distinction-level Notes
Information Technology · Grade 12 · Year Summary Date: TopJournal

Every distinction begins with one topic at a time.- start now

P1 (Practical) · Section A: Basic and General Programming · 40 marks
PAPER 1 · PRACTICAL PROGRAMMING CONSTRUCTS
⭐ EXAM FAVOURITE Section A is the first 40 marks of Paper 1 and it has been worth exactly 40 in every recent sitting. It is not one big program: it is a handful of short, separate tasks built on the same five ideas, which are declaring the right variable, calculating with the right operator, choosing with if or case, repeating with a loop, and displaying the answer in the format the question demands. Marking is per step, so code that does not compile still collects ticks for every correct line.

The compiler is not the marker.· every correct line earns its tick even when the program never runs

Paper 1 is written at a computer, one machine per candidate, in Delphi (Object Pascal). Since November 2017 the DBE has assessed no other language, so every line you practise is the language you will be marked in. Type your answers into the supplied project, save often, and print what you have rather than leaving a blank screen.

What you must be able to do

Data types, constants and scope

📖 KEY DEFINITION A variable is a named storage space whose value may change while the program runs; it is declared under var with a type that fixes what may be stored in it. A constant is declared under const, is given its value once, and may never be assigned to again. Assignment in Delphi is written :=, while a single = is a test for equality. Mixing those two up is a compile error, not a logic error.
TypeHoldsDeclared asWhat trips learners up
IntegerWhole numbers, positive or negativeiCount : Integer;Cannot hold 3.5; assigning a Real to it will not compile
RealNumbers with a decimal fractionrTotal : Real;Never use it for money you intend to compare exactly
BooleanTrue or False onlybPaid : Boolean;Writing if bPaid = True works but if bPaid is cleaner
CharExactly one charactercGrade : Char;Single quotes, so 'A', never "A"
StringAny number of characterssName : String;Indexed from 1, not from 0

Scope is the region of the program in which a declared name is visible. A variable declared inside a procedure is local: it is created when the procedure starts, destroyed when it ends, and no other procedure can see it. A variable declared at the top of the unit, outside every procedure, is global and every procedure in that unit can read and change it. Globals look convenient and behave badly, because any procedure can quietly overwrite one, so the fault shows up somewhere far from the line that caused it. Declare locally unless two event handlers genuinely have to share the value.

Operators, precedence, div and mod

⚠️ COMMON MISTAKE Using / where the question wants div is the single most reliable way to throw a mark away in Section A. In Delphi, / always produces a Real, even for 10 / 2, so it cannot be assigned to an Integer variable. div gives the whole-number part of a division and mod gives the remainder left over. Both work on integers only.
What div and mod actually return
  • 47 div 5 gives 9, the whole times 5 fits into 47
  • 47 mod 5 gives 2, what is left over
  • 47 / 5 gives 9.4, a Real value
  • 8 mod 2 gives 0, which is the standard test for an even number
Where they are used in a real question
  • Splitting 227 minutes: 227 div 60 is 3 hours, 227 mod 60 is 47 minutes
  • Packing 58 items into boxes of 12: 58 div 12 is 4 full boxes, 58 mod 12 is 10 left over
  • Testing divisibility: if iNum mod 3 = 0 means "is a multiple of 3"
  • Taking the last digit of a number: iNum mod 10
⚡ MUST MEMORISE Delphi evaluates in this order: brackets, then not, then * / div mod and, then + - or, then the comparisons. Two consequences bite in the exam. First, and binds tighter than =, so a compound condition such as if (iA > 5) and (iB < 3) must have brackets around each comparison or it will not compile. Second, when in doubt add brackets: they cost nothing and they never lose a mark.

Casting, rounding and formatting the output

Everything a user types into an Edit box arrives as a String, and everything you display must go back out as a String. Converting between the two is where the marks for "display the answer as R1 234,50" actually live.

FunctionTurnsExampleResult
StrToIntString into IntegeriQty := StrToInt(edtQty.Text);Raises an error if the text is not a whole number
StrToFloatString into RealrMass := StrToFloat(edtMass.Text);Respects the machine's decimal separator
IntToStrInteger into StringlblOut.Caption := IntToStr(iQty);'12'
FloatToStrFReal into a formatted StringFloatToStrF(rTot, ffFixed, 8, 2)'1234.50', fixed to 2 decimals
RoundReal into nearest IntegerRound(9.6)10
TruncReal into Integer by cuttingTrunc(9.9)9, the fraction is discarded, never rounded
FracReal into its fraction onlyFrac(9.25)0.25

The four arguments of FloatToStrF are the value, the format, the total width and the number of decimals, so ffFixed, 8, 2 reads as "fixed-point, at most 8 digits, exactly 2 after the point". Where a currency prefix is asked for, concatenate it: 'R' + FloatToStrF(rTot, ffFixed, 8, 2). Note also that Round in Delphi rounds a value ending in exactly .5 to the nearest even integer, so Round(2.5) gives 2 while Round(3.5) gives 4. It almost never matters in an exam answer, but it explains a result that otherwise looks like a bug.

💡 EASY MARK When a question says "display the answer correct to two decimal places", the mark is for the formatting call, not for the arithmetic. Even if the calculation above it is wrong, a correct FloatToStrF(rAnswer, ffFixed, 8, 2) earns its own tick on the marking grid. Never skip the display line because you are unsure of the sum.

Selection: if, nested if and case

🔥 FREQUENTLY TESTED case works only on ordinal types, which means Integer, Char, Boolean and enumerated types. It cannot switch on a String and it cannot switch on a Real, because those have no fixed list of discrete values to jump to. A question that hands you a single letter code is inviting a case; a question that hands you a name or a price is inviting an if ladder. Choosing the wrong one is a compile error you will not have time to unpick.
An if ladder on a Real value
  • if rPercent >= 80 then
  •   sSymbol := 'A'
  • else if rPercent >= 70 then
  •   sSymbol := 'B'
  • else if rPercent >= 50 then
  •   sSymbol := 'C'
  • else
  •   sSymbol := 'F';
A case on an ordinal value
  • case iDay of
  •   1..5 : sType := 'Weekday';
  •   6, 7 : sType := 'Weekend';
  •   else   sType := 'Invalid';
  • end;

Two details cost marks quietly. There is no semicolon before else in an if statement, because the else belongs to the same statement. And when a branch must do more than one thing, wrap those statements in begin and end; without them only the first line belongs to the branch and the rest runs every time.

Repetition: for, while and repeat

LoopUse it whenCondition testedCan it run zero times?
for i := 1 to N doThe number of repeats is known before the loop startsAutomatically, by the counterYes, if N is less than the start value
while <condition> doYou repeat until something becomes true, and it may already be trueAt the top, before the bodyYes
repeat ... untilThe body must happen at least once, such as asking for inputAt the bottom, after the bodyNo, it always runs at least once

That zero-iteration difference is examined directly. If a list is empty, a while that reads it never executes its body and the program continues safely; a repeat in the same position reads once before it checks, and that first read is what crashes on empty data. Note also that repeat ... until needs no begin and end, because repeat and until already bracket the body, while a while or for body of more than one statement does.

⚠️ COMMON MISTAKE Changing the counter variable inside a for loop, or forgetting to move the variable a while loop tests, produces an infinite loop. In a three-hour practical paper an infinite loop costs you the question and the time. Before you run anything, check that the value in the loop condition is changed somewhere inside the body.

String handling and splitting a delimited string

RoutineWhat it doesWorked example on sTxt = 'Cape Town'
Length(s)Number of charactersLength(sTxt) gives 9
Pos(sub, s)Position where a substring starts, or 0Pos(' ', sTxt) gives 5
Copy(s, start, count)Pulls out part of the stringCopy(sTxt, 1, 4) gives 'Cape'
Delete(s, start, count)Removes part, changing the variable itselfDelete(sTxt, 1, 5) leaves 'Town'
Insert(new, s, at)Pushes text in at a positionInsert('X', sTxt, 1) gives 'XCape Town'
UpperCase / LowerCaseChanges the case of a whole stringUpperCase(sTxt) gives 'CAPE TOWN'
Trim(s)Strips spaces from both endsUse it on every value read from an Edit box

Strings are indexed from 1, and Pos returns 0 when the substring is not there at all. Both facts matter, because the standard splitting routine leans on them: find the delimiter with Pos, take everything in front of it with Copy, then Delete that part plus the delimiter and repeat until Pos returns 0. Compare characters with UpperCase applied to both sides so that 'y' and 'Y' are treated alike.

Invented example for practice: splitting 'Mokoena#Grade 12#87' on the # delimiter
  • while Pos('#', sLine) > 0 do
  • begin
  •   sPart := Copy(sLine, 1, Pos('#', sLine) - 1);
  •   redOut.Lines.Add(sPart);
  •   Delete(sLine, 1, Pos('#', sLine));
  • end;
  • redOut.Lines.Add(sLine);  // the last part has no # after it

Dates and the maths functions

Dates and time
  • Date returns today, Now returns today with the time
  • FormatDateTime('yyyy/mm/dd', dDay) lays a date out for display
  • DaysBetween(dEnd, dStart) counts whole days, and needs the DateUtils unit
  • A date is stored as a number, so dDue < Date is a valid test for "overdue"
Maths functions
  • Sqr(x) squares, Sqrt(x) takes the square root
  • Power(x, y) raises to a power, and needs the Math unit
  • Random(10) gives 0 to 9; RandomRange(1, 7) gives 1 to 6
  • Inc(i) and Dec(i) add or subtract one
  • Pi is a built-in constant, so never type 3.14
💡 EASY MARK Randomize is called once, usually in the form's OnCreate, and it is what makes Random produce a different sequence each run. Without it, the same "random" numbers appear every time the program starts. If a question asks for random values, the call to Randomize is often a mark on its own.

Desk-checking: reading a loop by hand

A trace table is a table with one column per variable and one row per pass through the loop. You fill it in by hand, playing the part of the computer, and the row where the answer first goes wrong tells you which line to fix. Paper 2 examines the table itself as a design tool; Paper 1 rewards it because it is faster than running a broken program three times.

Do not trace the whole loop. Trace the first two passes and the last one. Nearly every logic error in Section A is an off-by-one: a loop that starts at 0 instead of 1, or ends at Length(s) - 1 instead of Length(s), and both of those show up in the first and last rows only.

Worked example: a full Section A style task

Invented scenario for practice: the school tuckshop till
  • The user types a quantity into edtQty and a unit price into edtPrice.
  • Orders of 10 or more items get 15% off; smaller orders pay full price.
  • Items are packed in boxes of 6, and the display must state how many full boxes and how many loose items there are.
  • The total must display as R followed by two decimals.
The solution, step by step
  • iQty := StrToInt(Trim(edtQty.Text));
  • rPrice := StrToFloat(Trim(edtPrice.Text));
  • rTotal := iQty * rPrice;
  • if iQty >= 10 then
  •   rTotal := rTotal * 0.85;
  • iBoxes := iQty div 6;
  • iLoose := iQty mod 6;
  • lblOut.Caption := 'Total: R' + FloatToStrF(rTotal, ffFixed, 8, 2)
  •   + ' in ' + IntToStr(iBoxes) + ' box(es) plus ' + IntToStr(iLoose) + ' loose';

Check it against a value you can verify by hand. With 14 items at R7,50 each, the raw total is R105,00, the discount takes it to R89,25, and 14 items pack into 14 div 6 which is 2 boxes with 14 mod 6 which is 2 loose. Every one of those five lines is a separate tick on the marking grid, which is why a partially finished answer is always worth writing.

🧠 ACTIVE RECALL
A stopwatch program stores a race time of 227 total minutes in the Integer variable iMins. The display must read the time as whole hours plus the remaining minutes. Which pair of expressions produces the hours and the leftover minutes correctly?(2)
A program must ask the user for a password and keep asking until the entry is correct. The prompt has to appear at least once, no matter what. Which loop structure guarantees that the body executes at least one time?(2)
A learner writes case sProvince of where sProvince is declared as a String, and the project refuses to compile. What is the reason, and what should be used instead?(2)
In the statement iSpot := Pos('@', sEmail); the user has typed an address with no @ sign in it at all. What value does iSpot hold afterwards?(2)
Which symbol assigns a value to a variable in Delphi?(2)
What is the value of Trunc(9.9)?(2)
Explain the difference between a while loop and a repeat ... until loop, and describe one situation with empty data where choosing the wrong one causes the program to fail.(4)
Distinguish between a local and a global variable, and justify why declaring variables locally is generally the better design decision.(4)
A tuckshop till takes a quantity and a unit price. Orders of 10 or more items receive 15% off, items pack into boxes of 6, and the total must display as R with two decimals. Explain, statement by statement, how you would code this in Delphi, naming the specific operator or function used at each step.(6)
A candidate's program freezes and prints nothing. Inspection shows a while iCount < 10 do loop whose body reads a value and displays it but never alters iCount. Explain why the program freezes and state the correction.(4)
Explain to a Grade 8: what is the difference between div and mod, using sweets shared among friends?

Questions reworked from: DBE NSC Nov 2023 P1, Nov 2024 P1, Nov 2025 P1.

ONE-MINUTE SUMMARY Section A of Paper 1 is 40 marks of short Delphi tasks built from five ideas. Declare with the right type (Integer, Real, Boolean, Char, String) and keep variables local unless sharing is genuinely needed. Calculate with the right operator: / gives a Real, div gives the whole part and mod the remainder, and brackets settle every precedence argument. Convert input with StrToInt and StrToFloat, and display with IntToStr or FloatToStrF(value, ffFixed, 8, 2). Choose with an if ladder for Reals and Strings and with case for ordinal values only. Repeat with for when the count is known, while when the body may run zero times, and repeat when it must run at least once. Handle text with Length, Pos, Copy, Delete and Insert, remembering that strings index from 1 and Pos returns 0 on a miss. Desk-check a suspect loop by hand rather than guessing at the code, and remember that marking is per step, so an incomplete answer still scores.
IN THE EXAM
  • Read the required output format before you write any calculation. If it says two decimals or a currency prefix, that formatting call is a mark of its own.
  • When a question mentions "how many complete" and "how many left over" in the same sentence, it is asking for div and mod. Nothing else fits.
  • Answer only what is asked. Validation nobody requested earns no marks and eats time you need elsewhere.
  • Never leave a question blank. Type the declarations, the conversions and the display line even if the middle of the algorithm will not come, because each of those is separately ticked.
  • If a loop misbehaves, trace the first two passes and the last one by hand before you change a single line of code.
🔒 ARRAYS, FILES & ALGORITHMS
🔒 OBJECT-ORIENTED PROGRAMMING
🔒 DATABASE & SQL
🔒 DATA MANAGEMENT & DESIGN
🔒 DATA COLLECTION & MINING
🔒 SYSTEMS: HARDWARE
🔒

12 more topics locked

This is a free preview of Topic 1. The full guide has every topic, the self-marking quizzes, mock exams, planner, journal and wellbeing tools.

Unlock the full guide on WhatsAppSee pricing

A winner is a loser who tried one more time.- keep going, all the way to the exam