Skip to content

Information Technology Grade 11 P1 2026 QP (Eng)

Question paperInformation TechnologyGrade 11202626 pagesPublisher: Hlayiso

Grade 11 Information Technology Paper 1 question paper from the November Mock Exam 2 2026 (English), 26 pages. Read online or download the free PDF.

Free to read online, no sign-up needed

Loading document…

Loading document…

November Mock Exam 2 2026

Document textSearch extracted text and jump to a page.
Mock hlayiso mock exams Practice Series: Grade 11 Exam Preparation WWW.HLAYISO.COM NATIONAL SENIOR CERTIFICATE GRADE 11 INFORMATION TECHNOLOGY P1 NOVEMBER EXAMINATION 2026 (MOCK) MARKS: 150 TIME: 3 hours This question paper consists of 26 pages. Copyright reserved Please turn over
Information Technology/P1 2 Hlayiso/Mock 2026 NSC Mock INSTRUCTIONS AND INFORMATION 1. This question paper consists of 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 the Delphi programming language. The Delphi programming language must be used to answer the questions. 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 the Delphi programming language for any of these routines, for example Locate, Filter, Sort, RecordCount, CharInSet or any built-in number-base conversion function. 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 space allocated to you for this examination session. 10. Make sure that your examination number 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 that you completed. Your examination number must appear on all printouts. Copyright reserved Please turn over
Information Technology/P1 3 Hlayiso/Mock 2026 NSC Mock 12. The files that you need to complete this question paper have been provided to you on the disk space allocated to you, in a folder called DataNov2026. Once copied, the following list of files will be available in the folder DataNov2026: Question 1: Question 3: Question1_P.dpr dbConnection_U.pas Question1_P.dproj Question3_P.dpr Question1_U.dfm Question3_P.dproj Question1_U.pas Question3_U.dfm Question3_U.pas ShelterDB.mdb ShelterDB - Copy.mdb Question 2: Question 4: Question2_P.dpr Question4_P.dpr Question2_P.dproj Question4_P.dproj Question2_U.dfm Question4_U.dfm Question2_U.pas Question4_U.pas TuckShop.txt 13. Currency values and dates may be displayed slightly differently from the examples in this question paper, depending on the regional settings of the computer (for example R 156.00 or R156,00). This will not be penalised. Copyright reserved Please turn over
Information Technology/P1 4 Hlayiso/Mock 2026 NSC Mock QUESTION 1: GENERAL PROGRAMMING SKILLS The Grade 11 learners at Thuto High School are developing a learner portal that will help learners with everyday school tasks. 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 the graphical user interface (GUI): Question 1 - General programming skills – □ × 1.1 1.4 1.1 - Welcome Welcome Phrase: 1.4 - Hashtag 1.2 Data needed (MB): 1.2 - Data bundles 1.5 Target amount (R): 1.5 - Savings plan 1.3 Mark obtained: 0 1.3 - Achievement level Total mark: 0 • Complete the code for each section of QUESTION 1, as described in QUESTION 1.1 to QUESTION 1.5 below. Copyright reserved Please turn over
Information Technology/P1 5 Hlayiso/Mock 2026 NSC Mock 1.1 Button [1.1 - Welcome] Write code to do the following: • Change the caption of the label lblQ1_1 to ’Thuto Learner Portal’. • Change the font colour of the label lblQ1_1 to blue (clBlue). • Change the font style of the label lblQ1_1 to bold AND italic. • Move the cursor (focus) to the edit box edtQ1_2 so that the user can start typing in it. Example of output: 1.1 - Welcome Thuto Learner Portal (4) 1.2 Button [1.2 - Data bundles] Learners buy mobile data bundles to attend online extra classes. A bundle consists of 500 MB of data and costs R39.00. The constants BUNDLE_MB = 500 and BUNDLE_PRICE = 39.00 have been provided. The user enters the amount of data that a learner needs, in MB, as a whole number in the edit box edtQ1_2. Write code to do the following: • Extract the amount of data needed from the edit box. • Calculate the number of bundles that the learner must buy. A learner can only buy complete bundles, so if the data needed is not an exact multiple of 500 MB, one extra bundle must be bought. • Calculate the cost of the bundles and the amount of unused data (in MB) that will be left over. • Display the number of bundles, the cost in currency format and the unused data in the labels lblQ1_2_Bundles, lblQ1_2_Cost and lblQ1_2_Unused, as shown in the examples below. Copyright reserved Please turn over
Information Technology/P1 6 Hlayiso/Mock 2026 NSC Mock Example of input and output if 1820 MB is needed: 1.2 Data needed (MB): 1820 1.2 - Data bundles Bundles needed: 4 Cost: R 156.00 Unused data: 180 MB Example of input and output if 1500 MB is needed: 1.2 Data needed (MB): 1500 1.2 - Data bundles Bundles needed: 3 Cost: R 117.00 Unused data: 0 MB (8) Copyright reserved Please turn over
Information Technology/P1 7 Hlayiso/Mock 2026 NSC Mock 1.3 Button [1.3 - Achievement level] The portal converts a test mark to a percentage and a CAPS achievement level. The user enters the mark obtained in the spin edit spnQ1_3_Mark and the total mark of the test in the spin edit spnQ1_3_Total. Percentage Level Description 80–100 7 Outstanding 70–79 6 Meritorious 60–69 5 Substantial 50–59 4 Adequate 40–49 3 Moderate 30–39 2 Elementary 0–29 1 Not achieved Write code to do the following: • Extract the mark obtained and the total mark from the spin edits. • If the total mark is 0, OR the mark obtained is greater than the total mark, display the message ’Invalid marks entered’ and exit the procedure. • Calculate the percentage, rounded to the nearest whole number. • Use a CASE statement to determine the level and the description of the level. • Display the percentage in the label lblQ1_3_Perc and the level and its description in the label lblQ1_3_Level, as shown in the examples below. • Change the font colour of lblQ1_3_Level to green (clGreen) if the percentage is 50 or more, otherwise change it to red (clRed). Copyright reserved Please turn over
Information Technology/P1 8 Hlayiso/Mock 2026 NSC Mock Example of input and output if a learner obtained 47 out of 70: 1.3 Mark obtained: 47 1.3 - Achievement level Total mark: 70 Percentage: 67% Level 5 - Substantial Example of input and output if a learner obtained 29 out of 80: 1.3 Mark obtained: 29 1.3 - Achievement level Total mark: 80 Percentage: 36% Level 2 - Elementary (9) Copyright reserved Please turn over
Information Technology/P1 9 Hlayiso/Mock 2026 NSC Mock 1.4 Button [1.4 - Hashtag] The school’s social media team wants to turn short phrases into hashtags. The user enters a phrase in the edit box edtQ1_4. The words in the phrase are separated by ONE space each. Write code to do the following: • Extract the phrase from the edit box. If the edit box is empty, display a suitable message and exit the procedure. • Create the hashtag by processing the phrase character by character in a loop: o The hashtag starts with the character ’#’. o All spaces must be removed. o The first character of each word must be in upper case and all the other characters must be in lower case. • Count the number of words in the phrase. • Display the hashtag and the number of words in the label lblQ1_4_Tag. • If the hashtag (including the ’#’) is longer than 20 characters, display the message ’Warning: the hashtag is longer than 20 characters’ in the label lblQ1_4_Msg. Otherwise display ’Length OK: ’ followed by the number of characters and the word ’characters’, as shown in the examples below. Example of input and output if ’grade 11 coding club’ was entered: 1.4 Phrase: grade 11 coding club 1.4 - Hashtag #Grade11CodingClub (4 words) Length OK: 18 characters Example of input and output if ’SAVE water at thuto HIGH school’ was entered: 1.4 Phrase: SAVE water at thuto HIGH school 1.4 - Hashtag #SaveWaterAtThutoHighSchool (6 words) Warning: the hashtag is longer than 20 characters (10) Copyright reserved Please turn over
Information Technology/P1 10 Hlayiso/Mock 2026 NSC Mock 1.5 Button [1.5 - Savings plan] A learner wants to save money for the matric farewell. The learner deposits R100.00 in the first month and increases the deposit by R20.00 every month after that (R100.00, R120.00, R140.00, …). The user enters the target amount in rand in the edit box edtQ1_5. Code has been provided to clear the memo memQ1_5. Write code to do the following: • Extract the target amount from the edit box. • Use a conditional loop to add the monthly deposits to the total savings until the total savings is equal to or more than the target amount. • For each month, display the number of the month, the deposit for that month and the total savings so far in the memo memQ1_5 in the following format (amounts with an ’R’ and TWO decimal places): Month <number>: deposit R<deposit> - total R<total> • After the loop, display the number of months that it took to reach the target, as shown in the example below. Example of input and output if the target amount is R1500: 1.5 Target amount (R): 1500 1.5 - Savings plan Month 1: deposit R100.00 - total R100.00 Month 2: deposit R120.00 - total R220.00 Month 3: deposit R140.00 - total R360.00 Month 4: deposit R160.00 - total R520.00 Month 5: deposit R180.00 - total R700.00 Month 6: deposit R200.00 - total R900.00 Month 7: deposit R220.00 - total R1120.00 Month 8: deposit R240.00 - total R1360.00 Month 9: deposit R260.00 - total R1620.00 Target reached after 9 month(s) (9) • Enter your examination number 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
Information Technology/P1 11 Hlayiso/Mock 2026 NSC Mock QUESTION 2: ARRAYS AND TEXT FILES The Grade 11 class runs the school tuck shop to raise funds for the matric farewell. The items sold in the tuck shop and the number of each item sold during the third term were recorded in a text file. Do the following: • Open the incomplete program in the Question 2 folder. • Enter your examination number as a comment in the first line of the Question2_U.pas file. • Compile and execute the program. The program has no functionality currently. Example of the graphical user interface (GUI): Question 2 - Arrays and text files – □ × Options 2.1 - Load data 2.2 - Search Category Snack Drink Lunch Increase (%): 0 2.3 - Increase prices 2.4 - Sort and display 2.5 - Sales log Copyright reserved Please turn over
Information Technology/P1 12 Hlayiso/Mock 2026 NSC Mock The text file called TuckShop.txt contains the name of each item, the category of the item (Snack, Drink or Lunch), the selling price of the item in rand and the quantity of the item that was sold. The format of each line in the text file is as follows: <item>#<category>#<price>#<quantity sold> Example of the first five lines in the text file: Vetkoek and mince#Lunch#18.50#64 Cheese puffs#Snack#8.00#95 Orange juice 300 ml#Drink#12.00#58 Chicken wrap#Lunch#32.00#27 Peanut brittle#Snack#6.50#41 The following global arrays and counter variable have been declared: arrItems: array [1 .. 40] of String; arrCategory: array [1 .. 40] of String; arrPrice: array [1 .. 40] of Real; arrQty: array [1 .. 40] of Integer; iCount: Integer; Complete the code for each section of QUESTION 2, as described in QUESTION 2.1 to QUESTION 2.5 below. 2.1 Button [2.1 - Load data] A text file variable tFile has been declared. Write code to do the following: • Test whether the text file TuckShop.txt exists. If the file does not exist, display a suitable message and exit the procedure. • Assign the text file to the variable tFile and prepare the file for reading. • Read each line in the text file. Extract the item, the category, the price and the quantity sold, and store them in the parallel arrays arrItems, arrCategory, arrPrice and arrQty. Use the variable iCount to keep track of the number of items stored in the arrays. • Close the text file and display the number of items in the label lblQ2_1 in the format: Items loaded: <number> Example of output: 2.1 - Load data Items loaded: 22 (12) Copyright reserved Please turn over
Information Technology/P1 13 Hlayiso/Mock 2026 NSC Mock 2.2 Button [2.2 - Search] Code has been provided to clear the rich edit redQ2. Write code to do the following: • Use an input box to ask the user for the name, or part of the name, of an item. • Display a heading as shown in the examples below. • Search the array arrItems for ALL the items that contain the text that was entered. The search must NOT be case sensitive. • Display the name and the price of each item found, in currency format, in the rich edit redQ2. • After the search, display the number of items found, OR the message ’No items found’ if no item contains the text. NOTE: QUESTION 2.1 must be completed before QUESTION 2.2 to QUESTION 2.5 can be tested. Example of output if ’chips’ was entered: Items matching "chips": Chips small R9.00 Chips large R15.00 2 item(s) found Example of output if ’pizza’ was entered: Items matching "pizza": No items found (7) Copyright reserved Please turn over
Information Technology/P1 14 Hlayiso/Mock 2026 NSC Mock 2.3 Button [2.3 - Increase prices] The prices of all the items in ONE category must be increased by a percentage. The user selects the category in the radio group rgpQ2_3 and enters the percentage increase in the spin edit spnQ2_3. Code has been provided to clear the rich edit redQ2. Write code to do the following: • If no category has been selected, display a suitable message and exit the procedure. • Display a heading that includes the selected category and the percentage, as shown in the example below. • For each item in the selected category: o Calculate the new price by increasing the price by the percentage entered. o Round the new price to the nearest 50 cents (for example, R13.44 becomes R13.50 and R16.24 becomes R16.00). o Display the name of the item, the old price and the new price in neat columns. o Store the new price in the array arrPrice. • Display the number of prices that were updated. HINT: To round a value to the nearest 50 cents, round the value multiplied by 2 to the nearest whole number and then divide the result by 2. (Values exactly halfway may be rounded either way.) Example of output if the category Drink was selected and the increase is 12%: New prices for the category Drink (+12%): Orange juice 300 ml R12.00 R13.50 Still water 500 ml R9.50 R10.50 Iced tea 330 ml R13.50 R15.00 Cream soda 330 ml R11.00 R12.50 Mango smoothie R24.00 R27.00 Chocolate milk 250 ml R14.50 R16.00 Rooibos iced tea 500 ml R16.00 R18.00 7 prices updated (8) Copyright reserved Please turn over
Information Technology/P1 15 Hlayiso/Mock 2026 NSC Mock 2.4 Button [2.4 - Sort and display] Code has been provided to clear the rich edit redQ2 and to display the headings. Tab stops have been set in the FormCreate event. Write code to do the following: • Sort the data in the parallel arrays in alphabetical order of the names of the items. • Display the name, category, price (with an ’R’ and TWO decimal places) and quantity sold of ALL the items in the rich edit redQ2 in neat columns. Example of output if the prices have NOT been changed in QUESTION 2.3 (the middle part of the output has been omitted): Item Category Price Sold Boerewors roll Lunch R28.00 52 Cheese puffs Snack R8.00 95 Chicken wrap Lunch R32.00 27 Chips large Snack R15.00 46 Chips small Snack R9.00 102 ... Still water 500 ml Drink R9.50 73 Toasted cheese sandwich Lunch R22.00 38 Vetkoek and mince Lunch R18.50 64 (8) Copyright reserved Please turn over
Information Technology/P1 16 Hlayiso/Mock 2026 NSC Mock 2.5 Button [2.5 - Sales log] At the end of every term the total income of the tuck shop is added to a log file called SalesLog.txt. A text file variable tLog has been declared. Write code to do the following: • Calculate the total income of the tuck shop. The income for an item is the price of the item multiplied by the quantity sold. • If the text file SalesLog.txt already exists, open it so that a new line is added to the END of the existing content. If the file does not exist, create a new file. • Write ONE line to the text file in the following format, where the date is today’s date (the system date) in the format yyyy/mm/dd and the income has TWO decimal places: <date>#<total income> • Close the text file and display a message that includes the total income. Example of the line added to the text file on 20 November 2026 if the prices have NOT been changed in QUESTION 2.3: 2026/11/20#15144.50 (5) • Enter your examination number 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
Information Technology/P1 17 Hlayiso/Mock 2026 NSC Mock QUESTION 3: DATABASE PROGRAMMING The Hope Paws animal shelter keeps information about the animals in its care in a database called ShelterDB.mdb. The database contains ONE table called tblAnimals. The design of the table tblAnimals is as follows: Field name Data type Description AnimalID (PK) AutoNumber A unique number that identifies an animal AnimalName Text (20) The name of the animal Species Text (10) The species of the animal (Dog, Cat or Rabbit) Gender Text (1) The gender of the animal (M or F) Age Number The estimated age of the animal in years DateArrived Date/Time The date on which the animal arrived at the shelter Sterilised Yes/No True if the animal has been sterilised, otherwise False AdoptionFee Currency The fee that a new owner pays to adopt the animal Adopted Yes/No True if the animal has been adopted, otherwise False Example of the first ten records in the table tblAnimals: AnimalID AnimalName Species Gender Age DateArrived Sterilised AdoptionFee Adopted 1 Bella Dog F 3 2026/01/14 True R850.00 True 2 Simba Cat M 2 2026/02/03 True R650.00 False 3 Rex Dog M 7 2025/11/20 True R850.00 False 4 Coco Rabbit F 1 2026/06/09 False R250.00 False 5 Max Dog M 1 2026/07/22 False R850.00 True 6 Luna Cat F 5 2025/09/30 True R650.00 False 7 Tiger Cat M 9 2025/08/12 True R650.00 False 8 Bruno Dog M 4 2026/03/17 True R850.00 True 9 Nala Dog F 2 2026/04/05 True R850.00 False 10 Snowy Rabbit M 2 2026/05/28 True R250.00 True NOTE: • Connection code has been provided in the unit dbConnection_U.pas. Do NOT change any of the code provided. • The table is accessed through the TADOTable object called tblAnimals, which has been declared as a global variable. • The ’Restore database’ button restores the data in the database to the original content. • Do NOT open the database in Microsoft Access during the examination. • Use ONLY Delphi programming code to answer QUESTION 3. NO marks will be awarded for SQL statements. • Do NOT use the Locate, Filter, Sort or RecordCount methods/properties. Copyright reserved Please turn over
Information Technology/P1 18 Hlayiso/Mock 2026 NSC Mock Do the following: • Open the incomplete program in the Question 3 folder. • Enter your examination number as a comment in the first line of the Question3_U.pas file. • Compile and execute the program. The program has limited functionality currently. The records of the table are displayed when the program is executed. Example of the graphical user interface (GUI): Question 3 - Database programming – □ × tblAnimals AnimalID AnimalName Species Gender Age DateArrived Sterilised AdoptionFee Adopted 1 Bella Dog F 3 2026/01/14 True R850.00 True 2 Simba Cat M 2 2026/02/03 True R650.00 False 3 Rex Dog M 7 2025/11/20 True R850.00 False 4 Coco Rabbit F 1 2026/06/09 False R250.00 False 5 Max Dog M 1 2026/07/22 False R850.00 True 6 Luna Cat F 5 2025/09/30 True R650.00 False 7 Tiger Cat M 9 2025/08/12 True R650.00 False 8 Bruno Dog M 4 2026/03/17 True R850.00 True 9 Nala Dog F 2 2026/04/05 True R850.00 False 10 Snowy Rabbit M 2 2026/05/28 True R250.00 True 11 Shadow Cat M 3 2026/01/26 True R650.00 True 12 Duke Dog M 10 2025/06/18 True R850.00 False 3.1 3.5 Select a species Name: 3.1 - Available animals Species: Select a species Gender 3.2 / 3.3 / 3.4 Male Age: 0 Female 3.2 - Statistics Sterilised 3.3 - Adopt animal 3.4 - Remove adopted 3.5 - Add animal Restore database Close Complete the code for each section of QUESTION 3, as described in QUESTION 3.1 to QUESTION 3.5 below. Copyright reserved Please turn over
Information Technology/P1 19 Hlayiso/Mock 2026 NSC Mock 3.1 Button [3.1 - Available animals] The user selects a species from the combo box cmbQ3_1. Code has been provided to clear the rich edit redQ3, to store the selected species in the variable sSpecies and to display a heading. Write code to do the following: • Display the name, the age and the date of arrival of each animal of the selected species that has NOT been adopted yet, in the rich edit redQ3. The date must be displayed in the format yyyy/mm/dd. • After all the records have been processed, display the number of animals found. If no animals were found, display the message ’No animals available’ instead. Example of output if ’Dog’ was selected: Animals available for adoption (Dog): Rex - age 7 - arrived 2025/11/20 Nala - age 2 - arrived 2026/04/05 Duke - age 10 - arrived 2025/06/18 Rocky - age 5 - arrived 2026/05/04 Tumi - age 6 - arrived 2026/02/27 Number available: 5 (7) Copyright reserved Please turn over
Information Technology/P1 20 Hlayiso/Mock 2026 NSC Mock 3.2 Button [3.2 - Statistics] Code has been provided to clear the rich edit redQ3. Write code to determine and display the following information in the rich edit redQ3, as shown in the example below: • The number of animals that have been adopted, the total number of animals in the table, and the percentage of animals that have been adopted, formatted to ONE decimal place • The total of the adoption fees of all the animals that have been adopted, in currency format • The name and the age of the oldest animal that has NOT been adopted yet (assume that there is only one such animal) Example of output for the original data in the database: Animals adopted: 7 of 20 (35.0%) Total adoption fees: R 4 950.00 Oldest animal still available: Duke (10 years) (9) 3.3 Button [3.3 - Adopt animal] When an animal is adopted, the record of the animal must be updated. Code has been provided to clear the rich edit redQ3. Write code to do the following: • Use an input box to ask the user for the name of the animal that was adopted. • Search for the animal in the table. The search must NOT be case sensitive and must stop as soon as the animal is found. • If the animal is not found, display a message that the animal was not found. • If the animal is found but has already been adopted, display the message ’<name> has already been adopted’. • Otherwise, change the Adopted field of the animal to True, save the change and display a message that contains the name of the animal and its adoption fee in currency format. Example of the message if ’nala’ was entered: Nala has been adopted. Adoption fee: R 850.00 (8) Copyright reserved Please turn over
Information Technology/P1 21 Hlayiso/Mock 2026 NSC Mock 3.4 Button [3.4 - Remove adopted] The records of all the animals that have been adopted must be removed from the table. Code has been provided to clear the rich edit redQ3 and to display a heading. Write code to do the following: • Delete the record of every animal that has been adopted. • Display the name and the species of each animal that is removed. • Display the number of records that were removed. NOTE: Make sure that NO record is skipped after a record has been deleted. Example of output for the original data in the database (the middle part of the output has been omitted): Records removed: Bella (Dog) Max (Dog) ... Zara (Dog) 7 records removed (7) Copyright reserved Please turn over
Information Technology/P1 22 Hlayiso/Mock 2026 NSC Mock 3.5 Button [3.5 - Add animal] A new animal has arrived at the shelter. The user enters the details of the animal in the components in group box grpQ3_5, as shown below. The adoption fee depends on the species: Dog – R850, Cat – R650 and Rabbit – R250. Write code to do the following: • If the edit box edtQ3_5_Name is empty, OR no species has been selected in the combo box cmbQ3_5, OR no gender has been selected in the radio group rgpQ3_5, display a suitable message and exit the procedure. • Add a new record to the table tblAnimals using the following: o The name of the animal from edtQ3_5_Name and the species selected in cmbQ3_5 o The FIRST letter of the gender selected in rgpQ3_5 (’M’ or ’F’) o The age from the spin edit spnQ3_5 o Today’s date (the system date) as the date of arrival o Whether the animal has been sterilised from the check box chkQ3_5 o The adoption fee according to the species o False for the Adopted field • Display a message to confirm that the animal has been added. NOTE: The AnimalID field is an AutoNumber field and will be generated automatically. Example of input: 3.5 Name: Thabo Species: Cat Gender Male Age: 2 Female ✓ Sterilised 3.5 - Add animal Example of the new record at the end of the table if it was added on 20 November 2026: AnimalID AnimalName Species Gender Age DateArrived Sterilised AdoptionFee Adopted 21 Thabo Cat M 2 2026/11/20 True R650.00 False (9) • Enter your examination number 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
Information Technology/P1 23 Hlayiso/Mock 2026 NSC Mock QUESTION 4: PROBLEM SOLVING A Grade 11 IT teacher has asked you to develop a program with number activities that learners can use to explore number systems, prime numbers and probability. 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 the graphical user interface (GUI): Question 4 - Problem solving – □ × 4.1 Decimal number: 4.1 - Binary 4.2 From: 1 To: 100 4.2 - Twin primes 4.3 4.3 - Dice simulation Copyright reserved Please turn over
Information Technology/P1 24 Hlayiso/Mock 2026 NSC Mock 4.1 Button [4.1 - Binary] The user enters a decimal (base 10) number in the edit box edtQ4_1. Code has been provided to clear the memo memQ4 and to store the input in the variable sInput. Write code to do the following: • Validate the input. The input is valid if it is NOT empty, ALL the characters are digits and the number is NOT greater than 255. If the input is not valid, display a suitable message and exit the procedure. • Convert the number to a binary (base 2) number by repeatedly dividing the number by 2 and using the remainders, as shown in the example below. You may NOT use a built-in conversion function. • Add leading zeros so that the binary number always consists of 8 bits. • Count the number of 1 bits in the binary number and determine the EVEN parity bit: the parity bit is 1 if the number of 1 bits is odd, otherwise it is 0. • Display the decimal number, the binary number, the number of 1 bits and the parity bit in the memo memQ4, as shown in the examples below. Example of the conversion of 75 to binary: Number 75 37 18 9 4 2 1 Number DIV 2 37 18 9 4 2 1 0 Number MOD 2 (remainder) 1 1 0 1 1 0 0 Reading the remainders from right to left gives 1001011, which becomes 01001011 with leading zeros. Example of output if 75 was entered: Decimal number: 75 Binary number: 01001011 Number of 1 bits: 4 Even parity bit: 0 Example of output if 200 was entered: Decimal number: 200 Binary number: 11001000 Number of 1 bits: 3 Even parity bit: 1 (11) Copyright reserved Please turn over
Information Technology/P1 25 Hlayiso/Mock 2026 NSC Mock 4.2 Button [4.2 - Twin primes] A prime number is a whole number greater than 1 that is divisible only by 1 and by itself. Twin primes are two prime numbers that differ by 2, for example 11 and 13. Do the following: • Write a user-defined function called isPrime that receives an integer as a parameter and returns True if the number is a prime number, otherwise False. • Complete the code for the button Button [4.2 - Twin primes]: Code has been provided to clear the memo memQ4. The user enters a start number in the spin edit spnQ4_2_From and an end number in the spin edit spnQ4_2_To. o Display a heading as shown in the example below. o Use the function isPrime to find and display ALL the pairs of twin primes where both numbers are in the range from the start number to the end number (both included). o Display the number of pairs found. Example of output if the range is from 1 to 50: Twin primes from 1 to 50: (3, 5) (5, 7) (11, 13) (17, 19) (29, 31) (41, 43) Number of pairs: 6 (10) Copyright reserved Please turn over
Information Technology/P1 26 Hlayiso/Mock 2026 NSC Mock 4.3 Button [4.3 - Dice simulation] The program must simulate the throwing of two dice to show learners which totals occur most often. A constant ROLLS = 600 and a global array arrCount have been provided: arrCount: array [2 .. 12] of Integer; Code has been provided to clear the memo memQ4. Write code to do the following: • Set all the elements of the array arrCount to 0. • Simulate ROLLS throws of two dice. For each throw, generate a random number from 1 to 6 for each die, add the two numbers and use the array arrCount to count how many times each total (2 to 12) occurs. • For each total, display the total, the number of times it occurred and a bar that consists of ONE asterisk (*) for every complete 10 times that it occurred, as shown in the example below. • Determine and display the total that occurred the most. If more than one total occurred the most, display the first (smallest) such total. Example of output: Total 2: 15 * Total 3: 39 *** Total 4: 51 ***** Total 5: 60 ****** Total 6: 85 ******** Total 7: 97 ********* Total 8: 78 ******* Total 9: 74 ******* Total 10: 44 **** Total 11: 37 *** Total 12: 20 ** Most frequent total: 7 NOTE: The numbers may differ due to the nature of random numbers. (9) • Enter your examination number 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

Study this subject

More from Grade 11 Information Technology

View all