Skip to content

Information Technology Grade 12 P2 NSC June 2012 QP (Eng)

Question paperInformation TechnologyGrade 12201218 pages

Grade 12 Information Technology Paper 2 question paper from the NSC June 2012 (English), 18 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 basic education Department: Basic Education REPUBLIC OF SOUTH AFRICA SENIOR CERTIFICATE EXAMINATION COMPUTER STUDIES P1 HIGHER GRADE 2012 MEMORANDUM MARKS: 100 This memorandum consists of 18 pages. Copyright reserved Please turn over moe =
Downloaded from hlayiso.com Computer Studies/HG/P1 2 SCE — Memorandum DBE/2012 QUESTION 1: DELPHI/QUESTION 3: TURBO PASCAL MARKS: 80 Explanation Marks Total Level Level Level Declare data type Declare file and file variables Function Surinit Heading Concatenate surname and first letter Repeat loop Determine position of space Delete and add following letter Result of function =! rp} wm} a] a} a Show procedure Determine if file exists Test and message Heading and subheading Columns Call function Surnamelnit File structure While/read/reset/close wo] YM) dR) = Write statement 12 HoursWorked function Declaration of function TextFile {assign/reset/close/while} readin Get first number Test for worker number =] rm} al nl a Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 3 DBE/2012 SCE — Memorandum Determine start time Determine end time Initialise and add time Calculate time if/then/else —) oO] NM) N! Nw Send time back 19 Calculate salary procedure Parameters 2 2 Case with category 2 2 If — determine salary 3 <) Payment statement Initialise Total Read month number Case to determine month name Headings and subheadings nm} =] wo] =) = File statements {reset/close/read/while} Call HoursWorked function Call salary procedure Increase total Get date of birth Test for bonus and add R1 000 Write * at end of line Show Total >| ©] ©] M! =]! NM! MH) NM) =|] Cw) A] => NM} =|) NM} NM Question ...Write to textfile/upcase Append/close Determine new line to write to textfile =| w) =| dD = User-friendly sentence/message 29 80 Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 4 DBE/2012 SCE — Memorandum QUESTION 2: DELPHI/QUESTION 4: TURBO PASCAL MARKS: 20 Explanation Marks | Total Level Level Level Declare two-dimensional array 1 1 Declare one-dimensional array 1 1 Assign/reset/close 1 1 while/readin 1 1 Determine row/column/value 3 3 Read into a two-dimensional array 2 2 Initialise totals 1 1 Nested for-loop 2 2 Determine totals for each column 2 2 Headings 1 1 Write down totals/field widths 1 1 if/petrol amount — calculation 3 3 Colour and wording in output 1 1 20 Totals of levels Tot 1 2 3 Question 1 80 28 34 18 Question 2 20 5 10 5 Total 100 33% | 44% | 23% Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 5 SCE — Memorandum DBE/2012 | QUESTION 1: DELPHI MARKS: 80 __| unit Vri_Qul_u; //Exam number interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics Forms, Dialogs, StdCtrls, ComCtrls, Buttons; type str10 = string[10]; str20 = string[20]; v TWorker = record Surname : Str20; SName : Str20; DOB : Str10; vv Category integer; end; TForml = class (TForm) btnShow: TButton; redshow: TRichEdit; btnLoneStatement: TButton; Buttonl: TButton; BitBtn TBitBtn; BitBtn2: TBitBtn; procedure btnShowClick(Sender: TObject procedure ButtonlClick(Sender: TObject procedure FormActivate(Sender: TObject procedure BitBtn1lClick(Sender: TObject procedure btnLoneStatementClick(Sender: TObject); private { Private declarations } dfile : file of TWorker; worker : TWorker; tfile : textFile; TLine: string; Vv public { Public declarations } function TSurInit (surname, sName:str20) :str20; function HoursWorked(nr:integer) :integer; procedure Salary(cat,hours:integer; var sal : real); end; var Forml: TForml; implementation {$R *.dfm} Copyright reserved Controls, Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 6 DBE/2012 SCE — Memorandum procedure TForml.FormActivate(Sender: TObject); begin redshow. Paragraph.TabCount redshow. Paragraph.Tab[0 redshow. Paragraph.Tab[1 redshow. Paragraph.Tab[2] redshow. Paragraph.Tab[3 end; function TForm1l.TSurInit(surname, sName: str20): str20; V var p : integer; va: Str20; begin VL:= Surname+', '+sName[1]; v Repeat p := pos(' ',sName) ; v ifp <0 Vv then begin delete (sName,1,p); VL := VL + SName[1]; VV fo end; { until p = 0; \ 8 result := VL; Vv ~ end; procedure TForml.btnShowClick (Sender: TObject); begin assignFile(dfile,'d_worker.dat'); if not (fileExists('d_worker.dat')) Vv then showmessage('File does not exist’) Vv else begin redshow.Clear; redshow.Lines.add('Worker Info:'); redshow.Lines.add('AmaGluGlu-Petrol station:'); V { headings} redshow.Lines.add(''); redshow.Lines.add('Record no:'+#9+'Name:'+#9+'Date of Birth: '+ #9+'Category:'); redshow.Lines.add(''); reset (dfile); V {reset/close} while not eof(dfile) do Vv {while} begin read(dfile,worker) ; V {read} redshow.lines.add(IntToStr(filepos(dfile)) Vv +#9+TSurInit (worker.Surname,worker.SName) VV +#9+worker.DOB+#9+IntToStr(worker.category) Vv); end; — closefile(dfile); end; ( 1 @) ) end; \ Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 7 DBE/2012 SCE - Memorandum function TForml.HoursWorked(nr: integer): integer; V var bTime,eTime,p,time,sessionTime: integer; begin assignFile(tFile,'D_times.txt'); VV {assign/reset/close/while} time := 0; sessionTime := 0; reset (tFile); while not eof (tfile) do begin readln(tfile,TLine) ; Vv {readin} p := StrToInt (copy(TLine,1,pos(',',TLine)-1)); VV{get first number} tf op = ore V {test worker number then begin delete (TLine,1,pos(',',TLine) ); bTime := StrToInt(copy(TLine,1,pos(',',TLine)-1));VV¥ {determine bTime} delete (TLine,1,pos(',',TLine) ); eTime := StrToInt (TLine) ; VV {determine eTime} if bTime < eTime V {if} then sessionTime := eTime - bTime VV {then} else \. / sessionTime := 24-bTime + eTime; VV {else} ~~ time := time + sessionTime; VV {Initialise and add} end; end; closeFile(tfile); result := sessionTime; V {send back} end; procedure TForml.Salary(cat, hours: integer; var sal: real); VV var Maand,r_hour : integer; begin case cat of 1: r_hour := 30; 2: r_hour := 35; VV {Determine tarif} 3: © ohour :— 55; end; if hours > 45 f 7 then Sal hours * R_hour * 1.12 \ else Sal := hours * R_hour; VVV {Determine Salary} end; procedure TForml.BitBtniClick(Sender: TObject); begin redshow.Clear; end; Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 8 DBE/2012 SCE — Memorandum procedure TForml.btnLoneStatementClick(Sender: TObject); var GebMonth,MonthNr,category,hours : integer; Salary,Total : real; MonthName,sTotal : string; ans : char; begin redshow.Clear; Total := 0; vv MonthNr StrToInt (inputbox('MonthNr', 'What is the resent month number?','')); case MonthNr of 1 =: MonthName ‘January'; Z MonthName 'February'; 3 MonthName ‘March'; 4 MonthName "April'; 5 : MonthName ‘May'; 6 : MonthName "June'; a MonthName ‘July'; 8 : MonthName "August'; 9 : MonthName := 'September'; 10 : MonthName "October'; 12 : MonthName := 'December'; Vv = 11 : MonthName := 'November'; end; redshow.Lines.add('AmaGluGlu-petrol station'); redshow.Lines.add('Lonestatement for: '+ MonthName) ; redshow.Lines.add(''); redshow.Lines.add('Surname'+#9+'SName'+#9+'Category'+#9+'Salary'); redshow.Lines.add(''); V {headings} reset (dfile); VV {reset se/while/read} while not eof(dfile) do begin read (dfile,worker) ; ure := HoursWorked(filepos(dfile)-1); VV {call HoursWorked function} Salary (worker.category, hours, salary) ; AN a Total := Total + salary; 4 {add to total} GebMonth := StrToInt (copy(worker.DOB,4,2));VV {Determine birth month}} with worker do begin if GebMonth = MonthNr V {Test for bonus} then begin salary salary + 1000; VV {add R1000 to salary and total} Total Total + 1000; redshow. lines. add (Surname+#9+SName+#9+IntToStr (category) +#9+FloatToStrf (sal ary,ffcurrency,10,2)+' '+ "*'); end else redshow. lines.add(Surname+#9+SName+#9+IntToStr (category) +#9+FloatToStrf (sal ary,ffcurrency,10,2)); end; VWV {output with * and without *} end; closefile(dfile); redshow.lines.add('Total : '+ FloatToStrf (Total, ffcurrency,10,2)); Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 9 DBE/2012 SCE — Memorandum redshow.lines.add(''); V {show Total} ans := inputbox('Write','Write data to file? J/N','') [1]; if upcase(ans) = 'J' VV {Question - upcase} then begin assignFile(tfile,'D_payments.txt'); append (tFile); V {append/close} ' TLine := MonthName +/,'+ FloatToStrf (Total, ffcurrency,10,2); eee” writeln(tFile,TLine) ; VVV {Determine TLine and write} closeFile(tFile); showmessage('Data written to file'); V (User-friendly sentence} end; end; end. Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 10 DBE/2012 SCE — Memorandum | QUESTION 2: DELPHI MARKS: 20 | unit Vr2XXXX_u; //exam number interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls; type TForml = class (TForm) redOutput: TRichEdit; Buttonl: TButton; procedure ButtonlClick(Sender: TObject); procedure FormActivate (Sender: TObject); private { Private declarations } public { Public declarations } end; var Forml: TForml; implementation {$R *.dfm} procedure TForml.ButtonlClick (Sender: Rie TFile : textFile; row,column,i integer; Amount : real; ArrT : array[1..3,1..4] of real; Tot : array[1..4] of real; line : string; begin redOutput.clear; assignFile(TFile,'D_reading.txt'); reset (TFile); while not eof(TFile) do begin readin (TFile, line) ; TObject); V Declare two D array NV Declare one D array V assign/reset/close V while/readin row := StrToInt(line[1]); VVVY determine row, column and value column StrToInt (copy (line,3,1)); amount := StrToFloat(copy(line,5,10)); VV read into two D array arrT[row,column] := amount; end; closeFile(TFile) ; Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 11 DBE/2012 SCE - Memorandum for i := 1 to 4 do tot[i] := 0; V Inisialise totals for column := 1 to 4 do for row := 1 to 3 do tot[column] := arrT[(row,column] + tot[column]; vv NV Determine totals for redOutput.Clear; redOutput.Lines.add('Summary of petrol used); redOutput.Lines.add(''); redOutput.Lines.add(#9+'Unleaded 93'+#9+'Unleaded 95'+#9+ 'LRP'+#9 +'Diesel'); redOutput.Lines.add(''); V heading line := 'Petrol used:'; for i 1 to 4 do line := line + #9+floatToStrf(tot[i],fffixed,10,2)+ 'L'; redOutput.Lines.add(line) ; V Write totals redOutput.Lines.add(''); Wine = Petrol Lent = 1; for i := 1 to 4 do begin if (40000-tot[i]) <= 5000 VV if/calculating petrol then begin redOutput.SelAttributes.Color := clred; line := line +#9+ 'INSUFFISIENT'; | end else | begin redOutput.SelAttributes.Color := clblack; line := line + #9 +'SUFFICIENT'; V colour and wording end; end; redOutput.lines.add(line); end; procedure TForml.FormActivate (Sender: TObject); begin redOutput.Paragraph.TabCount := 4; redOutput.Paragraph.Tab[0] := 100; redOutput.Paragraph.Tab[1] 200; redOutput.Paragraph.Tab[2] 300; redOutput.Paragraph.Tab[3] 450; end; end. Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 12 DBE/2012 SCE — Memorandum | QUESTION 3: TURBO PASCAL MARKS: 80 program Vr3_Qu3_p; | // exam number uses crt; type str20 = string[20]; V strl0 = string[10]; TWorker = record surname,sname : str20; VV dob : str10; category : integer; end; var y, dFile : file of TWorker; worker : TWorker; Vv TFile : text; tLine : string; v [opp rbbdtobioero’ Surname en Initial s 000 G GRIGG ik doe ioe} function surnameV1l (surname, sname:str20):str20; V var p : integer; vl : str20; begin VL := surnamet+', ' +sname[1]; Vv | Repeat v P := pos(' ', sname); Vv ifp <0 Vv then begin delete (sname,1,p); VL := VL + sname(1]; VV end; y . until p = 0; : surnameVL := vl; V i 8 end; DOCS IGE Show III IK a eae} procedure show; var error : integer; begin clrscr; {$i-} reset (dFile); error := IOResult; af error <> 0 Vv {Test existence of file} then writeln('File do not exist') V {Message} else begin writeln; writeln('Worker Info'); writeln('AmaGluGlu-station') ; V {Headings and subheadings} writeln; writeln('Record no:','Sname:':10,'Date of birth:':32,'Category:':15); writeln; Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 13 DBE/2012 SCE — Memorandum while not eof(dFile) do V {reset/close} begin V {while} read(dFile, worker); Vv {read} with worker do writeln(filepos(dFile):2V,' ':14,surInit(surname,sname) VV," ': 15 - length (surInit (surname, sname) ),dob:20,category:15V); end; end; VV (kolomme} close (dFile); {Sit} writeln; writeln('Press <enter> to continue.'); readin; end; [FFARR RRR EE Calculate hours WOrked ***EK ARERR RHR REE) function HoursWorked(nr:integer):integer; V var bTime,eTime,p, code, time, sessionTime: integer; begin assign(TFile,'p_times.txt'); VV {assign/reset/close/while} time := 0; sessionTime 0; reset (TFile) ; while not eof (TFile) do begin readln(TFile,tline) ; Vv {readln} val(copy(tline,1,pos(',',tline)-1),p,code); VV {get first number} if p = nrtl VN {test worker nr} then begin delete (tline,1,pos(',',tline)); val (copy(tline,1,pos(',',tline)-1),bTime, code) ; VV{determine bTime} delete (tline,1,pos(',',tline) ); val (tLine, eTime, code) ; VV {determine eTime} if bTime < eTime v {if} then sessionTime := eTime — bTime VV (then} else sessionTime := 24-bTime + eTime; VV {else} time := time + sessionTime; VV {initialise and add} end; end; close (TFile); HoursWorked := sessionTime; V {send back} end; Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 14 SCE - Memorandum DBE/2012 OOOO Calculate salary (OCCU OOOO OO ii ii } Procedure Salary(kat,hours:integer; var sal:real); var Month, code,r_hour begin case kat of 1: y_Hour := 2 : r_Hour 3: r_Hour end; if hours > 45 then Sal else Sal end; := hours * R_Hour * 1.12) WV := hours * R_Hour; integer; vv VV {Determine tarif} {Determine salary} (Oboooorombbbbrrt Print wages statement CC dine} procedure WageStatement; var BMonth, MonthNr, category, hours, code real; monthName, sTotal rSal,Total ans : char; integer; string; begin clrscr; Total := 0; Vv writeln('What is the month number ?'); readin (MonthNr) ; Vv case MonthNr of 1 : monthName ‘January'; 2 : monthName ‘February'; 3 >: monthName "March"; 4 monthName "April"; 5 monthName "May"; 6 : monthName ‘June 7 : monthName "July"; 8 : monthName "Augustus'; 9 : monthName := 'September'; 10 : monthName "October'; 11 : monthName ‘November '; 12 : monthName "December'; VY end; writeln; writeln('AmaGluGlu-station'); writeln('Wages statement for ',monthName) ; writeln; writeln('Surname', 'Sname':20, 'Category':30,'Wage':10); V{headings ana subheadings} writeln; Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 15 DBE/2012 SCE - Memorandum reset (dFile); while not eof(dFile) do VV (reset/close/while/read} begin read (dFile, worker) ; hours := Hoursworked(filepos(dFile)-1); VV {call hoursworked function} salary(worker.category,hours,rsal); VV {call salary procedure} Total := Total + rsal; V {increase total} val (copy (worker.dob,4,2),GebMonth,code); VV {determine dob month} with worker do begin if GebMonth = MonthNr VN {test for bonus} then begin rsal := rsal + 1000; VV {add R1000 to salary and total} Total := Total + 1000; writeln(Surname,' ':20-length(Surname),Sname,' ':22- length (sname),category:8,'R':8,rsal:10:2,'*':3); end else writeln(Surname,' ':20-length(Surname),Sname,' ':22- length(sname),category:8 ,'R':8,rsal:10:2); VV {output with * or not} end; end; close (dFile) ; writeln; Werceln (ioral + en Totals 10.2). Vv {show Total} writeln; writeln('Write data to file? J/N'); readin(ans) ; if upcase(ans) = 'J' Vv Vv (Question - upcase} then begin assign(TFile,'p_ payments.txt'); append (TFile) ; V{append/close} str (Total, sTotal); tLine := MonthName +',R'+sTotal; writeln(TFile,tLine); VV Vv {determine Line and write} close (TFile); writeln; writeln('Data written to file'); V{user-friendly sentence} end; readln; end; [XO GIGI I ISIS OD EZ OT SII ae} procedure menu; begin clrscr; writeln('MAIN MENU:'); writeln; writeln('l. Show Worker Info'); writeln('2. Wagestatement'); writeln(''); writeln('3. End'); writeln; writeln('Make a choice'); end; Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 16 SCE — Memorandum procedure choose; var k :char; begin repeat menu; repeat k := readkey; ae not(k in [lie i230) ) then begin writeln('Wrong choice. Try again'); delay(1000); clrscr; menu; writeln; writeln('Make a choice'); end; until k in ['1','2','3"']; case k of "1" 3 show; '2' ; Wagestatement; end; until k = '3'; end; {COB S SBS RoerObbb6Or Main program OOOO IOC i i ei} begin assign (dfile,'P_worker.dat'); choose; end. Copyright reserved DBE/2012 Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 17 DBE/2012 SCE — Memorandum | QUESTION 4: TURBO PASCAL MARKS: 20 program Vr4XXX_u; uses crt; var tFile : text; row,col,i,code : integer; Amount : real; ArrT : array[1..3,1..4] of real; Tot : array[1..4] of real; [I I I OCIS II ICICI II EI ICICI IOI II I EI I I I I I I I A eek begin clrscr; assign(tfile,'P_reading.txt'); Yassio reset (tfile); while not eof(tfile) do begin readln(tfile,line); Ywhile val (copy(line,1,1),row,code) ; ¥¥Vdere 1@ TOW, mt U val (copy (line, 3,1),col,code) ; val (copy (line, 5,10) ,amount, code) ; ¥YVread ir ray arrT[row,col] := amount; end; close (tfile); for i := 1 to 4 do cOcla)] 3 07 VYinitialise totals for col := 1 to 4 do for row 1 to 3 do Loe(col] s= arcl|cow,col) + totlcoll, or clrscr; writeln('Summary of petrol used); writeln; writeln('Unleaded 93 Unleaded 95 LRP Diesel': 75); writeln; write('Petrol used:':18); for i := 1 to 4 do write(tot[i]:12:2,'L"); writeln; YWrite and field wid writeln; write('Petrol used : ': 18); for i := 1 to 4 do begin if (40000-tot[i]) <= 5000 ¥VViE/petro then begin textcolor (red); write ('INSUFFICIENT':14); end else begin Copyright reserved Please turn over
Downloaded from hlayiso.com Computer Studies/HG/P1 18 DBE/2012 SCE — Memorandum textcolor (white) ; write ('SUFFICIENT':14); Ycolour and wer end; end; readln;end. TOTAL: 100 Copyright reserved

Study this subject

More from Grade 12 Information Technology

View all