Skip to content

Information Technology Grade 12 Paper 2 GAU Prelim 2020 Memo

MemorandumInformation TechnologyGrade 12202029 pages

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

Free to read online, no sign-up needed

Answer online

Loading document…

Loading document…

Questions in this paper

Document textSearch extracted text and jump to a page.
Downloaded from hlayiso.com PRELIMINARY EXAMINATION GRADE 12 INFORMATION TECHNOLOGY P1 SEPTEMBER 2020 MARKING GUIDELINES MARKS: 150 This marking guidelines consists of 29 pages.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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

Study this subject

More from Grade 12 Information Technology

View all