INFORMATION TECHNOLOGY
PAPER 1
GRADE 12
NSC EXAMS
PAST PAPERS AND MEMOS NOVEMBER 2018
INSTRUCTIONS AND INFORMATION
NOTE: Candidates must use the file DataENGNov2018.exe.
Do the following:
Once extracted, the following list of files will be available in the folder DataENGNov2018:
SUPPLIED FILES:
Question1:
Question2:
Question3:
Question4:
SECTION A
QUESTION 1: GENERAL PROGRAMMING SKILLS
Do the following:
1.1 Tab sheet [Question 1.1]
Panel [1.1 – Display heading]
Write code to set the properties of panel pnlQ1_1 as follows:
Example of output:
(4)
1.2 Tab sheet [Question 1.2]
Button [1.2 – Volume]
A supplier of cooldrink cans must determine the volume of a can before it is filled with liquid.
All cans are filled with liquid, leaving a space of 1 cm from the top.
Write code to do the following:
Example of input and output if the height of the can is 5.4 cm and the radius is 1.2 cm:
(9)
1.3 Tab sheet [Question 1.3]
Button [1.3 – Display factors and check if it is a prime number]
Write code to do the following:
NOTE:
Example of output if the number generated is 6:
Example of output if the number generated is 13:
(13)
1.4 Tab sheet [Question 1.4]
Button [1.4 – Enter line of instructions and display commands]
A robot must receive a line of instructions to move out of a maze using no more than 10 steps forward in total. The robot reacts to the characters S, R and L, which represent the following commands:
S: One step forward
R: Turn right
L: Turn left
Example of a line of instructions: SSSRSLSLLSSR
Code is provided that does the following:
Write code to do the following:
NOTE: Your code must be able to decode any line of instructions and not only the line of instructions shown in the examples that follow.
Example of output if SSSRSLSLLSSR was entered as the line of instructions:
Example of output if SSSRSLSLLSSRSSSS was entered as the line of instructions:
(14)
|
TOTAL SECTION A: 40
SECTION B
QUESTION 2: DATABASE PROGRAMMING
The database PaymentsDB contains the information of the staff members of a restaurant. The database contains two tables, namely tblEmployees and tblPayments, with data specifically related to the year 2017. |
The data pages attached at the end of the question paper provide information on the design of the database and its contents.
Do the following:
NOTE:
Variable | Data type | Description |
tblEmployees | TADOTable | Refers to the table tblEmployees |
tblPayments | TADOTable | Refers to the table tblPayments |
2.1 Tab sheet [Question 2.1 – SQL]
In this section you may use ONLY SQL statements to answer QUESTION 2.1.1 to QUESTION 2.1.5.
Code to execute the SQL statements and display the results of the queries is provided. The SQL statements are incomplete.
The following user interface is displayed:
Do the following to complete the incomplete SQL statements assigned to the variables sSQL1, sSQL2, sSQL3, sSQL4 and sSQL5 per question respectively:
2.1.1 Button [2.1.1 – Alphabetical list]
Display ALL details of employees in the tblEmployees table, sorted alphabetically according to the surname field.
Example of output of the first four records:
(3)
2.1.2 Button [2.1.2 – Number of children of permanent employees]
Display the surname, first name and number of children of all the permanent employees with more than three children.
Example of output of the first four records:
(5)
2.1.3 Button [2.1.3 – Employees paid on selected date] (5)
Display the payment number and ID number of all the employees who were paid on 2017/01/17.
Example of output:
(6)
2.1.4 Button [2.1.4 – Delete payment]
Delete the record with the payment number 110 from the tblPayments table.
Code has been provided to display a message to indicate that the content of the database was changed. (3)
2.1.5 Button [2.1.5 – Total net salaries per month]
The net salary of an employee is calculated by subtracting the deductions from the gross salary.
Calculate and display the total amount that the restaurant has paid towards net salaries per month. Display the month using the field name MonthNum and display the calculated amount using the field name TotalAmountPaid. Format the amount as currency.
Example of output for the first three months if the original data was used:
(8)
2.2 Tab sheet [Question 2.2 – Delphi code]
In this section only Delphi programming code may be used to answer QUESTION 2.2.1 to QUESTION 2.2.3.
NO marks will be awarded for SQL statements in QUESTION 2.2.
The user interface for QUESTION 2.2 is shown below.
2.2.1 Button [2.2.1 – Temporary employees]
Write code to display the surname, first name and number of children of all temporary employees from the tblEmployees table in the rich edit component redQ2.
NOTE: Code for headings and columns are provided.
Example of output for first four records:
(6)
2.2.2 Button [2.2.2 – Add an employee]
Write code to add a record to the tblEmployees table. The data of the employee to be added is provided below.
Surname: Zwelini
First name: Lungile
ID number: 7601050179081
Permanent: Yes
Children: 3
Example of the last few records in the tblEmployees table after adding the record for Lungile:
(5)
2.2.3 Button [2.2.3 – Update deductions]
The deductions amount for a specific payment was captured incorrectly. The user must select a record from the DBGrid dbgPayments.
Write code to update the deductions field of the record that has been selected by increasing the deductions amount by 1% of the gross salary.
Example of content of record if payment number 112 was selected:
Example of updated content of record with payment number 112:
(4)
TOTAL SECTION B: 40
SECTION C
QUESTION 3: OBJECT-ORIENTATED PROGRAMMING
A new restaurant requires software to compile an identification code and to manage staff numbers. |
Do the following:
The following user interface is displayed:
3.1 The incomplete object class (TRestaurant) provided contains the following:
The attributes for the Restaurant object have been declared as follows:
Names of attributes | Description |
fName | Name of the restaurant |
fYearOpened | Year the restaurant opened in the format YYYY |
fNumEmployees | The number of employees at the restaurant |
3.1.1 Write code for a constructor method that will receive the name of the restaurant, the year the restaurant opened and the number of employees as parameter values. Assign these values to the respective attributes. (5)
3.1.2 Write code for a method called getNumEmployees that will return the number of employees. (2)
3.1.3 Write code for a method called increaseNumEmployees to receive an integer value as a parameter. The number of employees must be increased by the value received as a parameter. (3)
3.1.4 Write code for a method called compileCode that receives the full name of the owner as a parameter and compiles and returns an identification code in the following format:
where:
Example of an identification code for the following input values:
Restaurant name: Simply Fabulous Food
Year opened: 2018
Owner's full name: Pieter van Wyk
Identification code: Syk2018 (7)
3.2 The incomplete unit Question3_U provided contains code for the object class to be accessible and an object variable objRestaurant.
Follow the instructions below to code the solution.
3.2.1 Button [3.2.1 – Instantiate and display object]
The user must enter the name of the restaurant, the year the restaurant opened and the number of employees using the components provided.
The following input data has been provided to test the program:
Restaurant name: Simply Fabulous Food
Year opened: 2018
Number of employees: 25
Write code to do the following:
3.2.2 Button [3.2.2 – Identification code]
The user must enter the full name of the owner in the edit box provided for input.
Write code to do the following:
Example of output if the test data, provided as input values in QUESTION 3.2.1, was used and Pieter van Wyk was used as the full name of the owner:
(3)
3.2.3 Button [3.2.3 – Add employees]
The user must enter the number of employees to be added to the edit box edtAdd.
Code has been provided to declare a constant variable called iMaxEmployees that represents the maximum number of employees at the restaurant and set its value to 40.
Write code to do the following:
Example of output for the test data used in QUESTION 3.2.1 and the value 4 is now entered for the employees to be added:
Example of output for the test data used in QUESTION 3.2.1 and the value 20 is now entered for the employees to be added:
(10)
|
TOTAL SECTION C: 38
SECTION D
QUESTION 4: PROBLEM-SOLVING PROGRAMMING
SCENARIO
|
Do the following:
The following user interface is displayed:
The program contains the code shown below for the declaration of three arrays called arrDays, arrTempCustomers and arrCustomers.
A text file called Visitors.txt is provided and contains 365 lines of data representing the number of customers who visited the restaurant from 1 January 2017 to 31 December 2017. Each line of data contains a date (day-month), a hash character (#) and a number indicating the number of customers who visited the restaurant on that date. The data is saved in the following format:
Example of lines of data in the text file:
Explanation of the first two lines of data in the Visitors.txt text file:
On 1 January 177 customers visited the restaurant.
On 2 January 96 customers visited the restaurant.
NOTE:
Complete the code as described in QUESTION 4.1 and QUESTION 4.2 below.
4.1 Button [4.1 – Populate customer array]
The user must select a month from the cmbMonths combo box.
Use the text file Visitors.txt to populate the arrCustomers array with the data of the selected month.
Example of the content in the array if May was selected:
A message must be displayed to indicate that the array has been populated successfully. (14)
4.2 Button [4.2 – Display]
Use the cmbDays combo box to select a day of the week as the first day of the month.
Use the selected day and the populated array from QUESTION 4.1 and write code to display a calendar, as shown below.
The number of customers who visited the restaurant each day must be displayed in brackets.
Example of output if Friday has been selected as the first day of May:
NOTE: Code to display the heading and subheadings has been provided.
Example of output if Wednesday has been selected as the first day of February:
(18)
|
TOTAL SECTION D: 32
GRAND TOTAL: 150
INFORMATION TECHNOLOGY P1
QUESTION 2: DATABASE INFORMATION
DESIGN OF DATABASE TABLES:
Table: tblEmployees
This table contains the personal information of the employees working at the restaurant.
Field name | Data type | Description |
EmployeeNumber | AutoNumber | A unique number assigned to each employee |
Surname | Text (20) | The surname of the employee |
FirstName | Text (20) | The first name of the employee |
IDNumber | Text (15) | The South African ID number of the employee |
Permanent | Boolean | Boolean field indicating whether the employee is part of the permanent staff or not |
Children | Number | Number of child dependants of the employee |
Example of data of the first ten records:
Table: tblPayments
This table contains the records of all the payments made to employees during the past year (2017).
Field name | Data type | Description |
PaymentNumber | AutoNumber | A unique number assigned to a payment made to an employee |
EmployeeNumber | Number | A number that identifies the employee who received the payment |
PaymentDate | Date/Time | The date on which the payment was made |
GrossSalary | Currency | The salary before deductions |
Deductions | Currency | The total amount that will be subtracted from the gross salary |
Example of data of the first ten records:
The following one-to-many relationship with referential integrity exists between the two tables in the database: