# Information Technology Grade 12 Paper 2 GAU Prelim 2020 Memo

> Grade 12 Information Technology Paper 2 memorandum from the GAU Prelim 2020, 29 pages. Read online or download the free PDF.

- Page: https://www.hlayiso.com/library/12itprelimpracticalpaper-2020-markingguide/92a41184-cf18-4452-8dcb-5778bb307a68
- Updated: 2026-09-27
- Subject: Information Technology
- Grade: Grade 12
- Document type: Memorandum
- Year: 2020
- Exam period: GAU Prelim
- Paper: 2
- Curriculum: CAPS
- Pages: 29

Breadcrumbs: [Home](https://www.hlayiso.com/) › [Library](https://www.hlayiso.com/library) › [Grade 12](https://www.hlayiso.com/library/grade-12) › [Information Technology](https://www.hlayiso.com/library/grade-12/information-technology) › [Information Technology Grade 12 Paper 2 GAU Prelim 2020 Memo](https://www.hlayiso.com/library/12itprelimpracticalpaper-2020-markingguide/92a41184-cf18-4452-8dcb-5778bb307a68)

## About this document

Information Technology · Grade 12 · GAU Prelim · 2020. Memorandum, 29 pages. Read online or download the PDF.

Read it free online on the page above; download the PDF from there.

## Document text

Text extracted from the PDF. Layout, diagrams and tables may not survive extraction.

### Page 1

Downloaded from hlayiso.com

                PRELIMINARY EXAMINATION

                            GRADE 12

                 INFORMATION TECHNOLOGY P1

                         SEPTEMBER 2020

                      MARKING GUIDELINES

MARKS: 150

             This marking guidelines consists of 29 pages.

### Page 2

Downloaded from hlayiso.com
Information Technology/P1                   2                        Preliminary Examination 2020
                                    Marking Guidelines

GENERAL INFORMATION

 •     These marking guidelines are to be used as the basis for the marking session.
       They were prepared for use by markers. All markers are required to attend a
       standardization meeting to ensure that the guidelines are consistently interpreted and
       applied in the marking of candidates’ work.

 •     Note that learners who provide an alternate correct solution to that given as
       example of a solution in the marking guidelines will be given full credit for the
       relevant solution, unless the specific instructions in the paper was not followed or
       the requirements of the question was not met

 •     Annexures A, B, C and D include the marking grid for each question for using a
       programming language.

 •     Annexures E, F, G and H contain examples of solutions for Questions 1 to 4 in
       programming code.

 •     Copies of Annexures A, B, C, D and Summary of learner’s marks should be made
       for each learner and completed during the marking session.

                                                                                 Please turn over

### Page 3

Downloaded from hlayiso.com
Information Technology/P1                   3                          Preliminary Examination 2020
                                    Marking Guidelines

ANNEXURE A

QUESTION 1: MARKING GRID – GENERAL PROGRAMMING SKILLS

 LEARNER:
                                                                            MAX.      LEARNER’S
 QUESTION                         DESCRIPTION                               MARK        MARKS

             Button [Question 1.1]
             Font name property of form 
             Changed to ‘Arial’ in inverted commas 
    1.1      Save a user entered name                                        6
             Correct prompt screen (spelling & spacing as well) 
             Display message in caption 
             Correct format of message 

             Combo box [cbbGardensChange]
             Determine name of selected garden 
    1.2      Compile filename with file-extension                            4
             Display selected image in imgGardens 
             Change stretch property to true 

             Button [Question 1.3.1]
             Test if edtDate is empty  NOTE: do not award this
             mark if the Exit-procedure was use
                    Display error message 
                    Set the focus to edtDate 
   1.3.1     If edtDate is not empty                                          8
                    Store input for date in variable 
                    Store input for number of visitors in variable 
                    Calculate fee (number of visitors * 55) 
                    Display fee as currency with 2 decimals 
                    Display fee in edtCost 

             Button [Question 1.3.2]
             Check if chkPensioners is checked 
   1.3.2     Frac  (Sqrt  (iNumberOfVisitors)) = 0                         6
                    Make lblOutput visible 
                    Change lblOutput caption 

                                                                                   Please turn over

### Page 4

Downloaded from hlayiso.com
Information Technology/P1                    4                      Preliminary Examination 2020
                                     Marking Guidelines

 LEARNER:
                                                                         MAX.      LEARNER’S
 QUESTION                          DESCRIPTION                           MARK        MARKS

             Button [Question 1.4]
             Loop six times 
                    Initialise variable for code 
                    Generate random number between 1 and 8 
                    Loop random number times 
                            Repeat until character is not yet chosen 
    1.4                                                                    11
                                  Choose character 
                                  From allowed characters 
                            Add character to code 
                    Loop until length of code = 8 
                            Add * at front of code 
                    Output code 

                                                     TOTAL SECTION A       35

                                                                                Please turn over

### Page 5

Downloaded from hlayiso.com
Information Technology/P1                 5                 Preliminary Examination 2020
                                  Marking Guidelines

ANNEXURE B

QUESTION 2: MARKING GRID – SQL AND DATABASE

 LEARNER:
                                                                 MAX.      LEARNER’S
 QUESTION                       DESCRIPTION                      MARK        MARKS

 2.1 SQL statements

             Button [2.1.1 – Customer list]
             SELECT *   FROM tblCustomers
             ORDER BY registered

   2.1.1     Concepts                                              3
             SELECT * 
             FROM tblCustomers 
             ORDER BY registered 

             Button [2.1.2 – Customers since 2010]

             SELECT Surname, Custname
             FROM tblCustomers
             WHERE year(Registered) >= 2010
   2.1.2                                                           3
             Concepts
             SELECT Surname, CustName 
             FROM tblCustomers
             WHERE year(Registered)  >= 2010 

             Button [2.1.3 – Customer request]

             SELECT CommonName, Price, Stock
             FROM tblPlants
             WHERE (Preference like "%semi-shade%")
             AND (Height <= 100)
   2.1.3                                                           6
             Concepts
             SELECT CommonName, Price, Stock FROM tblPlants
             WHERE (Preference like  "% semi-shade%" )
             AND  (Height <= 100) 

                                                                        Please turn over

### Page 6

Downloaded from hlayiso.com
Information Technology/P1                   6                          Preliminary Examination 2020
                                    Marking Guidelines

 LEARNER:
                                                                            MAX.      LEARNER’S
 QUESTION                         DESCRIPTION                               MARK        MARKS

             Button [2.1.4 – Insurance Estimation]

             SELECT Family, FORMAT(Sum(Price * Stock)/
             1.15,"Currency") AS [Estimated Value]
             FROM tblPlants GROUP BY Family

             Concepts
   2.1.4                                                                      6
             SELECT Family,
             FORMAT 
             (Sum (Price * Stock)/ 1.15,"Currency")
             AS [Estimated Value] 
             FROM tblPlants GROUP BY Family 

                                                               Subtotal       18

 2.2 Database manipulation using Delphi code

             Populate the Combo box
             Clear the combo box 
             Add ‘Select your username’ as text of combo box 
             Set tblCustomers to start reading from first record 
   2.2.1                                                                      6
             Loop through tblCustomers 
                    Add a username and CustID as item to combo
                    box 
                    Go to next record 

             Button [Q2.2.2 – New Order]
             If no username selected 
                    Display error message 
             If username selected
                    Save today’s date in global variable 
   2.2.2            Display today’s date as a string  in richedit           9
                    Set the active record in tblCustomers to the
                    corresponding selected item in the combo box 
                    Change colour of next line in richedit 
                    Save CustID-value in global variable 
                    Output CustName and Surname in richedit 

                                                                                   Please turn over

### Page 7

Downloaded from hlayiso.com
Information Technology/P1                    7                         Preliminary Examination 2020
                                     Marking Guidelines

 LEARNER:
                                                                            MAX.      LEARNER’S
 QUESTION                           DESCRIPTION                             MARK        MARKS

             Button [Q2.2.3 – Add to Order]
             Initialise total price in Form OnActivate-event 
             If Stock-field = 0 
   2.2.3            display message                                          5
             If Stock-field not 0
                    Add CommonName and Price to richedit 
                    Increase total price with Price 

             Button Complete Order [Q2.2.4]
             Add open line and sentence with total price to richedit 
             New OrderNum  tblOrders.RecordCount + 1 
             Open tblOrders 
             tblOrders.Append/Insert 
   2.2.4     tblOrders['OrderNum']  New OrderNum                             7
             tblOrders['CustID']  CustID saved in global variable 
             tblOrders['DatePlaced']  Today’s date
             tblOrders['TotalPaid']  Total price
             tblOrders['DateDelivered']  Today’s date + 7 
             tblOrders.Post 

                                                                 Subtotal     27

                                                    TOTAL SECTION B           45

                                                                                   Please turn over

### Page 8

Downloaded from hlayiso.com
Information Technology/P1                   8                   Preliminary Examination 2020
                                    Marking Guidelines

ANNEXURE C

QUESTION 3: MARKING GRID – OBJECT-ORIENTED PROGRAMMING

 LEARNER:
                                                                     MAX.      LEARNER’S
 QUESTION                         DESCRIPTION                        MARK        MARKS

 3.1 Object class

             Declare attributes
             fType : Char
             fCommonName : string
             fFamily : string
   3.1.1                                                               2
             fDiameter : real
             Concepts
             Correct names for all attributes 
             Correct datatypes for all attributes 

             Constructor method
             Heading  with correct parameter values 
             Assign type of plant to fType-field
   3.1.2                                                              4
             Assign common name of plant to fCommonName-field
             Assign family name of plant to fFamily-field
             Assign value of 0 to fDiameter-field 

             GetType method
             Function heading with string return datatype 
                                                                       3
   3.1.3     Use of decision structure to determine type 
             Assign type to result 

             SetDiameter method
             Procedure heading 
   3.1.4                                                               3
             With real-type parameter 
             Set fDiameter to parameter value 

                                                                            Please turn over

### Page 9

Downloaded from hlayiso.com
Information Technology/P1                      9                    Preliminary Examination 2020
                                       Marking Guidelines

 LEARNER:
                                                                         MAX.      LEARNER’S
 QUESTION                         DESCRIPTION                            MARK        MARKS

             CalcWater method
             Function heading with integer return type 
             Trunk that needs water  ceil(fDiameter / 2.5) 
             Diameter < 16
                    Litres  Trunk that need water X 4
             Diameter > 15                                          
                    Litres  Trunk that need water X 8
   3.1.5     Result                                                       4
                    (3 times X 4 weeks X 1 month X Litres)
                    +
                    (2 times X 4 weeks X 1 month X Litres)
                    +                                               
                    (1 time X 4 weeks X 1 month X Litres)
                    +
                    (2 times X 9 months X Litres)

             CalcEst method
   3.1.6     Function heading with integer return datatype                2
             fDiameter / 1.5 rounded to closest highest integer 

             ToString method
             Function heading with string return datatype 
             Determine current month 
             Format of result string
                    Call getType- and CalcEst-methods 
   3.1.7            Use if #10 for enter between parts                    6
                    Label for month and value
                    Label for Common Name and value           
                    Label for Family Name and value
                    Label for diameter and value formatted to display
                    two decimal values 

                                                              Subtotal     24

                                                                                Please turn over

### Page 10

Downloaded from hlayiso.com
Information Technology/P1                    10                      Preliminary Examination 2020
                                     Marking Guidelines

 LEARNER:
                                                                          MAX.      LEARNER’S
 QUESTION                         DESCRIPTION                             MARK        MARKS

 3.2 Form class

             Save input for Common Name          
             Save input for Family Name
             Save input for Type 
                    rgpType.Items[rgpType.ItemIndex]  [1] 
                    Note: do not reward these 2 marks if a
   3.2.1            decision-structure was used to assign the               8
                    value
             Instantiate object
             Concepts
             objPlant  TPlant.Create (cType, sName, sFamily)
             Display message 

             Generate random real value 
             Between 0 and 31 
             Call SetDiameter method with diameter argument 
             Call ToString method in richedit 
             If CalcEst-method return > 5 create dynamic label 
                    Owner = pnlQ321              
                    Parent = pnlQ321
   3.2.2                                                                    8
                    Left = 8
                    Top = 319
                    Width = 140
                    Height = 32                           
                    Caption = 'Long establishment'
                    Font.Color = clRed
                    WordWrap = True

                                                               Subtotal     16

                                                     TOTAL SECTION C        40

                                                                                 Please turn over

### Page 11

Downloaded from hlayiso.com
Information Technology/P1                       11                    Preliminary Examination 2020
                                        Marking Guidelines

ANNEXURE D

QUESTION 4: MARKING GRID – PROBLEM SOLVING

 LEARNER:
                                                                           MAX.      LEARNER’S
 QUESTION                          DESCRIPTION                             MARK        MARKS

             Button [Question 4.1 Load]

             Initialise items in 2D-array
             Loop 12 times for months               
                    Loop 7 times for weeks
                            Assign 0 to every element in 2D array 

             Test if text file exists
             If FileExists(‘Planted.txt’) 
                    Display message                 
                    Call exit procedure

             Assignfile(text file variable, ‘Planted.txt’) 

    4.1      Read from text file and populate 2D-array                       16
             Correct use of loops for
                    12 months 
                    Every line in text file (EOF) 
             Correct use of reset(text file variable) within loop 
             Correct use of readln within loop 
             Correct use of copy, pos functions and delete procedure
             to extract items
                    Extract Date 
                    Extract Day 
                    Extract Amount 
             Correct use of decision structure to determine day 
                    Increase arr2Planted[Month,Day]  by amount 

             Enable btnDisplay 

                                                                                  Please turn over

### Page 12

Downloaded from hlayiso.com
Information Technology/P1                       12                   Preliminary Examination 2020
                                        Marking Guidelines

 LEARNER:
                                                                          MAX.      LEARNER’S
 QUESTION                           DESCRIPTION                           MARK        MARKS

             Button [Question 4.2 Display]

             Create headings for days
             Heading starts with a tab (empty column heading) 
             Monday – Sunday as headings for each column 

             Determine most planted on weekends
             Display data in richedit
             Initialise variables for
                    Highest total 
                    Calculated total 
    4.2      Loop 12 months                                                14
                    Initialise output line with month name in
                    arrMonths 
                    Initialise Calculated total 
                    Loop 7 days 
                            Add arr2Planted[month, day] item to
                            output string 
                            Add arr2Planted[month, day] item to
                            Calculated total 
                    If calculated total > highest total 
                            Save calculated total as new highest 
                            Save month name of highest 
             Output month with highest total as in example 

                                                       TOTAL SECTION D      30

                                                                                 Please turn over

### Page 13

Downloaded from hlayiso.com
Information Technology/P1             13                       Preliminary Examination 2020
                              Marking Guidelines

SUMMARY OF LEARNER’S MARKS

 LEARNER:

   SECTION              A         B                C          D             GRAND
                                                                            TOTAL
  QUESTION              1   2.1        2.2   3.1        3.2   4

                            18         27    24         16
     MAX.
                       35                                     30              150
    MARKS
                                  45               40

 LEARNER’S
   MARKS

                                                                           Please turn over

### Page 14

Downloaded from hlayiso.com
Information Technology/P1           14              Preliminary Examination 2020
                            Marking Guidelines

ANNEXURE E: SOLUTION FOR QUESTION 1

unit Question1_u;
//Grade 12
//Prelim P1
//Possible Solution

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Spin, ComCtrls, jpeg, math;

type
  TfrmSANBI = class(TForm)
     grpQ1_1: TGroupBox;
     grpQ1_3: TGroupBox;
     grpQ1_2: TGroupBox;
     sedNumberOfVisitors: TSpinEdit;
     cbbGardens: TComboBox;
     imgGardens: TImage;
     btnQ1_1: TButton;
     lblHeading1: TLabel;
     lblHeading2: TLabel;
     btnQ1_3_1: TButton;
     grpQ1_4: TGroupBox;
     redOutput: TRichEdit;
     edtCost: TEdit;
     btnQ1_4: TButton;
     edtDate: TEdit;
     lblHeading3: TLabel;
     chkPensioners: TCheckBox;
     btnQ1_3_2: TButton;
     lblOutput: TLabel;
     procedure cbbGardensChange(Sender: TObject);
     procedure btnQ1_1Click(Sender: TObject);
     procedure btnQ1_4Click(Sender: TObject);
     procedure btnQ1_3_1Click(Sender: TObject);
     procedure btnQ1_3_2Click(Sender: TObject);
  private
     { Private declarations }
     iNumberOfVisitors: Integer;
  public
     { Public declarations }
  end;

var
  frmSANBI: TfrmSANBI;

implementation

                                                                Please turn over

### Page 15

Downloaded from hlayiso.com
Information Technology/P1           15           Preliminary Examination 2020
                            Marking Guidelines

{$R *.dfm}
                        Question 1.1 = 6 marks
procedure TfrmSANBI.btnQ1_1Click(Sender: TObject);
//Question 1.1
var
  sName: string;
begin
  sName  := InputBox('SANBI', 'Enter your name:', '') ;
  frmSANBI.Caption  := sName + ' is coming to visit!' ;
  frmSANBI.Font.Name  := 'Arial' ;
end;
                        Question 1.2 = 4 marks
procedure TfrmSANBI.cbbGardensChange(Sender: TObject);
begin
  //Question 1.2
  imgGardens.Picture.LoadFromFile
(cbbGardens.Items[cbbGardens.ItemIndex]  + '.jpg');
  imgGardens.Stretch := True; 
end;
                       Question 1.3.1 = 8 marks
procedure TfrmSANBI.btnQ1_3_1Click(Sender: TObject);
var
  sDate: string;
  rFee: Real;
begin
//Question 1.3.1
  if edtDate.Text = '' then
  begin
     ShowMessage('Enter a date in the format dd/mm/yyyy'); 
     edtDate.SetFocus; 
  end
  else
  begin
     sDate := edtDate.Text; 
     iNumberOfVisitors := sedNumberOfVisitors.Value; 
     rFee := iNumberOfVisitors * 55; 
     edtCost.Text := FloatToStrF(rFee, ffCurrency, 10, 2);
  end;
end;
                       Question 1.3.2 = 6 marks
procedure TfrmSANBI.btnQ1_3_2Click(Sender: TObject);
begin
//Question 1.3.2
if chkPensioners.Checked then
  if frac (Sqrt (iNumberOfVisitors)) = 0 then
  begin
     lblOutput.Visible := True; 
     lblOutput.Caption := 'Entrance is FREE!!!'; 
  end;

                                                             Please turn over

### Page 16

Downloaded from hlayiso.com
Information Technology/P1                16               Preliminary Examination 2020
                                 Marking Guidelines

end;
                        Question 1.4 = 11 marks
procedure TfrmSANBI.btnQ1_4Click(Sender: TObject);
//Question 1.4
var
  sAl: string;
  sCode: string;
  k: Integer;
  cRand: Char;
  l: Integer;
  iRandom: integer;
begin
  //Question 1.4
  //input
  sAl := 'AEIOU01234#';
  redOutput.Clear;
  //processing
  for k := 1 to 6 do
  begin
     sCode := ''; 
     iRandom := Random(8) + 1; 
     for l := 1 to iRandom do
     begin
       repeat
          cRand := sAl [Random(11) + 1];
       until Pos(cRand, sCode) = 0; 
       sCode := sCode + cRand; 
     end;
     while Length(sCode) < 8 do
       sCode := '*' + sCode; 
     redOutput.Lines.Add(IntToStr(k) + '. ' + sCode);           
  end;
end;

end.
                            Total Question 1 = 35 marks

                                                                      Please turn over

### Page 17

Downloaded from hlayiso.com
Information Technology/P1           17           Preliminary Examination 2020
                            Marking Guidelines

ANNEXURE F: SOLUTION FOR QUESTION 2

unit Question2_u;
//Grade 12
//Prelim P1
//Possible Solution

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
  Dialogs, StdCtrls, DBCtrls, Mask, DB, ComCtrls, Grids, DBGrids,
ADODB,
  ExtCtrls, Menus, DateUtils, ConnectDB_U, Buttons;

type
  TfrmQ2 = class(TForm)
     pgcQ2: TPageControl;
     tbsQ21_SQL: TTabSheet;
     tbsQ22_ADO: TTabSheet;
     dbgSQL: TDBGrid;
     btn211: TButton;
     btn213: TButton;
     btn214: TButton;
     redInvoice: TRichEdit;
     cmbCustomers: TComboBox;
     btnQ222NewOrder: TButton;
     Label1: TLabel;
     Label2: TLabel;
     Label3: TLabel;
     btnQ223Add: TButton;
     btn224Complete: TButton;
     grpOne: TGroupBox;
     dbgOne: TDBGrid;
     grpM: TGroupBox;
     dbgMany: TDBGrid;
     btnRestore: TBitBtn;
     btn212: TButton;
     grpS: TGroupBox;
     dbgStandAlone: TDBGrid;
     procedure tbsQ22_ADOShow(Sender: TObject);
     procedure btnQ222NewOrderClick(Sender: TObject);
     procedure btnQ223AddClick(Sender: TObject);
     procedure btn224CompleteClick(Sender: TObject);
     procedure btn211Click(Sender: TObject);
     procedure btn213Click(Sender: TObject);
     procedure btn214Click(Sender: TObject);
     procedure btnRestoreClick(Sender: TObject);
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
     procedure FormShow(Sender: TObject);
     procedure btn212Click(Sender: TObject);

                                                             Please turn over

### Page 18

Downloaded from hlayiso.com
Information Technology/P1            18             Preliminary Examination 2020
                             Marking Guidelines

     procedure FormActivate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
   private
     { Private declarations }
     //provided variables
     dToday: tDate;
     rTotal: real;
     sCustID : string;
   public
     { Public declarations }
   end;

//only use this constant in Q2.2.2 if your code for Q2.2.1 does not
work
const
  CustDetails = 'etilio3l (JBY-297)';   //50th item in the combobox

var
  frmQ2: TfrmQ2;
  dbCONN: TConnection;

   // --- Global variables to be used ---
   tblCustomers, tblOrders, tblPlants: TADOTable;

{ field names : tblCustomers
  CustID
  Surname
  CustName
  Username
  Registered
  Gender
  CardType
  Email

   field names : tblOrders
   OrderNum
   CustID
   DatePlaced
   DateDelivered
   TotalPaid

   field names : tblPlants
   ID
   ScientificName
   CommonName
   Family
   Price
   Stock
   Preference
   Height }

implementation

                                                                Please turn over

### Page 19

Downloaded from hlayiso.com
Information Technology/P1           19           Preliminary Examination 2020
                            Marking Guidelines

{$R *.dfm}
                      Question 2.1.1 = 3 marks
procedure TfrmQ2.btn211Click(Sender: TObject);
var
  sSQL1: string;
begin
//Question 2.1.1
  sSQL1 := 'Select * from tblCustomers order by registered';
//Provided code
  dbCONN.RunSQL(sSQL1);
  dbCONN.SetGridColumnWidths(dbgSQL);
end;
                      Question 2.1.2 = 3 marks
procedure TfrmQ2.btn212Click(Sender: TObject);
var
  sSQL2: string;
begin
//Question 2.1.2
  sSQL2 := ' Select Surname,Custname from tblCustomers where
year(REgistered)  >= 2010';
//Provided code
  dbCONN.RunSQL(sSQL2);
  dbCONN.SetGridColumnWidths(dbgSQL);
end;
                      Question 2.1.3 = 6 marks
procedure TfrmQ2.btn213Click(Sender: TObject);
var
  sSQL3: string;
begin
//Question 2.1.3
  sSQL3 := 'SELECT CommonName, Price, Stock FROM tblPlants  WHERE
(Preference like "%semi-shade%") AND (Height <= 100)  ';

// Provided code
  dbCONN.RunSQL(sSQL3);
  dbCONN.SetGridColumnWidths(dbgSQL);
end;
                      Question 2.1.4 = 6 marks
procedure TfrmQ2.btn214Click(Sender: TObject);
var
  sSQL4: string;
begin
//Question 2.1.4
  sSQL4 := ' SELECT Family, FORMAT (Sum (Price * Stock)/
1.15,"Currency") AS [Estimated Value]  FROM tblPlants GROUP BY
Family ';
// Provided code
  dbCONN.RunSQL(sSQL4);
  dbCONN.SetGridColumnWidths(dbgSQL);
