Gr10 Nov 2022 Itp1
Gr10 Nov 2022 Itp1
INSTRUCTIONS
1. This question paper is set with programming terms that is specific to the Delphi
programming language
2. 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.
3. Answer only what is asked in each question. For example, if the question does not ask for
data validation, then no marks will be awarded for data validation.
4. 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.
5. Routines, such as search, sort and selection, must be developed from first principles. You
may NOT use the built-in features of a programming language for any of these routines.
6. All data structures must be defined by you, the programmer, unless the data structures are
supplied.
7. 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.
1|Page
Code the following :
1.1 On Activate
Read the time given in minutes from the edit edtTime. Convert the time to hours and
minutes. Display the time in hours and minutes in the memo memQ1_2. (6)
SAMPLE OUTPUT
1.4 A Body Mass Index (BMI) is a calculated value based on a person’s mass (kg) and height
(in m).The BMI can be used to indicate if the person is Overweight
2|Page
1.4.1 Button BMI
Calculate the BMI of the person by reading in the mass from the spin-edit sedMass
and the height from edit edtHeight. Calculate the BMI using the formula :
𝑚𝑎𝑠𝑠
BMI =
ℎ𝑒𝑖𝑔ℎ𝑡 2
Display the BMI value in the edit edtBMI, correct to ONE decimal place (6)
SAMPLE OUTPUT
Read the BMI value from the edit edtBMI and determine the status of the person.
Display the appropriate message in the label lblQ1_4 (8)
SAMPLE OUTPUT
[30]
3|Page
QUESTION 2 – Strings
A Computer Club wishes to develop an application that would enable users to register. The
following incomplete application has been developed.
Open Quest2_u and complete the event handlers as directed by each question below :
A valid South African ID Number contains 13 digits, where the first 6 digits representing the
date of birth in the format YYMMDD
Do the following :
• Read in the ID number of the user from the edit edtID and store in a string variable.
• Determine if the ID number is a valid ID number or not. Display a message in a
dialog box, indicating if the ID number is Valid or Not.
• If it is not valid, clear the edit. (5)
SAMPLE OUTPUT
4|Page
2.2 Button Details
Read the details from the edits and display in the rich-edit redQ2, in the following
format :
• Display the Full Name of the user, in uppercase
• Display the Date of Birth of the user in the format DD-MM-YY (6)
SAMPLE OUTPUT
The seventh digit of the ID number indicates the gender of a person. Study the table
below :
Seventh Digit value between Gender
0-4 Female
5-9 Male
Determine the gender of the user, from the ID number. Display a suitable message in the
rich-edit redQ2, indicating the gender of the user (6)
SAMPLE OUTPUT
SAMPLE OUTPUT
5|Page
(8)
[25]
QUESTION 3 – Loops
Read the word from the edit edtWord and store in a variable. Using a looping structure,
SAMPLE OUTPUT
6|Page
3.2 Button Odd Numbers
Do the following :
• Read the starting value of the loop from the spin-edit sedStart
• Read the end value of the loop from the spin-edit sedStop
• Run a loop based on this starting value and ending value
• Determine and display all the ODD numbers in this interval in the rich-edit
redQ3 (8)
SAMPLE OUTPUT
[25]
GRAND TOTAL = 80
7|Page