0% found this document useful (0 votes)
9 views25 pages

IT P1 GR12 QP SEPT 2024 - English - Watermark

Uploaded by

jacodeyseljr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views25 pages

IT P1 GR12 QP SEPT 2024 - English - Watermark

Uploaded by

jacodeyseljr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

NATIONAL

SENIOR CERTIFICATE

GRADE 12

SEPTEMBER 2024

INFORMATION TECHNOLOGY P1

MARKS: 150

TIME: 3 hours

This question paper consists of 25 pages.

Hosted by www.ecexams.co.za.
2 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

INSTRUCTIONS AND INFORMATION

1. This question paper is divided into FOUR questions. Candidates must answer
ALL the questions.

2. 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.

3. This question paper is set with programming terms that are specific to Delphi
programming language.

4. 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.

5. 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.

6. 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.

7. 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.

8. All data structures must be defined by you, the programmer, unless the data
structures are supplied.

9. 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.

10. Make sure that your name appears as a comment in every program that you
code, as well as on every event indicated.

11. If required, print the programming code of all the programs/classes that you
completed. You will be given half an hour printing time after the examination
session.

12. 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.
Make sure that all files can be read.

13. Save your work regularly.

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 3

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 password-protected executable file:


• DataENGAug2024.exe
• Click on the ‘Extract’ button.
• Enter the following password: #Crypto@Aug2024

Once extracted, the following list of files will be available in the folder
DataENGAug2024:

Question 1: Question 3:
Question1_P.dpr Crypto_U.pas
Question1_P.dproj Question3_P.dpr
Question1_P_Icon.ico Question3_P.dproj
Question1_U.dfm Question3_P_Icon.ico
Question1_U.pas Question3_U.dfm
Question3_U.pas

Question 2: Question 4:

CryptoExchange.mdb Crypto.txt
CryptoExchangeBackUp.mdb Question4_P.dpr
dbConnection_u.pas Question4_P.dproj
Question2_P.dpr Question4_P_Icon.ico
Question2_P.dproj Question4_U.dfm
Question2_P_Icon.ico Question4_U.pas
Question2_U.dfm
Question2_U.pas

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
4 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

QUESTION 1: GENERAL PROGRAMMING SKILLS

SCENARIO

Cryptocurrencies have once again surged in popularity. Given the rapid advancement in
existing and emerging cryptocurrency technologies, grasping the fundamentals, security
protocols, and practical applications is imperative. Your task is to devise programming
solutions for the following questions pertaining to cryptocurrencies.

Do the following:
• Open the incomplete program in the Question 1 folder.
• Enter your full name as a comment in the first line of the Question1_U.pas file.
• Compile and execute the program. Currently the program has no functionality.

Example of the graphical user interface (GUI):

Complete the code for each section of QUESTION 1, as described in QUESTION 1.1
to QUESTION 1.4 that follow.

1.1 Button [1.1 – Panel Properties]

Code the button btn1_1 to change the properties of panel pnlOutput as


follows:

1. Set the font type to Arial.


2. Set the font size to 16.
3. Set the font to Bold and Italic.
4. Set the text to display on the right hand side of the panel.
5. Change the caption to ‘Crypto Exchange’.

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 5

Example of output:

(6)

1.2 Button [1.2 – Share Coins]


Three friends Tom, Jerry, and Andile, purchased Ethereum coins when the price
was still low. They decide to ‘cash out’ now. You need to share the coins in the
ratio 3 : 4 : 5 respectively. The number of coins bought is provided by the user
in the edit box edtInput. If there are remaining coins, they will not be shared
amongst the friends but rather left in the exchange for growth.
*****Note that each coin will be treated as a full coin and no decimal values
should be produced or displayed.*****

Code the button btn1_2 to calculate how many coins each friend will receive,
and how many coins will remain after sharing takes place. Output in the label
lbl1_2 as per example screenshots. Ensure the correct use of apostrophes and
enter spaces.
Output if 56 coins were purchased. Output if 12 coins were purchased.

