Skip to content

Information Technology Grade 11 P1 2026 Memo (Eng)

MemorandumInformation TechnologyGrade 11202628 pagesPublisher: Hlayiso

Grade 11 Information Technology Paper 1 memorandum from the November Mock Exam 2 2026 (English), 28 pages. Read online or download the free PDF.

Free to read online, no sign-up needed

Loading document…

Loading document…

November Mock Exam 2 2026

Document textSearch extracted text and jump to a page.
Mock hlayiso mock exams Practice Series: Grade 11 Exam Preparation WWW.HLAYISO.COM NATIONAL SENIOR CERTIFICATE GRADE 11 INFORMATION TECHNOLOGY P1 NOVEMBER EXAMINATION 2026 (MOCK) MARKING GUIDELINES MARKS: 150 These marking guidelines consist of 28 pages. Copyright reserved Please turn over
Information Technology/P1 2 Hlayiso/Mock 2026 NSC – Marking Guidelines GENERAL INFORMATION: • These marking guidelines are to be used as the basis for the marking session. Markers should discuss the guidelines before marking to ensure that they are consistently interpreted and applied. • Learners who provide an alternative correct solution to the one given in the marking guidelines must be given full credit for the relevant solution, unless the specific instructions in the paper were not followed or the requirements of the question were not met. • Annexures A, B, C and D contain the marking grid for each question. • Annexures E, F, G and H contain examples of solutions for QUESTION 1 to QUESTION 4 in programming code. The complete model-solution projects are supplied in the folder mock2memo_p1_solutions. • Copies of Annexures A, B, C and D and the summary of the learner’s marks should be made for each learner and completed during the marking session. • Code that is not executed (e.g. because of syntax errors in another part of the program) must still be marked, but marks are only awarded for statements that are logically correct. • Built-in routines that the instructions prohibit (e.g. Locate, Filter, Sort, RecordCount, CharInSet, any built-in base-conversion routine) earn NO marks for the part of the question in which they are used. • Differences in the display of currency values and dates that are caused by the regional settings of the computer must NOT be penalised. Copyright reserved Please turn over
Information Technology/P1 3 Hlayiso/Mock 2026 NSC – Marking Guidelines ANNEXURE A QUESTION 1: MARKING GRID – GENERAL PROGRAMMING SKILLS CENTRE NUMBER: EXAMINATION NUMBER: QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 1.1 Button [1.1 - Welcome] 4 lblQ1_1.Caption := 'Thuto Learner Portal' ✓ lblQ1_1.Font.Color := clBlue ✓ lblQ1_1.Font.Style := [fsBold, fsItalic] ✓ edtQ1_2.SetFocus ✓ NOTE: Only one of the two font styles: NO mark for the style. 1.2 Button [1.2 - Data bundles] 8 Extract the data needed and convert to integer (StrToInt(edtQ1_2.Text)) ✓ Number of bundles: iMB DIV BUNDLE_MB ✓ if iMB MOD BUNDLE_MB > 0 then Inc(iBundles) ✓ Cost: iBundles * BUNDLE_PRICE ✓ Unused data: iBundles * BUNDLE_MB - iMB ✓ Display ’Bundles needed: ’ and the number of bundles ✓ Display ’Cost: ’ and the cost in currency format ✓ Display ’Unused data: ’, the unused data and ’ MB’ ✓ Also ACCEPT: Ceil(iMB / BUNDLE_MB) (with Math in the uses clause) for the 2 marks of the number of bundles; Trunc(iMB / 500); hard-coded 500 and 39 instead of the constants. NOTE: Round(iMB / 500) gives the wrong answer for e.g. 1700 MB: max 1 of the 2 marks for the bundles. Copyright reserved Please turn over
Information Technology/P1 4 Hlayiso/Mock 2026 NSC – Marking Guidelines QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 1.3 Button [1.3 - Achievement level] 9 Extract the mark and the total from the spin edits (.Value) ✓ if (iTotal = 0) OR (iMark > iTotal) ✓ display ’Invalid marks entered’ and Exit ✓ Percentage: Round(iMark / iTotal * 100) ✓ case iPerc of with correct ranges (80..100, 70..79, …) ✓ correct levels and descriptions for all seven levels (else for level 1) ✓ Display the percentage with ’%’ in lblQ1_3_Perc ✓ Display ’Level ’, the level, ’ - ’ and the description in lblQ1_3_Level ✓ if iPerc >= 50 then clGreen else clRed (Font.Color) ✓ NOTE: Nested if statements instead of case: max 1 of the 2 marks for the selection structure. 1.4 Button [1.4 - Hashtag] 10 Extract the phrase; if empty, display a message and Exit ✓ Initialise sTag := '#', word counter := 1 (or count spaces and add 1 after the loop) and bNewWord := True ✓ for i := 1 to Length(sPhrase) do ✓ if sPhrase[i] = ' ' then ✓ bNewWord := True (space not added to the hashtag) ✓ increment the word counter ✓ else if bNewWord then add UpperCase(sPhrase[i]) ✓ and set bNewWord := False ✓ else add LowerCase(sPhrase[i]) ✓ Display the hashtag and the number of words, and the length message: if Length(sTag) > 20 warning else ’Length OK: ’ and the length ✓ Also ACCEPT: testing sPhrase[i-1] = ' ' (with a separate test for i = 1) instead of a Boolean flag; word count = number of spaces + 1; UpCase. NOTE: Only the first letter of the phrase in upper case: max 7 marks. Copyright reserved Please turn over
Information Technology/P1 5 Hlayiso/Mock 2026 NSC – Marking Guidelines QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 1.5 Button [1.5 - Savings plan] 9 Extract the target (StrToFloat) ✓ Initialise the deposit to 100, the total to 0 and the month counter to 0 ✓ Conditional loop (while / repeat) ✓ with the correct condition: rTotal < rTarget (repeat: until rTotal >= rTarget) ✓ Increment the month counter ✓ Add the deposit to the total ✓ Display ’Month ’, number, ’: deposit R’, deposit, ’ - total R’, total (2 decimals) ✓ Increase the deposit by 20 ✓ After the loop: display the number of months ✓ NOTE: The blank line before the final message is optional and is not penalised. A for loop with a hard-coded number of months: NO marks for the loop and the condition. TOTAL QUESTION 1: 40 Copyright reserved Please turn over
Information Technology/P1 6 Hlayiso/Mock 2026 NSC – Marking Guidelines ANNEXURE B QUESTION 2: MARKING GRID – ARRAYS AND TEXT FILES CENTRE NUMBER: EXAMINATION NUMBER: QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 2.1 Button [2.1 - Load data] 12 if NOT FileExists('TuckShop.txt'): display a suitable message and Exit ✓ AssignFile(tFile, 'TuckShop.txt') ✓ Reset(tFile) ✓ iCount := 0 ✓ while NOT Eof(tFile) do ✓ Readln(tFile, sLine) ✓ Inc(iCount) ✓ arrItems[iCount] := Copy(sLine, 1, Pos('#', sLine) - 1) ✓ Delete the item and extract the category into arrCategory[iCount] ✓ Extract the price, convert to real (StrToFloat) and store in arrPrice[iCount] ✓ Extract the quantity, convert to integer and store in arrQty[iCount] ✓ CloseFile(tFile) and display ’Items loaded: ’ and iCount in lblQ2_1 ✓ 2.2 Button [2.2 - Search] 7 sSearch := InputBox(...) and display the heading ✓ Initialise a counter to 0 ✓ for i := 1 to iCount do ✓ if Pos(UpperCase(sSearch), UpperCase(arrItems[i])) > 0 then ✓ Display arrItems[i] and the price in currency format ✓ Increment the counter ✓ After the loop: ’No items found’ if counter = 0, else the number of items found ✓ Also ACCEPT: LowerCase; ContainsText. A search that only finds exact matches (=): NO mark for the condition. Price: 'R' + FormatFloat('0.00', ...) or FloatToStrF(arrPrice[i], ffCurrency, 8, 2). Copyright reserved Please turn over
Information Technology/P1 7 Hlayiso/Mock 2026 NSC – Marking Guidelines QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 2.3 Button [2.3 - Increase prices] 8 if rgpQ2_3.ItemIndex = -1: message and Exit ✓ Get the category rgpQ2_3.Items[rgpQ2_3.ItemIndex] and display the heading with the percentage ✓ Loop through the arrays and test arrCategory[i] = sCat ✓ New price: arrPrice[i] * (1 + spnQ2_3.Value / 100) ✓ Round to the nearest 50 cents: Round(rNew * 2) / 2 ✓ Display the item, old price and new price in columns (#9) ✓ arrPrice[i] := rNew (after the old price was displayed) ✓ Count the updates and display the number after the loop ✓ Also ACCEPT: arrPrice[i] + arrPrice[i] * iPerc / 100; Trunc(rNew * 2 + 0.5) / 2. NOTE: Because of Delphi’s banker’s rounding and floating-point representation, a value exactly halfway (e.g. R17.25) may round to R17.00 or R17.50. Accept either result. Award the rounding mark for Round(x * 2) / 2, Trunc(x * 2 + 0.5) / 2 or an equivalent method. 2.4 Button [2.4 - Sort and display] 8 Outer loop: for i := 1 to iCount - 1 ✓ Inner loop: for j := i + 1 to iCount ✓ if arrItems[j] < arrItems[i] then (alphabetical) ✓ Swap arrItems using a temporary variable ✓ Swap arrCategory ✓ Swap arrPrice and arrQty (correct data types of the temporary variables) ✓ Loop from 1 to iCount to display ✓ item, category, price (’R’ and 2 decimals) and quantity, separated by tabs ✓ Also ACCEPT: bubble sort; UpperCase in the comparison. A sort that does not keep all four arrays parallel: max 5 marks. Copyright reserved Please turn over
Information Technology/P1 8 Hlayiso/Mock 2026 NSC – Marking Guidelines QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 2.5 Button [2.5 - Sales log] 5 Loop to calculate the total: rIncome := rIncome + arrPrice[i] * arrQty[i] ✓ AssignFile(tLog, 'SalesLog.txt') ✓ if FileExists(...) then Append(tLog) else Rewrite(tLog) ✓ Writeln(tLog, ...) with the system date (Date) in the correct format, ’#’ and the income with 2 decimals ✓ CloseFile(tLog) and display a message with the total income ✓ Also ACCEPT: FormatDateTime('yyyy/mm/dd', Now); DateToStr(Date) ONLY if the output is in the format yyyy/mm/dd on the marking computer. TOTAL QUESTION 2: 40 Copyright reserved Please turn over
Information Technology/P1 9 Hlayiso/Mock 2026 NSC – Marking Guidelines ANNEXURE C QUESTION 3: MARKING GRID – DATABASE PROGRAMMING CENTRE NUMBER: EXAMINATION NUMBER: QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 3.1 Button [3.1 - Available animals] 7 Initialise counter to 0 ✓ tblAnimals.First, while NOT tblAnimals.Eof do and tblAnimals.Next in the correct positions ** ✓ if (tblAnimals['Species'] = sSpecies) ✓ AND (tblAnimals['Adopted'] = False) then ✓ Display AnimalName, Age and DateArrived ✓ with the date formatted: FormatDateTime('yyyy/mm/dd', ...) ✓ Increment the counter and, after the loop, display ’No animals available’ if counter = 0, else the number available ✓ Also ACCEPT: NOT tblAnimals['Adopted']; FieldByName('Species').AsString; DateToStr. 3.2 Button [3.2 - Statistics] 9 Initialise counters, total fees and the maximum age ✓ Loop through the table (First, while NOT Eof, Next) ** ✓ Count ALL the animals ✓ if tblAnimals['Adopted'] = True then ✓ increment the adopted counter and add AdoptionFee to the total ✓ For animals NOT adopted: if tblAnimals['Age'] > iMaxAge then ✓ store the age and AnimalName ✓ Display adopted, total and percentage iAdopted / iTotal * 100 (1 decimal) ✓ Display total fees (currency) and the oldest animal still available with its age ✓ NOTE: Using RecordCount for the total number of animals: NO mark for counting. Oldest animal of ALL animals (Adopted not tested): max 1 of the 2 marks for the maximum. Copyright reserved Please turn over
Information Technology/P1 10 Hlayiso/Mock 2026 NSC – Marking Guidelines QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 3.3 Button [3.3 - Adopt animal] 8 sName := InputBox(...) ✓ bFound := False and tblAnimals.First ✓ while (NOT tblAnimals.Eof) AND (NOT bFound) do ✓ Compare UpperCase(tblAnimals['AnimalName']) with UpperCase(sName); if equal bFound := True, else Next ✓ If not found: display a message ✓ Else if tblAnimals['Adopted'] = True: display ’<name> has already been adopted’ ✓ Else: tblAnimals.Edit, tblAnimals['Adopted'] := True, tblAnimals.Post ✓ Display the name and the adoption fee in currency format ✓ Also ACCEPT: LowerCase; a loop with Break/Exit when found; the name as entered by the user in the messages. 3.4 Button [3.4 - Remove adopted] 7 Initialise counter and tblAnimals.First ✓ while NOT tblAnimals.Eof do ✓ if tblAnimals['Adopted'] = True then ✓ Display AnimalName and Species in brackets (BEFORE deleting) ✓ tblAnimals.Delete and increment the counter ✓ else tblAnimals.Next (Next ONLY when no record was deleted) ✓ After the loop: display the number of records removed ✓ NOTE: Next executed after every Delete skips records: NO mark for the else Next. Copyright reserved Please turn over
Information Technology/P1 11 Hlayiso/Mock 2026 NSC – Marking Guidelines QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 3.5 Button [3.5 - Add animal] 9 Test: name empty OR cmbQ3_5.ItemIndex = -1 OR rgpQ3_5.ItemIndex = -1 ✓ display a suitable message and Exit ✓ Adoption fee according to the species (case/if: 850, 650, 250) ✓ tblAnimals.Append / tblAnimals.Insert ✓ AnimalName from the edit box and Species from cmbQ3_5.Items[ItemIndex] ✓ Gender := Copy(rgpQ3_5.Items[rgpQ3_5.ItemIndex], 1, 1) ✓ Age := spnQ3_5.Value and Sterilised := chkQ3_5.Checked ✓ DateArrived := Date, AdoptionFee and Adopted := False ✓ tblAnimals.Post and display a confirmation message ✓ Also ACCEPT: Now for the date; rgpQ3_5.Items[...][1] for the gender. NOTE: NO mark if a value is assigned to AnimalID. TOTAL QUESTION 3: 40 NOTE **: The First and Next statements of a loop must both be in the correct position for the mark. Copyright reserved Please turn over
Information Technology/P1 12 Hlayiso/Mock 2026 NSC – Marking Guidelines ANNEXURE D QUESTION 4: MARKING GRID – PROBLEM SOLVING CENTRE NUMBER: EXAMINATION NUMBER: QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 4.1 Button [4.1 - Binary] 11 Test that the input is not empty ✓ Loop through every character and test whether it is NOT a digit (< '0' or > '9') ✓ Test that the number is not greater than 255; if not valid: message and Exit ✓ Initialise sBin := '' and use a conditional loop until the number is 0 ✓ sBin := IntToStr(iNum MOD 2) + sBin (remainder added to the FRONT) ✓ iNum := iNum DIV 2 ✓ while Length(sBin) < 8 do sBin := '0' + sBin ✓ Loop through sBin and count the ’1’ characters ✓ Parity: if iOnes MOD 2 = 0 then 0, else 1 ✓ Display the decimal and the binary numbers ✓ Display the number of 1 bits and the parity bit ✓ Also ACCEPT: counting the 1 bits during the conversion; TryStrToInt combined with a test that the value is ≥ 0 and the first character is a digit (1 mark); a length test (≤ 3) before StrToInt. A while loop that gives an empty string for 0 is accepted because of the padding. A built-in base-conversion routine: NO marks for the conversion. Copyright reserved Please turn over
Information Technology/P1 13 Hlayiso/Mock 2026 NSC – Marking Guidelines QUESTION DESCRIPTION MAX. LEARNER’S MARKS MARKS 4.2 Function isPrime 10 Function heading with an Integer parameter that returns a Boolean (declared in the class or as a stand-alone function) ✓ Numbers less than 2 are NOT prime ✓ Loop through possible divisors from 2 (to iNum - 1 or to the square root) ✓ if iNum MOD iDiv = 0 then not prime ✓ Return the correct result (Result :=) ✓ Button [4.2 - Twin primes] Extract the start and end numbers and display the heading ✓ for i := iFrom to iTo - 2 do (both numbers in the range) ✓ if isPrime(i) AND isPrime(i + 2) then (function called) ✓ display the pair in brackets and increment the counter ✓ Display the number of pairs ✓ Also ACCEPT: a counter of divisors equal to 2; a loop to iTo that tests i + 2 <= iTo. 4.3 Button [4.3 - Dice simulation] 9 Loop from 2 to 12 to set arrCount[i] := 0 ✓ for i := 1 to ROLLS do ✓ (Random(6) + 1) + (Random(6) + 1) (TWO dice) ✓ Inc(arrCount[iSum]) ✓ Loop from 2 to 12 to display ✓ Build the bar: loop from 1 to arrCount[i] DIV 10 adding ’*’ ✓ Display ’Total ’, the total, ’: ’, the count and the bar ✓ Determine the total with the highest count ✓ Display the most frequent total (the first, smallest one if tied) ✓ NOTE: Random(11) + 2 does NOT simulate two dice: NO mark for the dice. Also ACCEPT: RandomRange(1, 7); StringOfChar('*', ...). TOTAL QUESTION 4: 30 Copyright reserved Please turn over
Information Technology/P1 14 Hlayiso/Mock 2026 NSC – Marking Guidelines SUMMARY OF LEARNER’S MARKS: CENTRE NUMBER: EXAMINATION NUMBER: QUESTION 1 QUESTION 2 QUESTION 3 QUESTION 4 GRAND TOTAL MAX. MARKS 40 40 40 30 150 LEARNER’S MARKS Copyright reserved Please turn over
Information Technology/P1 15 Hlayiso/Mock 2026 NSC – Marking Guidelines ANNEXURE E: SOLUTION FOR QUESTION 1 const BUNDLE_MB = 500; BUNDLE_PRICE = 39.00; var frmQuestion1: TfrmQuestion1; implementation {$R *.dfm} // =========================================================================== // Provided code // =========================================================================== procedure TfrmQuestion1.FormCreate(Sender: TObject); begin FormatSettings.DecimalSeparator := '.'; end; // =========================================================================== // Question 1.1 4 marks // =========================================================================== procedure TfrmQuestion1.btnQ1_1Click(Sender: TObject); begin lblQ1_1.Caption := 'Thuto Learner Portal'; lblQ1_1.Font.Color := clBlue; lblQ1_1.Font.Style := [fsBold, fsItalic]; edtQ1_2.SetFocus; end; // =========================================================================== // Question 1.2 8 marks // =========================================================================== procedure TfrmQuestion1.btnQ1_2Click(Sender: TObject); var iMB, iBundles, iUnused: Integer; rCost: Real; begin iMB := StrToInt(edtQ1_2.Text); iBundles := iMB DIV BUNDLE_MB; if iMB MOD BUNDLE_MB > 0 then Inc(iBundles); rCost := iBundles * BUNDLE_PRICE; iUnused := iBundles * BUNDLE_MB - iMB; lblQ1_2_Bundles.Caption := 'Bundles needed: ' + IntToStr(iBundles); lblQ1_2_Cost.Caption := 'Cost: ' + FloatToStrF(rCost, ffCurrency, 8, 2); lblQ1_2_Unused.Caption := 'Unused data: ' + IntToStr(iUnused) + ' MB'; end; // =========================================================================== // Question 1.3 9 marks // =========================================================================== procedure TfrmQuestion1.btnQ1_3Click(Sender: TObject); var iMark, iTotal, iPerc, iLevel: Integer; sDesc: String; Copyright reserved Please turn over
Information Technology/P1 16 Hlayiso/Mock 2026 NSC – Marking Guidelines begin iMark := spnQ1_3_Mark.Value; iTotal := spnQ1_3_Total.Value; if (iTotal = 0) OR (iMark > iTotal) then begin ShowMessage('Invalid marks entered'); Exit; end; iPerc := Round(iMark / iTotal * 100); case iPerc of 80 .. 100: begin iLevel := 7; sDesc := 'Outstanding'; end; 70 .. 79: begin iLevel := 6; sDesc := 'Meritorious'; end; 60 .. 69: begin iLevel := 5; sDesc := 'Substantial'; end; 50 .. 59: begin iLevel := 4; sDesc := 'Adequate'; end; 40 .. 49: begin iLevel := 3; sDesc := 'Moderate'; end; 30 .. 39: begin iLevel := 2; sDesc := 'Elementary'; end; else begin iLevel := 1; sDesc := 'Not achieved'; end; end; lblQ1_3_Perc.Caption := 'Percentage: ' + IntToStr(iPerc) + '%'; lblQ1_3_Level.Caption := 'Level ' + IntToStr(iLevel) + ' - ' + sDesc; if iPerc >= 50 then lblQ1_3_Level.Font.Color := clGreen else lblQ1_3_Level.Font.Color := clRed; end; // =========================================================================== // Question 1.4 10 marks // =========================================================================== procedure TfrmQuestion1.btnQ1_4Click(Sender: TObject); Copyright reserved Please turn over
Information Technology/P1 17 Hlayiso/Mock 2026 NSC – Marking Guidelines var sPhrase, sTag: String; i, iWords: Integer; bNewWord: Boolean; begin sPhrase := edtQ1_4.Text; if sPhrase = '' then begin ShowMessage('Enter a phrase'); Exit; end; sTag := '#'; iWords := 1; bNewWord := True; for i := 1 to Length(sPhrase) do begin if sPhrase[i] = ' ' then begin bNewWord := True; Inc(iWords); end else if bNewWord then begin sTag := sTag + UpperCase(sPhrase[i]); bNewWord := False; end else sTag := sTag + LowerCase(sPhrase[i]); end; lblQ1_4_Tag.Caption := sTag + ' (' + IntToStr(iWords) + ' words)'; if Length(sTag) > 20 then lblQ1_4_Msg.Caption := 'Warning: the hashtag is longer than 20 characters' else lblQ1_4_Msg.Caption := 'Length OK: ' + IntToStr(Length(sTag)) + ' characters'; end; // =========================================================================== // Question 1.5 9 marks // =========================================================================== procedure TfrmQuestion1.btnQ1_5Click(Sender: TObject); var rTarget, rDeposit, rTotal: Real; iMonth: Integer; begin memQ1_5.Clear; rTarget := StrToFloat(edtQ1_5.Text); rDeposit := 100; rTotal := 0; iMonth := 0; while rTotal < rTarget do begin Inc(iMonth); rTotal := rTotal + rDeposit; memQ1_5.Lines.Add('Month ' + IntToStr(iMonth) + ': deposit R' + FormatFloat('0.00', rDeposit) + ' - total R' + FormatFloat('0.00', rTotal)); rDeposit := rDeposit + 20; end; Copyright reserved Please turn over
Information Technology/P1 18 Hlayiso/Mock 2026 NSC – Marking Guidelines memQ1_5.Lines.Add(''); memQ1_5.Lines.Add('Target reached after ' + IntToStr(iMonth) + ' month(s)'); end; end. Copyright reserved Please turn over
Information Technology/P1 19 Hlayiso/Mock 2026 NSC – Marking Guidelines ANNEXURE F: SOLUTION FOR QUESTION 2 var frmQuestion2: TfrmQuestion2; // Provided global arrays and counter arrItems: array [1 .. 40] of String; arrCategory: array [1 .. 40] of String; arrPrice: array [1 .. 40] of Real; arrQty: array [1 .. 40] of Integer; iCount: Integer; implementation {$R *.dfm} // =========================================================================== // Provided code // =========================================================================== procedure TfrmQuestion2.FormCreate(Sender: TObject); begin FormatSettings.DecimalSeparator := '.'; FormatSettings.DateSeparator := '/'; iCount := 0; redQ2.Paragraph.TabCount := 3; redQ2.Paragraph.Tab[0] := 180; redQ2.Paragraph.Tab[1] := 250; redQ2.Paragraph.Tab[2] := 320; end; // =========================================================================== // Question 2.1 12 marks // =========================================================================== procedure TfrmQuestion2.btnQ2_1Click(Sender: TObject); var tFile: TextFile; sLine: String; iHash: Integer; begin if NOT FileExists('TuckShop.txt') then begin ShowMessage('The file TuckShop.txt does not exist'); Exit; end; AssignFile(tFile, 'TuckShop.txt'); Reset(tFile); iCount := 0; while NOT Eof(tFile) do begin Readln(tFile, sLine); Inc(iCount); iHash := Pos('#', sLine); arrItems[iCount] := Copy(sLine, 1, iHash - 1); Delete(sLine, 1, iHash); iHash := Pos('#', sLine); arrCategory[iCount] := Copy(sLine, 1, iHash - 1); Delete(sLine, 1, iHash); iHash := Pos('#', sLine); arrPrice[iCount] := StrToFloat(Copy(sLine, 1, iHash - 1)); Copyright reserved Please turn over
Information Technology/P1 20 Hlayiso/Mock 2026 NSC – Marking Guidelines Delete(sLine, 1, iHash); arrQty[iCount] := StrToInt(sLine); end; CloseFile(tFile); lblQ2_1.Caption := 'Items loaded: ' + IntToStr(iCount); end; // =========================================================================== // Question 2.2 7 marks // =========================================================================== procedure TfrmQuestion2.btnQ2_2Click(Sender: TObject); var sSearch: String; i, iFound: Integer; begin redQ2.Clear; sSearch := InputBox('Search', 'Enter the item (or part of the item) to search for', ''); redQ2.Lines.Add('Items matching "' + sSearch + '":'); iFound := 0; for i := 1 to iCount do if Pos(UpperCase(sSearch), UpperCase(arrItems[i])) > 0 then begin redQ2.Lines.Add(arrItems[i] + #9 + 'R' + FormatFloat('0.00', arrPrice[i])); Inc(iFound); end; if iFound = 0 then redQ2.Lines.Add('No items found') else redQ2.Lines.Add(IntToStr(iFound) + ' item(s) found'); end; // =========================================================================== // Question 2.3 8 marks // =========================================================================== procedure TfrmQuestion2.btnQ2_3Click(Sender: TObject); var sCat: String; i, iUpdated: Integer; rNew: Real; begin redQ2.Clear; if rgpQ2_3.ItemIndex = -1 then begin ShowMessage('Select a category'); Exit; end; sCat := rgpQ2_3.Items[rgpQ2_3.ItemIndex]; redQ2.Lines.Add('New prices for the category ' + sCat + ' (+' + IntToStr(spnQ2_3.Value) + '%):'); iUpdated := 0; for i := 1 to iCount do if arrCategory[i] = sCat then begin rNew := arrPrice[i] * (1 + spnQ2_3.Value / 100); rNew := Round(rNew * 2) / 2; redQ2.Lines.Add(arrItems[i] + #9 + 'R' + FormatFloat('0.00', arrPrice[i]) + #9 + 'R' + FormatFloat('0.00', rNew)); Copyright reserved Please turn over
Information Technology/P1 21 Hlayiso/Mock 2026 NSC – Marking Guidelines arrPrice[i] := rNew; Inc(iUpdated); end; redQ2.Lines.Add(IntToStr(iUpdated) + ' prices updated'); end; // =========================================================================== // Question 2.4 8 marks // =========================================================================== procedure TfrmQuestion2.btnQ2_4Click(Sender: TObject); var i, j, iTemp: Integer; sTemp: String; rTemp: Real; begin redQ2.Clear; redQ2.Lines.Add('Item' + #9 + 'Category' + #9 + 'Price' + #9 + 'Sold'); for i := 1 to iCount - 1 do for j := i + 1 to iCount do if arrItems[j] < arrItems[i] then begin sTemp := arrItems[i]; arrItems[i] := arrItems[j]; arrItems[j] := sTemp; sTemp := arrCategory[i]; arrCategory[i] := arrCategory[j]; arrCategory[j] := sTemp; rTemp := arrPrice[i]; arrPrice[i] := arrPrice[j]; arrPrice[j] := rTemp; iTemp := arrQty[i]; arrQty[i] := arrQty[j]; arrQty[j] := iTemp; end; for i := 1 to iCount do redQ2.Lines.Add(arrItems[i] + #9 + arrCategory[i] + #9 + 'R' + FormatFloat('0.00', arrPrice[i]) + #9 + IntToStr(arrQty[i])); end; // =========================================================================== // Question 2.5 5 marks // =========================================================================== procedure TfrmQuestion2.btnQ2_5Click(Sender: TObject); var tLog: TextFile; i: Integer; rIncome: Real; begin rIncome := 0; for i := 1 to iCount do rIncome := rIncome + arrPrice[i] * arrQty[i]; AssignFile(tLog, 'SalesLog.txt'); if FileExists('SalesLog.txt') then Append(tLog) else Rewrite(tLog); Writeln(tLog, FormatDateTime('yyyy/mm/dd', Date) + '#' + FormatFloat('0.00', rIncome)); Copyright reserved Please turn over
Information Technology/P1 22 Hlayiso/Mock 2026 NSC – Marking Guidelines CloseFile(tLog); ShowMessage('Total income of R' + FormatFloat('0.00', rIncome) + ' has been written to SalesLog.txt'); end; end. Copyright reserved Please turn over
Information Technology/P1 23 Hlayiso/Mock 2026 NSC – Marking Guidelines ANNEXURE G: SOLUTION FOR QUESTION 3 NOTE: Only the event handlers of the form unit are shown. The provided unit dbConnection_U.pas and the provided event handlers are unchanged. // =========================================================================== // Question 3.1 7 marks // =========================================================================== procedure TfrmQuestion3.btnQ3_1Click(Sender: TObject); var sSpecies: String; iNum: Integer; begin redQ3.Clear; if cmbQ3_1.ItemIndex = -1 then begin ShowMessage('Select a species'); Exit; end; sSpecies := cmbQ3_1.Items[cmbQ3_1.ItemIndex]; redQ3.Lines.Add('Animals available for adoption (' + sSpecies + '):'); iNum := 0; tblAnimals.First; while NOT tblAnimals.Eof do begin if (tblAnimals['Species'] = sSpecies) AND (tblAnimals['Adopted'] = False) then begin redQ3.Lines.Add(tblAnimals['AnimalName'] + ' - age ' + IntToStr(tblAnimals['Age']) + ' - arrived ' + FormatDateTime('yyyy/mm/dd', tblAnimals['DateArrived'])); Inc(iNum); end; tblAnimals.Next; end; if iNum = 0 then redQ3.Lines.Add('No animals available') else redQ3.Lines.Add('Number available: ' + IntToStr(iNum)); end; // =========================================================================== // Question 3.2 9 marks // =========================================================================== procedure TfrmQuestion3.btnQ3_2Click(Sender: TObject); var iTotal, iAdopted, iMaxAge: Integer; rFees: Real; sOldest: String; begin redQ3.Clear; iTotal := 0; iAdopted := 0; rFees := 0; iMaxAge := -1; sOldest := ''; tblAnimals.First; while NOT tblAnimals.Eof do begin Copyright reserved Please turn over
Information Technology/P1 24 Hlayiso/Mock 2026 NSC – Marking Guidelines Inc(iTotal); if tblAnimals['Adopted'] = True then begin Inc(iAdopted); rFees := rFees + tblAnimals['AdoptionFee']; end else if tblAnimals['Age'] > iMaxAge then begin iMaxAge := tblAnimals['Age']; sOldest := tblAnimals['AnimalName']; end; tblAnimals.Next; end; redQ3.Lines.Add('Animals adopted: ' + IntToStr(iAdopted) + ' of ' + IntToStr(iTotal) + ' (' + FormatFloat('0.0', iAdopted / iTotal * 100) + '%)'); redQ3.Lines.Add('Total adoption fees: ' + FloatToStrF(rFees, ffCurrency, 8, 2)); redQ3.Lines.Add('Oldest animal still available: ' + sOldest + ' (' + IntToStr(iMaxAge) + ' years)'); end; // =========================================================================== // Question 3.3 8 marks // =========================================================================== procedure TfrmQuestion3.btnQ3_3Click(Sender: TObject); var sName: String; bFound: Boolean; rFee: Real; begin redQ3.Clear; sName := InputBox('Adopt', 'Enter the name of the animal that was adopted', ''); bFound := False; tblAnimals.First; while (NOT tblAnimals.Eof) AND (NOT bFound) do begin if UpperCase(tblAnimals['AnimalName']) = UpperCase(sName) then bFound := True else tblAnimals.Next; end; if NOT bFound then ShowMessage(sName + ' was not found') else if tblAnimals['Adopted'] = True then ShowMessage(tblAnimals['AnimalName'] + ' has already been adopted') else begin tblAnimals.Edit; tblAnimals['Adopted'] := True; tblAnimals.Post; rFee := tblAnimals['AdoptionFee']; ShowMessage(tblAnimals['AnimalName'] + ' has been adopted. Adoption fee: ' + FloatToStrF(rFee, ffCurrency, 8, 2)); end; end; // =========================================================================== // Question 3.4 7 marks // =========================================================================== Copyright reserved Please turn over
Information Technology/P1 25 Hlayiso/Mock 2026 NSC – Marking Guidelines procedure TfrmQuestion3.btnQ3_4Click(Sender: TObject); var iRemoved: Integer; begin redQ3.Clear; redQ3.Lines.Add('Records removed:'); iRemoved := 0; tblAnimals.First; while NOT tblAnimals.Eof do begin if tblAnimals['Adopted'] = True then begin redQ3.Lines.Add(tblAnimals['AnimalName'] + ' (' + tblAnimals['Species'] + ')'); tblAnimals.Delete; Inc(iRemoved); end else tblAnimals.Next; end; redQ3.Lines.Add(IntToStr(iRemoved) + ' records removed'); end; // =========================================================================== // Question 3.5 9 marks // =========================================================================== procedure TfrmQuestion3.btnQ3_5Click(Sender: TObject); var sSpecies, sGender: String; rFee: Real; begin if (edtQ3_5_Name.Text = '') OR (cmbQ3_5.ItemIndex = -1) OR (rgpQ3_5.ItemIndex = -1) then begin ShowMessage('Enter the name, species and gender of the animal'); Exit; end; sSpecies := cmbQ3_5.Items[cmbQ3_5.ItemIndex]; sGender := Copy(rgpQ3_5.Items[rgpQ3_5.ItemIndex], 1, 1); case cmbQ3_5.ItemIndex of 0: rFee := 850; 1: rFee := 650; else rFee := 250; end; tblAnimals.Append; tblAnimals['AnimalName'] := edtQ3_5_Name.Text; tblAnimals['Species'] := sSpecies; tblAnimals['Gender'] := sGender; tblAnimals['Age'] := spnQ3_5.Value; tblAnimals['DateArrived'] := Date; tblAnimals['Sterilised'] := chkQ3_5.Checked; tblAnimals['AdoptionFee'] := rFee; tblAnimals['Adopted'] := False; tblAnimals.Post; ShowMessage(edtQ3_5_Name.Text + ' has been added'); end; end. Copyright reserved Please turn over
Information Technology/P1 26 Hlayiso/Mock 2026 NSC – Marking Guidelines ANNEXURE H: SOLUTION FOR QUESTION 4 NOTE: The function isPrime is declared in the private section of the class TfrmQuestion4: function isPrime(iNum: Integer): Boolean; const ROLLS = 600; var frmQuestion4: TfrmQuestion4; arrCount: array [2 .. 12] of Integer; implementation {$R *.dfm} // =========================================================================== // Provided code // =========================================================================== procedure TfrmQuestion4.FormCreate(Sender: TObject); begin Randomize; end; // =========================================================================== // Question 4.1 11 marks // =========================================================================== procedure TfrmQuestion4.btnQ4_1Click(Sender: TObject); var sInput: String; sBin: String; i, iNum, iOnes: Integer; bValid: Boolean; begin memQ4.Clear; sInput := edtQ4_1.Text; bValid := Length(sInput) > 0; for i := 1 to Length(sInput) do if (sInput[i] < '0') OR (sInput[i] > '9') then bValid := False; if bValid then bValid := (Length(sInput) <= 3) and (StrToInt(sInput) <= 255); if NOT bValid then begin ShowMessage('Enter a whole number from 0 to 255'); Exit; end; iNum := StrToInt(sInput); sBin := ''; repeat sBin := IntToStr(iNum MOD 2) + sBin; iNum := iNum DIV 2; until iNum = 0; while Length(sBin) < 8 do sBin := '0' + sBin; iOnes := 0; for i := 1 to Length(sBin) do if sBin[i] = '1' then Copyright reserved Please turn over
Information Technology/P1 27 Hlayiso/Mock 2026 NSC – Marking Guidelines Inc(iOnes); memQ4.Lines.Add('Decimal number: ' + sInput); memQ4.Lines.Add('Binary number: ' + sBin); memQ4.Lines.Add('Number of 1 bits: ' + IntToStr(iOnes)); if iOnes MOD 2 = 0 then memQ4.Lines.Add('Even parity bit: 0') else memQ4.Lines.Add('Even parity bit: 1'); end; // =========================================================================== // Question 4.2 10 marks // =========================================================================== function TfrmQuestion4.isPrime(iNum: Integer): Boolean; var iDiv: Integer; begin Result := iNum >= 2; iDiv := 2; while (iDiv <= Trunc(Sqrt(iNum))) AND Result do begin if iNum MOD iDiv = 0 then Result := False; Inc(iDiv); end; end; procedure TfrmQuestion4.btnQ4_2Click(Sender: TObject); var iFrom, iTo, i, iPairs: Integer; begin memQ4.Clear; iFrom := spnQ4_2_From.Value; iTo := spnQ4_2_To.Value; memQ4.Lines.Add('Twin primes from ' + IntToStr(iFrom) + ' to ' + IntToStr(iTo) + ':'); iPairs := 0; for i := iFrom to iTo - 2 do if isPrime(i) AND isPrime(i + 2) then begin memQ4.Lines.Add('(' + IntToStr(i) + ', ' + IntToStr(i + 2) + ')'); Inc(iPairs); end; memQ4.Lines.Add('Number of pairs: ' + IntToStr(iPairs)); end; // =========================================================================== // Question 4.3 9 marks // =========================================================================== procedure TfrmQuestion4.btnQ4_3Click(Sender: TObject); var i, j, iSum, iMost: Integer; sBar: String; begin memQ4.Clear; for i := 2 to 12 do arrCount[i] := 0; for i := 1 to ROLLS do Copyright reserved Please turn over
Information Technology/P1 28 Hlayiso/Mock 2026 NSC – Marking Guidelines begin iSum := (Random(6) + 1) + (Random(6) + 1); Inc(arrCount[iSum]); end; iMost := 2; for i := 2 to 12 do begin sBar := ''; for j := 1 to arrCount[i] DIV 10 do sBar := sBar + '*'; memQ4.Lines.Add('Total ' + IntToStr(i) + ': ' + IntToStr(arrCount[i]) + ' ' + sBar); if arrCount[i] > arrCount[iMost] then iMost := i; end; memQ4.Lines.Add('Most frequent total: ' + IntToStr(iMost)); end; end. Copyright reserved

Study this subject

More from Grade 11 Information Technology

View all