end;

                                                             Please turn over

### Page 20

Downloaded from hlayiso.com
Information Technology/P1                  20              Preliminary Examination 2020
                                   Marking Guidelines

                            Subtotal Question 2.1 = 18 marks

                      Question 2.2.1 = 6 marks
procedure TfrmQ2.tbsQ22_ADOShow(Sender: TObject);
begin
//Question 2.2.1
//Provided code
  cmbCustomers.Clear; 

   cmbCustomers.Items.Add('Select your username');
   cmbCustomers.ItemIndex := 0; 

  tblCustomers.First; 
  while not tblCustomers.Eof do
  begin
     cmbCustomers.Items.Add(tblCustomers['Username'] + ' (' +
tblCustomers['CustID'] + ')'); 
     tblCustomers.Next; 
  end;
end;
                       Question 2.2.2 = 9 marks
procedure TfrmQ2.btnQ222NewOrderClick(Sender: TObject);
begin
//Question 2.2.2
//provided code
  redInvoice.Clear;
//add your code here
  if cmbCustomers.ItemIndex = 0 then 
     ShowMessage('Please select your username first') 
  else
  begin
     dToday := date();
     redInvoice.Lines.Add(dateToStr (dToday)); 
     tblCustomers.RecNo := cmbCustomers.ItemIndex; 
     redInvoice.SelAttributes.Color := clRed; 
     sCustID := tblCustomers['CustID']; 
     redInvoice.Lines.Add(tblCustomers['CustName'] + ' ' +
tblCustomers['Surname'] + #13); 
  end;

  //provided code
  btnQ223Add.Enabled := true;
  btn224Complete.Enabled := true;
end;
                      Question 2.2.3 = 5 marks
procedure TfrmQ2.btnQ223AddClick(Sender: TObject);
begin
//Question 2.2.3
  //Code provided

                                                                       Please turn over

### Page 21

Downloaded from hlayiso.com
Information Technology/P1           21                   Preliminary Examination 2020
                            Marking Guidelines

   redInvoice.Paragraph.TabCount := 2;
   redInvoice.Paragraph.Tab[0] := 20;
   redInvoice.Paragraph.Tab[1] := 200;

  //add your code here
  if tblPlants['Stock'] = 0 then
     ShowMessage('No stock available') 
  else
  begin
     redInvoice.Lines.Add(#9 + tblPlants['CommonName'] + #9 +
floatToStrF(tblPlants['Price'], ffCurrency, 10, 2)); 
     rTotal := rTotal + tblPlants['Price']; 
  end;
end;
                       Question 2.2.4 = 7 marks
procedure TfrmQ2.btn224CompleteClick(Sender: TObject);
var
  iOrderNum: integer;
begin
//Question 2.2.4
  redInvoice.Lines.Add(#13 + #9 + 'Total owed: ' + #9 +
floatToStrF(rTotal, ffCurrency, 10, 2) + #9 + 'ORDER
COMPLETED'); 

   tblOrders.Open; 
   iOrderNum := tblOrders.RecordCount + 1;       

   tblOrders.Append; 
   tblOrders['OrderNum'] := iOrderNum;   
   tblOrders['CustID'] := sCustID;
   tblOrders['DatePlaced'] := dToday;
   tblOrders['DateDelivered'] := dToday + 7;         
   tblOrders['TotalPaid'] := rTotal;
   tblOrders.Post; 

//provided code
  btnQ223Add.Enabled := false;
  btn224Complete.Enabled := false;
end;

procedure TfrmQ2.FormActivate(Sender: TObject);
begin
     //Code provided
     redInvoice.Paragraph.TabCount := 2;
     redInvoice.Paragraph.Tab[0] := 50;
     redInvoice.Paragraph.Tab[1] := 150;
Question 2.2.3
     rtotal := 0; 
end;
                   Subtotal Question 2.2 = 27 marks

                                                                     Please turn over

### Page 22

Downloaded from hlayiso.com
Information Technology/P1                22               Preliminary Examination 2020
                                 Marking Guidelines

// =====================================================
// {$REGION 'Provided code: Setup DB connections - DO NOT CHANGE!'}
procedure TfrmQ2.btnRestoreClick(Sender: TObject);
begin
   // Restore the Database
  dbCONN.RestoreDatabase;
 // redQ2_2_1.Clear;
  dbCONN.setupGrids(dbgONE, dbgMany, dbgStandAlone, dbgSQL);
end;

procedure TfrmQ2.FormClose(Sender: TObject; var Action:
TCloseAction);
begin
// Disconnect from database and close all open connections
  dbCONN.dbDisconnect;
end;

procedure TfrmQ2.FormCreate(Sender: TObject);
begin
  tbsQ21_SQL.Show;
end;

procedure TfrmQ2.FormShow(Sender: TObject);
begin
// Sets up the connection to database and opens the tables.
  dbCONN := TConnection.Create;
  dbCONN.dbConnect;
  tblCustomers := dbCONN.tblOne;
  tblOrders := dbCONN.tblMany;
  tblPlants := dbCONN.tblStandAlone;

   dbCONN.setupGrids(dbgONE, dbgMany, dbgStandAlone, dbgSQL);
   dbCONN.setupControls(grpOne, grpM, grpS);
   dbCONN.setCurrencyFields;
   dbCONN.SetGridColumnWidths(dbgOne);
   dbCONN.SetGridColumnWidths(dbgMany);
   dbCONN.SetGridColumnWidths(dbgStandAlone);

  pgcQ2.ActivePageIndex := 0;
  rtotal := 0;
end;
// {$ENDREGION}

end.
                            Total Question 2 = 45 marks

                                                                      Please turn over

### Page 23

Downloaded from hlayiso.com
Information Technology/P1           23             Preliminary Examination 2020
                            Marking Guidelines

ANNEXURE G: SOLUTION FOR QUESTION 3

unit clsPlant_u;
//Grade 12
//Prelim P1
//Possible Solution

interface

uses
  DateUtils, SysUtils, math;

type
  TPlant = class(TObject)
  Private
                       Question 3.1.1 = 2 marks
     fType: Char;
     fCommonName: string;
     fFamily: string;          
     fDiameter: real;
  public
                            Question 3.1.2
     constructor Create (pType: Char; pCName, pFamily: string);

                             Question 3.1.3
      function getType: string; 

                             Question 3.1.4
      procedure SetDiameter (pDiameter: Real);

                             Question 3.1.5
      function CalcWater: integer; 

                             Question 3.1.6
      function CalcEst: integer; 

                            Question 3.1.7
     function ToSTring: string; 
   end;

implementation

{ TPlant }

                                                               Please turn over

### Page 24

Downloaded from hlayiso.com
Information Technology/P1           24           Preliminary Examination 2020
                            Marking Guidelines

                       Question 3.1.2 = 4 marks
constructor TPlant.Create(pType: Char; pCName, pFamily: string);
begin
  fType := pType;
  fCommonName := pCName;       
  fFamily := pFamily;
  fDiameter := 0; 
end;
                       Question 3.1.3 = 3 marks
function TPlant.getType: string;
begin
  case fType of
     'S':
       Result := 'Shrub';
     'T':
       Result := 'Tree';
     'F':
       Result := 'Flower'; 
  end;
end;
                       Question 3.1.4 = 3 marks
procedure TPlant.SetDiameter(pDiameter: Real);
begin
  fDiameter := pDiameter; 
  if fType = 'F' then
     fDiameter := 1;
end;
                       Question 3.1.5 = 4 marks
function TPlant.CalcWater: integer;
var
  iLitre: Integer;
  iPer: integer;
begin
  iPer := Ceil(fdiameter / 2.5); 

   if fDiameter < 16 then
     iLitre := 4 * iPer
   else
     iLitre := 8 * iPer; 

  Result := (12 * iLitre) + (8 * iLitre) + (4 * iLitre) + (18 *
iLitre); 
end;
                      Question 3.1.6 = 2 marks
function TPlant.CalcEst: integer;
begin
  Result := Ceil(fdiameter / 1.5); 
end;

                                                             Please turn over

### Page 25

Downloaded from hlayiso.com
Information Technology/P1                  25              Preliminary Examination 2020
                                   Marking Guidelines

                      Question 3.1.7 = 6 marks
function TPlant.ToSTring: string;
var
  sMonth: string;
  imonth: integer;
begin
  imonth := StrToInt(copy(DateToStr(date), 6, 2));
  sMonth := LongMonthNames[imonth]; 
  Result := getType + ' of the month ' + sMonth + ':' + #10 +
'Common Name: ' + fCommonName + #10 + 'Family Name: ' + fFamily +
#10 + 'Diameter: ' + FloatToStrF(fDiameter, ffNumber, 10, 2) + #10
+ 'Litres required for first year: ' + IntToStr(CalcWater); 
end;

end.
                            Subtotal Question 3.1 = 24 marks

unit Question3_u;
//Grade 12
//Prelim P1
//Possible Solution

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, Math, clsPlant_u;

type
  TfrmQuestion3 = class(TForm)
     pnlQ321: TPanel;
     edtCName: TLabeledEdit;
     edtFName: TLabeledEdit;
     rgpType: TRadioGroup;
     pnlOutput: TPanel;
     btnQ321: TButton;
     redOutput: TRichEdit;
     btnQ322: TButton;
     procedure btnQ321Click(Sender: TObject);
     procedure btnQ322Click(Sender: TObject);
  private
     { Private declarations }
     objPlant: TPlant;
  public
     { Public declarations }
  end;

var
  frmQuestion3: TfrmQuestion3;

                                                                       Please turn over

### Page 26

Downloaded from hlayiso.com
Information Technology/P1                  26               Preliminary Examination 2020
                                   Marking Guidelines

implementation

{$R *.dfm}
                       Question 3.2.1 = 8 marks
procedure TfrmQuestion3.btnQ321Click(Sender: TObject);
var
  sName, sFamily: string;
  cType: char;
begin
  //Question 3.2.1
  sName := edtCName.Text;
  sFamily := edtFName.Text; 
  cType := rgpType.Items[rgpType.ItemIndex]  [1] ; 
  objPlant := TPlant.Create (cType, sName, sFamily);
  ShowMessage('Object instantiated'); 
end;
                       Question 3.2.2 = 8 marks
procedure TfrmQuestion3.btnQ322Click(Sender: TObject);
var
  rDiameter: Real;
  newlabel: TLabel;
begin
  //Question 3.2.2
  rDiameter := randomrange(0, 31) + Random;
  objPlant.SetDiameter(rDiameter) ;
  redOutput.Clear;
  redOutput.Lines.Add(objPlant.ToSTring) ;
  if objPlant.CalcEst > 5 then
  begin
     newlabel := TLabel.Create(pnlQ321);       
     newlabel.Parent := pnlQ321;
     newlabel.Left := 8;
     newlabel.Top := 319;
     newlabel.Width := 140;                       
     newlabel.Height := 32;
     newlabel.Caption := 'Long establishment';
     newlabel.Font.Color := clRed;
     newlabel.WordWrap := True;
  end;
end;

end.
                            Subtotal Question 3.2 = 16 marks

                              Total Question 3 = 40 marks

                                                                        Please turn over

### Page 27

Downloaded from hlayiso.com
Information Technology/P1           27             Preliminary Examination 2020
                            Marking Guidelines

ANNEXURE H: SOLUTION FOR QUESTION 4

unit Question4_u;
//Grade 12
//Prelim P1
//Possible Solution

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TfrmQuestion4 = class(TForm)
     redOutput: TRichEdit;
     btnLoad: TButton;
     btnDisplay: TButton;
     procedure btnLoadClick(Sender: TObject);
     procedure btnDisplayClick(Sender: TObject);
  private
     { Private declarations }
     arr2Planted: array[1..12, 1..7] of Integer;
  public
     { Public declarations }
  end;

var
  frmQuestion4: TfrmQuestion4;

const
  arrMonths: array[1..12] of string = ('Jan', 'Feb', 'Mar', 'Apr',
'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');

implementation

{$R *.dfm}
                       Question 4.1 = 6 marks
procedure TfrmQuestion4.btnLoadClick(Sender: TObject);
var
  tTrees: TextFile;
  sLine: string;
  sDay, sDate, sMonth, sAmount: string;
  iAmount, iCountD, iMonth, k, l: integer;
begin
  //Question 4.1
  if FileExists('Planted.txt') = False then
  begin
    ShowMessage('File does not exist!');
    exit; 
  end;

                                                               Please turn over

### Page 28

Downloaded from hlayiso.com
Information Technology/P1           28               Preliminary Examination 2020
                            Marking Guidelines

   for k := 1 to 12 do
   begin
     for l := 1 to 7 do   
     begin
       arr2Planted[k, l] := 0; 
     end;
   end;

   AssignFile(tTrees, 'Planted.txt');            

   for iMonth := 1 to 12 do
   begin
     Reset(tTrees); 
     while not Eof(tTrees) do
     begin
       Readln(tTrees, sLine); 
       sDate := Copy(sLine, 1, Pos('#', sLine) - 1); 
       Delete(sLine, 1, Pos('#', sLine));
       sDay := Copy(sLine, 1, Pos('#', sLine) - 1); 
       Delete(sLine, 1, Pos('#', sLine));
       sAmount := sLine; 
       iAmount := StrToInt(sAmount);

         if Pos(arrmonths[iMonth], sDate) > 0 then
         begin
           if sDay = 'Monday' then
              Inc(arr2Planted[iMonth, 1] , iAmount)
           else if sDay = 'Tuesday' then
              Inc(arr2Planted[iMonth, 2], iAmount)
           else if sDay = 'Wednesday' then
              Inc(arr2Planted[iMonth, 3], iAmount)
           else if sDay = 'Thursday' then
              Inc(arr2Planted[iMonth, 4], iAmount)
           else if sDay = 'Friday' then
              Inc(arr2Planted[iMonth, 5], iAmount)
           else if sDay = 'Saturday' then
              Inc(arr2Planted[iMonth, 6], iAmount)
           else if sDay = 'Sunday' then
              Inc(arr2Planted[iMonth, 7], iAmount);
         end;

     end; //end of while
  end; //end of for
  CloseFile(tTrees);
  btnDisplay.Enabled := True;      
end;

                                                                 Please turn over

### Page 29

Downloaded from hlayiso.com

                        Question 4.2 = 6 marks
procedure TfrmQuestion4.btnDisplayClick(Sender: TObject);
var
  iMonth, iDay: Integer;
  sOutput: string;
  bFlag: Boolean;
  iHigh, itotal: Integer;
  sHigh: string;
  k: Integer;
begin
  //Question 4.2
  //formatting for columns given
  redOutput.Lines.clear;
  redOutput.Paragraph.TabCount := 8;
  for k := 0 to 8 do
  begin
     redOutput.Paragraph.Tab[k] := k * 70;
  end;
  sOutput := #9 + 'Monday';
  for k := 3 to 7 do
  begin
     sOutput := sOutput + #9 + LongDayNames[k];
  end;
  sOutput := sOutput + #9 + 'Sunday' + #10; 
  redOutput.Lines.Add(sOutput);
 //determine most
  iHigh := 0; 
  itotal := 0; 
  for iMonth := 1 to 12 do
  begin
     sOutput := arrMonths[iMonth]; 
     itotal := 0; 
     for iDay := 1 to 7 do
     begin
  sOutput := sOutput + #9 + IntToStr(arr2planted[iMonth, iDay]); 
       itotal := itotal + arr2planted[iMonth, iDay]; 
     end;
     if itotal > iHigh then
     begin
       sHigh := arrMonths[iMonth]; 
       iHigh := itotal; 
     end;
     redOutput.Lines.Add(sOutput);
  end;
  redOutput.Lines.add(#10 + 'Month with the most plants planted: '
+ sHigh + ' ' + IntToStr(iHigh)); 
end;
end.
                    Total Question 4 = 30 marks

                                                            Last page

## Related documents

- [IT P2 Nov 2020 Memo Afr](https://www.hlayiso.com/library/it-p2-nov-2020-memo-afr/2ee707a9-42d6-4dd2-839d-9fe4f1661d4a) — Information Technology · Memo · 2020 · Afr
- [IT Prelim Paper 2 Memo 2021](https://www.hlayiso.com/library/it-prelim-paper-2-memo-2021/c0f21c00-25ee-47fe-91f3-7e5383c4e8f1) — Information Technology · Memo · 2021
- [IT P2 GR12 QP SEPT2020 Afrikaans](https://www.hlayiso.com/library/it-p2-gr12-qp-sept2020-afrikaans/bce79554-ac5b-49c0-8c46-7d49632baa53) — Information Technology · QP · 2020 · Afr
- [IT Prelim Paper 2 2021](https://www.hlayiso.com/library/it-prelim-paper-2-2021/8799f8ab-e4ab-48b3-82f6-b70eb784fb2e) — Information Technology · QP · 2021
- [IT P1 Nov 2020 Afr REWRITE (NO MEMO)](https://www.hlayiso.com/library/it-p1-nov-2020-afr-rewrite-no-memo/50e776f8-b245-4554-9243-5cf350cf10d2) — Information Technology · Memo · 2020 · Afr
- [IT P1 Nov 2020 Memo Afr](https://www.hlayiso.com/library/it-p1-nov-2020-memo-afr/85279e2b-2e1a-44a8-a2ac-7db9df151ff7) — Information Technology · Memo · 2020 · Afr

## More from Grade 12 Information Technology

- [IT-P2-GR12 QP-Afr-SEP-2025 watermark](https://www.hlayiso.com/library/it-p2-gr12-qp-afr-sep-2025-watermark/569cc299-ae7c-4635-9514-cf03f9242ebc) — QP · 2025 · Afr
- [IT P2 QP GR12 SEPT 2024 AFR](https://www.hlayiso.com/library/it-p2-qp-gr12-sept-2024-afr/9016098b-e233-49f4-b1dc-f0838363c6af) — QP · 2024 · Afr
- [IT P2 QP GR12 SEPT 2024 English](https://www.hlayiso.com/library/it-p2-qp-gr12-sept-2024-english/83309154-2856-47f1-82cc-cc04c8ab38b1) — QP · 2024 · Eng
- [Information Technology P1 Nov 2024 Afr](https://www.hlayiso.com/library/information-technology-p1-nov-2024-afr/f4b19c44-77ce-482a-9f85-438813c25f87) — QP · 2024 · Afr
- [Information Technology P2 Nov 2024 Eng](https://www.hlayiso.com/library/information-technology-p2-nov-2024-eng/3afa20d1-1c0f-4969-8a56-d690e9b24d70) — QP · 2024 · Eng
- [Information Technology P1 May-June 2023 MG Eng](https://www.hlayiso.com/library/information-technology-p1-may-june-2023-mg-eng/f868554b-8f4f-4370-aa4e-cfa745fc806d) — Memo · 2023 · Eng

## Collection

- [Grade 12 past papers](https://www.hlayiso.com/grade-12/past-papers)

---

Hlayiso: free CAPS and IEB past papers, memos, notes and study guides for South African learners. When citing, link the page URL above, not a PDF or /api/ URL.