(10)

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
6 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

1.3 Button [Q1.3 – Password]

Crypto accounts require strong passwords. You are thus required to write an
algorithm that will generate a strong password.

Code the button btn1_3 to generate a password based on the following rules.

The password must contain the letters “CRYPTO”.

1. Loop through each letter of the word “CRYPTO”.


2. For each letter, randomly generate characters from ‘A’ to ‘Z’ until you find a
character that matches the corresponding letter in “CRYPTO”.
3. Count the number of randomisations required to find the matching
character.
4. Append the count of randomisations followed by the matched character
(must be lowercase) to the password.
5. Repeat steps 2–4 for each letter in “CRYPTO”.
6. Display the generated password in the label lbl1_3. (12)

Example of output (NOTE: each output will differ due to the random counts of
each character).

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 7

1.4 Button [Q1.4 – ASCII Art]

Some of the MEME coins would like their branding to involve ASCII Art (art made
from characters).

Code the button btn1_4 to generate a pattern based on the following rules:
1. Prompt the user to input the length of the longest line for the pattern.
2. Construct the pattern using the character ‘&’.
3. Begin with a single ‘&’ character on the first line.
4. For each subsequent line, add one ‘&’ character to the end of the previous
line.
5. After reaching the maximum number of characters, begin removing ‘&’
characters from the beginning of each line until only one ‘&’ character remains
on the last line.
6. Display the generated pattern in the rich edit redOutput.
Example output:

Output for maximum length of 5. Output for maximum length of 10.

(7)

• Enter your name and surname as a comment in the first line of the program
file.
• Save your program.
• A printout of the code may be required.

[35]

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
8 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

QUESTION 2: SQL AND DATABASE PROGRAMMING

An application is required that will use the CryptoExchange.mdb database to manage the
data and queries of cryptocurrency traders.

The database contains two tables called tblMembers and tblCrypto.

The data pages attached at the end of the question paper provide information on the design
of the CryptoExchange.mdb database and its contents.

Do the following:

• Open the incomplete program in the Question 2 folder.


• Enter your full name as a comment in the first line of the Question2_U.pas unit file.
• Compile and execute the program. The program has limited functionality.
• The contents of the tables are displayed as shown below on the selection of tab sheet
Question 2.2

• 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.

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 9

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
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.
• THREE variables are declared as public variables, as described in the table below:

Variable Data type Description


tblCrypto TADOTable Refers to the data stored in the table tblCrypto
tblMembers TADOTable Refers to the data stored in the table
tblMembers
qryInfo TADOQuery Query component that will query the two tables
tblCrypto and tblMembers
2.1 Tab Sheet [Question 2.1]

Example of the graphical user interface (GUI) for QUESTION 2.1.

NOTE:
• Use ONLY SQL code to answer QUESTION 2.1.1 to QUESTION 2.1.6.
• Code to execute the SQL statements and display the results of the queries is
provided. The SQL statements that will be assigned to the variables sSQL1,
sSQL2, sSQL3, sSQL4, sSQL5, and sSQL6 are incomplete.
Complete the SQL statements to perform the tasks described in QUESTION 2.1.1 to
QUESTION 2.1.6 below.

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
10 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

2.1.1 Button [Q2.1.1]

Write SQL code to display all the fields of all the members, sorted by the
age of the member from youngest to oldest.

Example of output (first 15 records):

(3)

2.1.2 Button [Q2.1.2]

Write SQL code to display the various types of Crypto available as well as
the total amount of Crypto in each type.

Example of output:

(4)

2.1.3 Button [Q2.1.3]

The user would like to know how many members celebrate their birthday in
a certain month. Code has been provided to allow the user to fill in the
month using an input box.

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 11

Write SQL code to display the number of birthdays that will be celebrated in
the month chosen in the input box. Name the calculated field “Birthdays in
[the correct month]”. You may make use of the provided constant array:
ARRMONTHS.

