You're offline
Skip to content
Question paper

Information Technology P1 May-June 2023 Eng_hlayiso.com_.pdf

Subject: Information TechnologyGrade 12202328 pages
Download

Loading document…

Loading document…

Document textSearch extracted text and jump to a page.
Downloaded from hlayiso.com SENIOR CERTIFICATE EXAMINATIONS/ NATIONAL SENIOR CERTIFICATE EXAMINATIONS INFORMATION TECHNOLOGY P1 2023 MARKS: 150 TIME: 3 hours This question paper consists of 24 pages, 2 data pages and 2 blank pages for planning. Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 2 DBE/2023 SC/NSC INSTRUCTIONS AND INFORMATION 1. This question paper is divided into FOUR sections. Candidates must answer ALL the questions from all FOUR sections. 2. Two blank pages have been provided at the end of the question paper which may be used for planning purposes. 3. The duration of this examination is three hours. Because of the nature of this examination, it is important to note that you will not be permitted to leave the examination room before the end of the examination session. 4. This question paper is set with programming terms that are specific to Delphi programming language. The Delphi programming language must be used to answer the questions. 5. Make sure that you answer the questions according to the specifications that are given in each question. Marks will be awarded according to the set requirements. 6. Answer only what is asked in each question. For example, if the question does not ask for data validation, no marks will be awarded for data validation. 7. Your programs must be coded in such a way that they will work with any data and not just the sample data supplied or any data extracts that appear in the question paper. 8. Routines, such as search, sort and selection, must be developed from first principles. You may NOT use the built-in features of the Delphi programming language for any of these routines. 9. All data structures must be defined by you, the programmer, unless the data structures are supplied. 10. You must save your work regularly on the disk/CD/DVD/flash disk you have been given, or on the disk space allocated to you for this examination session. 11. Make sure that your examination number appears as a comment in every program that you code, as well as on every event indicated. 12. If required, print the programming code of all the programs/classes that you completed. Your examination number must appear on all the printouts. You will be given half an hour printing time after the examination session. 13. At the end of this examination session, you must hand in a disk/CD/DVD/ flash disk with all your work saved on it OR you must make sure that all your work has been saved on the disk space allocated to you for this examination session. Ensure that all files can be read. Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 3 DBE/2023 SC/NSC 14. The files that you need to complete this question paper have been provided to you on the disk/CD/DVD/flash disk or on the disk space allocated to you. The files are provided in the form of password-protected executable files. Do the following:  Double click on the following password-protected executable file: DataJun2023.exe.  Click on the 'Extract' button.  Enter the following password: E#Homes%2023 Once extracted, the following list of files will be available in the folder DataJun2023: Question1: Question3: Question1_P.dpr log.txt Question1_P.dproj Question3_P.dpr Question1_P.res Question3_P.dproj Question1_U.dfm Question3_P.res Question1_U.pas Question3_U.dfm Words.txt Question3_U.pas SmartSwitch_U.pas Question2: Question4: ConnectDB_U.pas Question4_P.dpr Question2_P.dpr Question4_P.dproj Question2_P.dproj Question4_P.res Question2_P.res Question4_U.dfm Question2_U.dfm Question4_U.pas Question2_U.pas SmartDevicesDB - Copy.mdb SmartDevicesDB.mdb Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 4 DBE/2023 SC/NSC SECTION A QUESTION 1: GENERAL PROGRAMMING SKILLS Do the following:  Open the incomplete program in the Question 1 folder.  Enter your examination number as a comment in the first line of the Question1_U.pas file.  Compile and execute the program. The program has no functionality currently. Example of graphical user interface (GUI):  Complete the code for each section of QUESTION 1, as described in QUESTION 1.1 to QUESTION 1.5 that follow. Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 5 DBE/2023 SC/NSC 1.1 Button [1.1 - Formatting] Write code to change the content and appearance of the edit box edtQ1_1 as follows when the btnQ1_1 button is clicked:  The font size of the text must be 14 pt.  The words 'Hello world' must appear as text in the edtQ1_1 edit box.  The text must be underlined.  The background colour of the edtQ1_1 component must be green. Example of output: (4) 1.2 Button [1.2 - Random number] Write code to do the following:  Generate a random integer between 1 and 99 (inclusive of these values).  Determine whether the number that has been generated is a single digit or a two-digit number.  Display the number and result in the panel pnlQ1_2 as shown in the examples below. Example of output if the number 4 was generated: Example of output if the number 46 was generated: (8) Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 6 DBE/2023 SC/NSC 1.3 Button [1.3 - Area] Shown below is a diagram of a nut, made up of a hexagon and a circle. The diameter (d) of the circle has the same length as the side of the hexagon. The shaded area in the diagram is calculated using the following formula: 3 √3 𝑑 2 Shaded area = ( 2 ) 𝑑2 − 𝜋 (2) where d is the length of one side of the hexagon and d is also the diameter of the circle. The user is required to enter the value of d in the edit box edtQ1_3. Write code to do the following:  Extract the value of d from the edit box edtQ1_3.  Use the given formula to calculate the area of the shaded part of the diagram provided above.  Display the area of the shaded part, rounded to ONE decimal place, on the panel pnlQ1_3. Example of input and output: (8) Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 7 DBE/2023 SC/NSC 1.4 Button [1.4 - Find] A text file Words.txt containing a list of words has been supplied. The program must count the number of times a word entered by the user occurs in the text file. Example of the first five lines of the text file Words.txt: accessory archive bandwidth capacity bus The user must enter the word to be counted in the edit box edtQ1_4. Code has been provided to open the text file Words.txt for reading. Write code to do the following:  Extract the word that was entered in the edit box edtQ1_4.  Count the number of times the word entered occurs in the file, regardless of whether the word was entered in small letters or capital letters.  If the word occurs in the text file, display the number of occurrences in the redQ1_4 rich edit component.  If the word does NOT occur in the text file, display the message 'Word not found' in the redQ1_4 rich edit component. Two examples of input and output: (11) 1.5 Button [1.5 - Booster rocket] A booster rocket uses 7,5% of its fuel per second from lift-off. The rocket shuts down when the fuel capacity is below 200 litres. Do the following: Convert the algorithm on the next page into programming code to calculate and display the seconds travelled, the fuel used and the fuel left per second until the rocket shuts down. Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 8 DBE/2023 SC/NSC Algorithm 1. Enter the total litres of fuel before lift-off (use an input box for input) 2. Assign the value of total litres of fuel to a variable for fuel left 3. Initialise a counter for number of seconds 4. While fuel left is more than or equal to 200 5. Increment counter by one 6. Calculate fuel used (7,5% of fuel left) 7. Subtract fuel used from fuel left 8. Display counter, fuel used and fuel left 9. End while loop NOTE:  Code is provided to display the headings in the rich edit redQ1_5.  The amount of fuel used per second and the amount of fuel left must be formatted to TWO decimal places, as shown in the example of output. Example of the input of 550 litres of fuel and the output: (9)  Enter your examination number as a comment in the first line of the program file.  Save your program.  Print the code if required. TOTAL SECTION A: 40 Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 9 DBE/2023 SC/NSC SECTION B QUESTION 2: DATABASE PROGRAMMING Smart home devices are becoming more popular among people that have access to fast reliable internet connections. A database called SmartDevicesDB.mdb has been developed and contains information about the different manufacturers of smart devices and the stock available of the different devices. The SmartDevicesDB.mdb database contains two tables called tblManufacturers and tblDevices. The data pages attached at the end of the question paper provide information on the design and contents of the database. Do the following:  Open the incomplete project file called Question2_P.dpr in the Question 2 folder.  Enter your examination number as a comment in the first line of the Question2_U.pas unit file.  Compile and execute the program. The program has no functionality currently. The contents of the tables are displayed as shown below on the selection of tab sheet 2.2 - Delphi code. Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 10 DBE/2023 SC/NSC  Follow the instructions below to complete the code for each section as described in QUESTION 2.1 and QUESTION 2.2.  Use SQL statements to answer QUESTION 2.1 and Delphi code to answer QUESTION 2.2. NOTE:  The 'Restore database' button is provided to restore the data contained in the database to the original content.  The content of the database is password-protected, i.e. you will NOT be able to gain direct access to the content of the database using Microsoft Access.  Code is provided to link the GUI components to the database. Do NOT change any of the code provided.  TWO variables are declared as public variables, as described in the table below: Variable Data type Description tblManufacturers TADOTable Refers to the table tblManufacturers tblDevices TADOTable Refers to the table tblDevices 2.1 Tab sheet [2.1 - SQL] Example of graphical user interface (GUI) for QUESTION 2.1: Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 11 DBE/2023 SC/NSC NOTE: Code to execute the SQL statements and display the results of the queries is provided. The SQL statements assigned to the variables sSQL1, sSQL2, sSQL3, sSQL4 and sSQL5 are incomplete. Complete the SQL statements to perform the tasks described in QUESTION 2.1.1 to QUESTION 2.1.5 below. 2.1.1 Button [2.1.1 - iOS devices] Display the DeviceID and DeviceName of all devices in the tblDevices table, that use the iOS operating system. Example of output of the first five records: (3) 2.1.2 Button [2.1.2 - Category selected] The user must select a device type from the combo box cmbQ2_1_2. Code has been provided to extract and store the device type selected in a variable sDeviceType. Display the DeviceName, Category and NumInStock of all devices where the Category field contains the device type selected from the combo box. Example of output if TV was selected as a device type: (3) 2.1.3 Button [2.1.3 - Online support] Display the DeviceName, Category and OperatingSystem of all devices that receive online support from the manufacturer. The results must be sorted in alphabetical order according to the DeviceName. See the next page. Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 12 DBE/2023 SC/NSC Example of output of the first five records: (6) 2.1.4 Button [2.1.4 - Profit per manufacturer] All the products in stock are available to be purchased at a clearance sale. The price shown in the tblDevices table refers to the selling price of the product. The profit after selling the stock is 60% of the selling price. The total profit made by each manufacturer must be calculated assuming that all products will be sold at the sale. Write code to display the ManufacturerID and the total profit in a new field called Profit, formatted to currency. Example of output: (6) 2.1.5 Button [2.1.5 - Remove devices] The entire range of smart speakers, manufactured by Mobile Comp with ManufacturerID M104, have been recalled due to a fault during the manufacturing process. Remove all records of smart speakers that were manufactured by ManufacturerID M104, from the tblDevices table. NOTE: Code has been provided to display a message to indicate the number of records that have been deleted. Example of output: (4) Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 13 DBE/2023 SC/NSC 2.2 Tab sheet [2.2 - Delphi code] NOTE:  Use ONLY Delphi programming code to answer QUESTION 2.2.1 and QUESTION 2.2.2.  NO marks will be awarded for SQL statements in QUESTION 2.2. Example of graphical user interface (GUI) for QUESTION 2.2: Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 14 DBE/2023 SC/NSC 2.2.1 Button [2.2.1 - Display products] Retailers want to see which products are made by each manufacturer. Code has been provided to clear the content in the redQ2_2_1 component. Write code to do the following:  Display the manufacturer name and contact number in the following format: <Manufacturer Name>: <Contact Number>  Display the following headings for each manufacturer: 'Device name' 'In stock' 'Price'  Display all the devices made by each manufacturer using the appropriate headings. Example of output for the first two manufacturers (Berry Tech and Gem Smart): (12) 2.2.2 Button [2.2.2 -Update stock] When devices are sold, the number in stock must be decreased in the table tblDevices. The user must select the record of the device to be sold from the tblDevices table in the DBGrid component dbgDevices. Write code to do the following:  Provide an input dialog box for the user to enter the number of devices to be sold for the record selected.  If stock is sufficient, decrease the number in stock for the selected item with the number that was entered. If stock is insufficient, display a suitable message. Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 15 DBE/2023 SC/NSC Example of output if the 'Bulb 6' item had been selected before any items were sold: Example of output if the value of 15 was entered and 15 units of the selected item were sold: Example of output if the 'Bulb 6' item had been selected before any items were sold: Example of output if the value of 101 was entered for units to be sold: (6)  Enter your examination number as a comment in the first line of the program file.  Save your program.  Print the code if required. TOTAL SECTION B: 40 Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 16 DBE/2023 SC/NSC SECTION C QUESTION 3: OBJECT-ORIENTATED PROGRAMMING Smart switches have been installed to monitor and automate home devices. The program to be developed will determine the device power usage of the switch and the user will have the option of switching the device ON or OFF. Do the following:  Open the incomplete program in the Question 3 folder.  Open the incomplete object class SmartSwitch_U.pas.  Enter your examination number as a comment in the first line of both the Question3_U.pas file and the SmartSwitch_U.pas file.  Compile and execute the program. The program has limited functionality currently. Example of graphical user interface (GUI):  Complete the code as specified in QUESTION 3.1 and QUESTION 3.2 below. 3.1 The given incomplete object class (TSmartSwitch) contains:  The declaration of four attributes which describe a SmartSwitch object  Code for a method called determineSwitchStatus Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 17 DBE/2023 SC/NSC The attributes for a SmartSwitch object have been declared as follows: Attribute Type Description fSwitchID String The identifying code of the switch, e.g. S01 fDevice String The name of the device that will be used on the switch fPowerUsage Integer The amount of energy/power in watts used by the device fSwitchStatus Boolean The current status of the switch, either True for ON or False for OFF NOTE: You are NOT allowed to add any additional attributes or user-defined methods, unless it is explicitly stated in the question. Complete the code in the object class as described in QUESTION 3.1.1 to QUESTION 3.1.5 below. 3.1.1 Write code for a constructor method that will receive the switch ID, the name of the device and the power usage of the switch as parameters. Assign the parameter values to the respective attributes. Allocate the value 'false' to the fSwitchStatus attribute. (5) 3.1.2 Write code for an accessor method called getSwitchID to return the fSwitchID attribute. (2) 3.1.3 Write code for a method called energyUsed to receive the number of hours (as an integer) that the device was switched on, as a parameter. Use the formula below to calculate and return the amount of energy (kilowatt-hour (kWh)) used by the device. Energy used = PowerUsage * Hours 1000 (4) 3.1.4 Write code for a mutator method called setSwitchStatus which can be used to switch the device ON or OFF. The method must receive a Boolean value as a parameter and set the fSwitchStatus attribute to the value received. (3) 3.1.5 Write code for a toString method to return a string with all the attributes of the object in the following format: Switch ID: <SwitchID> Device: <Device> Power usage: <PowerUsage> W Switch status: <ON> or <OFF> Call the provided method determineSwitchStatus to determine if the switch is ON or OFF. (4) Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 18 DBE/2023 SC/NSC 3.2 An incomplete program, Question3_P, has been supplied in the Question 3 folder. The program contains code for the object class to be accessible and declares an object variable called objSmartSwitch. Write code to perform the tasks described in QUESTION 3.2.1 to QUESTION 3.2.4 below. Code has been provided in each of the buttons to clear the redQ3 rich edit component. 3.2.1 Button [3.2.1 - Instantiate object] A list box lstQ3_2_1 contains devices and their power usage in the following format: <Device>#<Power usage in watts> The user needs to select a switch ID from the combo box cmbQ3_2_1 and any device from the list box lstQ3_2_1. Write code to do the following:  Extract the switch ID from the combo box cmbQ3_2_1.  Extract the name of the device and the power usage in watts from the list box lstQ3_2_1. Separate the device from the power usage.  Use the switch ID, name of the device and power usage to instantiate a new SmartSwitch object.  Call the toString method to display the information of the SmartSwitch object in the rich edit redQ3. Example of input: Example of output after instantiation of the object: (8) Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 19 DBE/2023 SC/NSC 3.2.2 Button [3.2.2 - Change switch status] Use the radio group rgpQ3_2_2 to select the switch to be ON or OFF. Write code to do the following:  Call the setSwitchStatus method using the value selected from the radio group as an argument. The value ON represents True and the value OFF represents False.  Display the ID and the status of the objSmartSwitch object in the rich edit redQ3. Example of input if the 'ON' option has been selected for the fan device: Example of output if the 'ON' option has been selected for the fan device: (5) 3.2.3 Button [3.2.3 - Write to file] A text file called log.txt keeps a record of the date, time, switch ID and the status of the switch. Code has been provided in the FormCreate event to show the current time in the lable lblTime. Write code to do the following:  Open the text file log.txt to add a line of text.  Add a line of text to the file which contains the current system date, current system time, the switch ID and the switch status in the following format: Current date,Current time,Switch ID#Switch status Example of output to the file if the current system date and time is 23 May 2023, 9:18:06 AM: 23/05/2023,9:18:06 AM,S03#ON Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 20 DBE/2023 SC/NSC NOTE: A date function must be used to extract the current system date. The format of the date and time are dependent on the regional settings of your computer, which may differ from the example output provided. (6) 3.2.4 Button [3.2.4 - Power usage] The switch will be left on for a specific number of hours. The user must enter the number of hours in the edit box edtQ3_2_4. Write code to do the following:  Obtain the number of hours that was entered from the edit box edtQ3_2_4.  Call the energyUsed method using the number of hours that was entered as an argument.  Display a suitable message in the rich edit redQ3 to indicate the amount of energy used in kWh. Example of input and output if the device selected is a fan 100 W and the number of hours is 4: Example of input and output if the device selected is a pool pump of 850 W and the number of hours is 6: (3)  Enter your examination number as a comment in the first line of the object class and the form class.  Save your program.  Print the code in the object class and the form class if required. TOTAL SECTION C: 40 Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 21 DBE/2023 SC/NSC SECTION D QUESTION 4: PROBLEM-SOLVING PROGRAMMING You are developing a program to test the wireless network for a college campus. The area of the campus has been broken up into a grid where access points can be added and Wi-Fi coverage will be determined. Do the following:  Open the incomplete program in the Question 4 folder.  Enter your examination number as a comment in the first line of the Question4_U.pas file.  Compile and execute the program. The program has no functionality currently. Example of graphical user interface (GUI): The following two-dimensional array arrNetwork has been provided. The array represents the wireless network of the college campus broken up into a grid with 5 rows and 6 columns. arrNetwork: array [1 .. 5, 1 .. 6] of char = (('_','A','_','_','_','_'), ('_','_','_','_','_','_'), ('_','_','_','_','A','_'), ('_','_','_','_','_','_'), ('_','A','_','_','_','_')); Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 22 DBE/2023 SC/NSC The following table contains the descriptions of the symbols used in the array: Symbol Description Letter ('A') Access point Underscore ('_') Empty space Complete the code for each section of QUESTION 4, as described in QUESTION 4.1 to QUESTION 4.3 below. 4.1 Button [4.1 - Display] Write code to display the provided array arrNetwork in the rich edit redQ4. The row and column headings representing the wireless network of the college campus must be displayed as shown in the example of output. Example of output: (7) 4.2 Button [4.2 - Add access point] The program must be able to capture the addition of an access point to the campus network at an available space in the grid. A maximum of three access points in a row is allowed. The user must select the row and column values from the spin edits sedQ4_2_Row and sedQ4_2_Col where the access point is to be added. Write code to do the following:  Extract the row and column values selected for the location of the access point.  Add an access point to the location in arrNetwork if there is no access point at that location and the total number of access points in that row does not exceed two. Display an appropriate message if: o There is already an access point at the specific location o The row already contains more than two access points Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 23 DBE/2023 SC/NSC Example of output if the selected row is 3 and the selected column is 1: Example of output if the selected row is 3 and the selected column is 5 and there is already an access point at this location: Example of output if the user attempts to add an access point in a row that already has 3 access points: (10) 4.3 Button [4.3 - Coverage ] A grid is used to determine the blocks/locations at the campus that will have coverage and those that will not have coverage. Each access point (A) has the capacity to provide a signal to all the blocks/locations around the access point. The blocks/locations covered per access point will be marked with the asterisk ('*') character. Example: Write code to do the following:  Add coverage symbols (*) around all the access points in the campus network saved in array arrNetwork.  Display array arrNetwork after the coverage symbols have been added. Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 24 DBE/2023 SC/NSC Example of output: (13)  Enter your examination number as a comment in the first line of the program file.  Save your program.  Print the code if required. TOTAL SECTION D: 30 GRAND TOTAL: 150 Copyright reserved
Downloaded from hlayiso.com Information Technology/P1 1 DBE/2023 SC/NSC INFORMATION TECHNOLOGY P1 DATABASE INFORMATION FOR QUESTION 2: The design of the database tables is as follows: Table: tblManufacturers This table contains the details of the manufacturers. Field name Data type Description ManufacturerID Text (5) Unique ID of each manufacturer ManufacturerName Text (25) Name of each manufacturer ContactNumber Text (10) The contact number of each manufacturer OnlineSupport Yes/No The value 'true' to indicate that online support will be provided; 'false' if not Example of the first seven records of the tblManufacturers table: Table: tblDevices This table contains information on the devices made by each manufacturer. Field name Data type Description DeviceID Text (10) Unique ID for each device DeviceName Text (20) Unique name for each device Category Text (20) Category of each device: smart watch, smart lighting, smart TV, smart speaker, smart refrigerator, smart door lock, smart heating OperatingSystem Text(15) The operating system used to run and connect the manufacturer devices Price Currency The selling price of each device NumInStock Number The amount of stock available for each device ManufacturerID Text (5) ID of the manufacturer of each device Copyright reserved Please turn over
Downloaded from hlayiso.com Information Technology/P1 2 DBE/2023 SC/NSC Example of the first ten records of the tblDevices table: NOTE:  Connection code has been provided.  The database is password-protected, therefore you will not be able to access the database directly. The following one-to-many relationship with referential integrity exists between the two tables in the database: Copyright reserved
Downloaded from hlayiso.com Information Technology/P1 DBE/2023 SC/NSC PLANNING PAGE 1 Copyright reserved
Downloaded from hlayiso.com Information Technology/P1 DBE/2023 SC/NSC PLANNING PAGE 2 Copyright reserved

Published documents with matching subject and grade metadata.

Matched using subject, grade, language, document type and exam metadata.

More from Grade 12 Information Technology

Explore more published documents in this catalogue.

View all