Example of output:

Input = 1 Input = 6

Input = 10
(6)

2.1.4 Button [Q2.1.4]

You would like to see all the members who have Litecoin with the value of
over R5 500. A variable with Litecoin’s exchange value has been declared
and assigned for you.

Write a SQL statement to display the Surname, Firstname, CryptoType,


Amount, and the value of the Litecoin for that person. Name the calculated
field “Value” and it must be displayed in Rands.

Example of output:

(9)

2.1.5 Button [Q2.1.5]


All investors have decided to burn their Ripple wallets.
Write a SQL statement to delete all Ripple entries.
NOTE: Since all Ripple is now removed, if you click on btn2.1.2, the following
will output.

(3)

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
12 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

2.1.6 Button [Q2.1.6]


Bitcoin has started with its Bitcoin halving process.
Write a SQL statement to change all of the Bitcoin amounts to half of their
current amount.
NOTE: Since Bitcoin has halved in amount, you can check your output
using btn2.1.2, the following will output.

(3)

2.2 Tab Sheet [Question 2.2]


Example of the graphical user interface (GUI) for QUESTION 2.2.

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.
• Use the global variables, tblMembers and tblCrypto, provided.

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 13

2.2.1 Button [Q2.2.1]

Member details need to be displayed when a user searches for a member.


Code has been provided to you to extract the surname from the edit box as well
as loop through the Members table.

Write code to search in the loop if a member exists. If they exist, output to the
rich edit redOutput as per example screenshot (Name, Surname, E-Mail,
Gender).

Example of output:

If “Lightwood” was entered in the search. If “Soap” was entered in the search.

(5)

2.2.2 Button [Q2.2.1]

Currently 50 members are registered in the Members table. A request was


made to display the various genders and how many of each gender owned
some form of Cryptocurrency. NOTE: There are only FOUR gender types
registered.

Code has been provided to you to display the heading Total Members = 50.
Write code to loop through the Members table and tally the various genders.
Output to the rich edit redOutput as per example screenshots. Add a test to
determine if your total gender count is the same or different to the original.

You may make use of standard variables or arrays to solve this question.

Example of output:

If all data is correct. If data is incorrect. In this case faulty


spelling: Females instead of Female

(12)

• Enter your name and surname as a comment in the first line of the program file.
• Save your program.
• A printout of the code may be required.

[45]

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
14 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

QUESTION 3: OBJECT-ORIENTED PROGRAMMING

Traders can create a Crypto account and select one of three different
Cryptocurrencies: Bitcoin, Ethereum or Litecoin. Once they have created their
account, they can purchase their chosen crypto asset by entering a Rand value they
are willing to spend. The program will determine the correct amount of the crypto asset
based on the exchange rate of the cryptocurrency. Since Cryptocurrencies fluctuate
so much, traders can view the current value of their crypto asset in the “Live” viewer.
The program updates every second and will display whether the trader has made a
Profit or a Loss based on their original purchase value.

Do the following:

• Open the incomplete program in the Question 3 folder.


• Open the incomplete object class Crypto_U.pas.
• Enter your full name as a comment in in the first line of both the Crypto_U.pas file
and the Question3_u.pas file.
• Compile and execute the program. The program has limited functionality currently.
• Do NOT remove or change any provided code.

Example of the graphical user interface (GUI):

Complete the code as specified in QUESTION 3.1 and QUESTION 3.2 that follow.

*****NOTE: You are NOT allowed to add any additional attributes or user-defined
methods, unless explicitly stated in the question.*****

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 15

Open the incomplete object class Crypto_U.pas.

3.1 The provided incomplete class (TCrypto) contains the declaration of six attributes that
describe the objCrypto object.

Name of
Description
attributes
fFirstName String value containing trader’s first name
fSurname String value containing trader’s surname
fCrypto Integer value containing which Cryptocurrency the trader selected
fAmount Real value containing the Cryptocurrency amount
fOriginalValue Real value containing the money originally spent by the trader
fCurrentValue Real value containing the current value in Rands of the trader’s
Cryptocurrency

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 named Create that will receive the
following parameters:
• First name
• Surname
• Cryptocurrency (value ranging between 0 and 2)
Assign these parameter values to the correct attributes and set the remaining
attributes to a default value of 0. (5)

3.1.2 Write an accessor method called getCryptoName that returns the full name
of the cryptocurrency based on the fCrypto field attribute. The mapping is as
follows:
• 0 = Bitcoin
• 1 = Ethereum
• 2 = Litecoin
Uncomment the code in the toString method. (4)

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
16 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

3.1.3 Write code for a mutator method called setAmount that receives a value
(purchase value of cryptocurrency) as a parameter.
Set the fAmount attribute based on the following rules by multiplying the
purchase value (received by the main unit) with the exchange rate:

fCrypto Conversion rate


0 1 : 1 000 000
1 1 : 50 000
2 1 : 2 500

Exchange Rate Calculation: 1 ÷ 1000000 = 0.000001

Set the fOriginalValue attribute to the purchase value received from the
main unit. This value must be able to update as more cryptocurrency of the
same type is purchased. (7)

3.1.4 Write code for a mutator method called setValue. This method will set the
fCurrentValue parameter to the current exchange of the cryptocurrency
(fAmount * exchange rate). Since cryptocurrencies are so volatile and
constantly fluctuate, the conversion rates will be based on random values
between certain ranges.

Set the fCurrentValue attribute based on the following rules:

fCrypto Currency rate is a random value (both


values inclusive)
0 400 000 – 1 600 000
1 25 000 – 75 000
2 500 – 3000 (5)

3.1.5 Write a method called calcProfitLoss that will return a string value of a
‘Profit’, ‘Loss’ or ‘Even’.

The method will make use of the object’s attributes to determine the output.
• If the current value is greater than the original price, then it is a profit.
• If the current value is less than the original price, then it is a loss.
• If the current value is equal to the original price, then it is even. (6)

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 17

3.2 An incomplete program 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 objCrypto.
Write code to perform the tasks described in QUESTION 3.2.1 to QUESTION 3.2.3
below.

3.2.1 Button [3.2.1 – Instantiate Crypto Object]

Write code to do the following:


• Extract the name from the edit box edtName, the surname from the edit
box edtSurname and the number from the radio group rgpCrypto.
• Use the information to instantiate the new Crypto object.
• Display a message to the user that the Crypto Account has been created. (6)

3.2.2 Button [3.2.2 - Purchase Crypto]

The crypto trader will enter their desired purchase price into the edit box.

Write code to do the following:


• Extract the price from the edit box edtMoney.
• Call the setAmount method using the value from the edit box. (2)

3.2.3 Timer [tmrLive]

When the Live button is pressed, the program will update every second and
display the current value of the cryptocurrency along with whether the trader
has made a profit or a loss compared to their original purchase value.

Write code on the timer tmrLive to do the following:


• Call the setValue method.
• Use the toString method to display the information of the updated
Crypto object in the rich edit redOutput.
• Use the calcProfitLoss method to display the updated Crypto object
in the panel pnlOutput.

Example of output if Joe Soap bought R50 000 of Ethereum: Rand values
will be random.

Profit Loss

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
18 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

Example of output if Lutho Mzi bought R10 000 of Bitcoin:

Profit Loss

(5)

• Enter your name and surname as a comment in the first line of the program
file.
• Save your program.
• A printout of the code may be required.

[40]

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 19

QUESTION 4: PROBLEM-SOLVING PROGRAMMING

The cryptocurrency market consists of trillions of rands worth of money. This application
has been created to view 20 popular cryptocurrencies, along with their market capitalisation
in USD and currency value in ZAR (South African Rand).

Do the following:

• Open the incomplete program in the Question 4 folder.


• Enter your full name as a comment in in the first line of the Question4_u.pas file.
• Compile and execute the program. The program has limited functionality currently.
• Do NOT remove or change any provided code.

Example of the graphical user interface (GUI):

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
20 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

The following have been provided in the program:

• A text file called Crypto.txt holds data about 20 different cryptocurrencies


in the following format:
Cryptocurrency Name, Symbol, Current Price in Rand (ZAR) Market Capitalisation in Dollars (USD).

• A counter variable has been instantiated to store the number of


cryptocurrencies from the text file.

• A two-dimensional array called ar2Crypto has been instantiated for you.

• This array will be used to store the data from the text file about the 20 different
cryptocurrencies.

Complete the code for each section of QUESTION 4, as described in QUESTION 4.1
to QUESTION 4.4 below.

4.1 Button [4.1 – Read contents]

The data from the text file Crypto.txt needs to be read into the two-dimensional
array ar2Crypto. Each row of the array should represent a cryptocurrency and
each column should hold the respective data field (Name, Symbol,
CurrentPriceInZAR, MarketCapInUSD).

Write code to do the following:


• Read the data from the text file Crypto.txt and populate the two-
dimensional array ar2Crypto.
• Include any necessary error handling for opening the text file. (12)

4.2 Button [4.2 – Display]

The contents of the two-dimensional ar2Crypto must be displayed neatly in a


tabular format.

Write code to do the following:


• Display the contents of the two-dimensional array in the rich edit
redOutput.
• Ensure that the output is well-aligned.

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 21

Example of output:

(5)

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
22 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

4.3 Button [4.3 – Sort]


Cryptocurrencies are ranked according to their market capitalisation.
Write code to do the following:
• Sort the two-dimensional array based on the current market capitalisation in
descending order.
• Display the contents of the sorted two-dimensional array in the rich edit
redOutput.
Example of output:

(10)

4.4 Button [4.3 – Total market cap]


The total market capitalisation is the sum of the MarketCapInUSD values for all
cryptocurrencies stored in the two-dimensional array.
Write code to do the following:
• Calculate the total market capitalisation and convert it to a rand (ZAR)
value. The current exchange rate is:
1 USD = 18 ZAR
• Display the total market capitalisation in the rich edit redOutput.
Example of output:

(3)

• Enter your name and surname as a comment in the first line of the program
file.
• Save your program.
• A printout of the code may be required.

[30]

TOTAL: 150
Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 23

INFORMATION TECHNOLOGY P1

DATABASE INFORMATION QUESTION 2:

The database CryptoExchange consists of tables tblMembers and tblCrypto.

The following one-to-many relationship with referential integrity exists between the two
tables in the database:

The design of the database tables is as follows:

Table: tblMembers – This table contains details of the crypto trader members.

Field Name Data Type Description


MemID Number Unique ID for the crypto trader
Surname Text (30) The surname of the crypto trader
FirstName Text (20) The name of the crypto trader
DateOfBirth Date/Time The date of birth of the crypto trader
E-Mail Text (255) The email address of the crypto trader
Gender Text (20) The gender of the crypto trader

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
24 INFORMATION TECHNOLOGY P1 (EC/SEPTEMBER 2024)

Example of the first few records in the tblMembers table:

Table: tblCrypto – This table contains details of the crypto transactions.

Field Name Data Type Description


ExchangeID Number Unique ID for the crypto trader
MemID Number The ID for the crypto trader who made crypto
transaction
ExchangeName Text (20) The crypto exchange name
CryptoType Text (30) The crypto type
Amount Number The amount of crypto purchased in the
transaction
DatePurchased Date/Time Date the purchase transaction was made

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.
(EC/SEPTEMBER 2024) INFORMATION TECHNOLOGY P1 25

Example of the first few records in the tblCrypto table:

Copyright reserved Please turn over

Hosted by www.ecexams.co.za.

You might also like