Ahmadhiyya International School Mock Exam Grade 10 CANDIDATE NAME CLASS CENTRE NUMBER CANDIDATE NUMBER COMPUTER SCIENCE Paper 2 Problem Solving and Programming 0478/22 22 March 2022 1 hour 45 minutes Candidates answer on the Question Paper. No Additional Materials are required. No Calculators allowed READ THESE INSTRUCTIONS FIRST Write your Centre number, candidate number and name on all the work you hand in. Write in dark blue or black pen. You may use an HB pencil for any diagrams or graphs. Do not use staples, paper clips, glue or correction fluid. DO NOT WRITE IN ANY BARCODES. Answer all questions. DO NOT ATTEMPT TASKS 1, 2 AND 3; these are for information only. You are advised to spend no more than 40 minutes on Section A (Question 1). No marks will be awarded for using brand names of software packages or hardware. At the end of the examination, fasten all your work securely together. The number of marks is given in brackets [ ] at the end of each question or part question. The maximum number of marks is 50. For Examiner’s Use 50 This document consists of 10 printed pages including the cover page © AIS 2022 Ahmadhiyya International School Examinations MOCK EXAM 2021-22 [Turn over - 2 of 10 Section A You are advised to spend no longer than 40 minutes answering this section. In preparation for the examination candidates should attempt the following practical tasks by writing and testing a program or programs. A program is needed to allow a Wildlife Park to sell tickets. A booking consists of one or more tickets for the same day(s) and can be made up to a week in advance. A booking can be made for a visit of one day or two consecutive days. A booking can have extra attractions included. A booking will be valid for the day(s) chosen only. Ticket Type Cost for one day Cost for two days one adult $20.00 $30.00 one child (an adult may bring up to two children) $12.00 $18.00 one senior $16.00 $24.00 family ticket (up to two adults or seniors and three children) $60.00 $90.00 groups of six people or more, price per person $15.00 $22.50 Exam attraction Cost per person lion feeding $2.50 penguin feeding $2.00 evening barbecue (two-day tickets only) $5.00 Write and test a program or programs for the Wildlife Park: • Your program or programs must include appropriate prompts for the entry of data. Data must be validated on entry. • All outputs, including error messages, need to be set out clearly and understandably. • All variables, constants and other identifiers must have meaningful names. You will need to complete these three tasks. Each task must be fully tested. Task 1 – displaying the ticket options and the extra attractions available Set up your program to: • display the options, attractions and prices for one-day tickets • display the options, attractions and prices for two-day tickets • show the days available for booking; assume that there are tickets available for any valid day. Task 2 – process a booking Extend your program for Task 1 to: • input the tickets and extra attractions required, then calculate the total cost of the booking • allocate a unique booking number • display the booking details, including the total cost and the unique booking number • repeat as required. Task 3 – ensuring each booking is the best value Check that the total for each booking gives the best value and offer an alternative if this is not the case. For example, buying two family tickets is better than a group ticket for a group of 10 that includes four adults and six children. ©AIS Computer Science - P2 Mock Exam – 2021-22 Grade 10 - 3 of 10 - 1. a. All variables, constants and other identifiers should have meaningful names. (i) Name three arrays you used in Task 1 and state the purpose of each one. Note that the arrays you list must be of three different data types. [3] Array 1: Purpose: Array 2: Purpose: Array 3: Purpose: (ii) Name one constant you used in Task 1 and state the purpose of each one. [1] Constant: Purpose: (iii) Write the program code / pseudocode to display the ticket options, extra attractions available and the days available for booking. You should show your variables / constants / arrays and declaration of data type clearly. ©AIS Computer Science - P2 [7] Mock Exam – 2021-22 Grade 10 - 4 of 10 - ©AIS Computer Science - P2 Mock Exam – 2021-22 Grade 10 - 5 of 10 - b. ©AIS Discuss how you plan to ensure best booking as required in Task 3? Computer Science - P2 Mock Exam – 2021-22 [2] Grade 10 - 6 of 10 c. In Task 2, for each booking, a booking number needs to be given, total to be calculated and number of days with week day names is required to be displayed in the end. Write the program code used for: [7] Booking number: Display the day/s selected: Total for family booking: Total for group booking: ©AIS Computer Science - P2 Mock Exam – 2021-22 Grade 10 - 7 of 10 Section B 2. Study the following flowchart very carefully. Start num[3]={ 9 , 5, 7 } i=1 NO i<=3 Print “Done” YES Stop j=i+1 j<=3 NO YES i j temp num (i) num (j) output 1 2 9 5 9 9 7 9 3 num[ i ] > num[ j ] 4 NO 2 4 YES temp = num[ i ] num[ i ] = num[ j ] num[ j ] = temp 3 3 4 4 done j=j+1 i=i+1 a. Trace the above flowchart and write down the value of num ( i ) and num ( j ) when i was 1. [3] num ( i ) = num ( j ) = b. Guess the purpose of the above flowchart. ©AIS Computer Science - P2 [1] Mock Exam – 2021-22 Grade 10 - 8 of 10 - 3. Study the pseudocode given below carefully. Declare passw( 6) as string Read passw(6) f rom f ile passw( 6) = ( "T", " !", "O", "w ", "$", " # " ) attempt = 0 WHILE attempt < 2 INPUT "Ent er the f irst character", f $ IF passw(1) <> f $ THEN PRINT "Access denied" ELSE INPUT " Enter the f if th character", f v$ IF passw( 5) <> f v$ THEN PRINT " Access denied" ELSE INPUT " Enter the sixth character ", sx$ IF passw( 6) <> sx$ THEN PRINT " Access denied" ELSE PRINT " Access granted" END IF END IF END IF attempt = attempt + 1 END WHILE a. Trace the above pseudocode for the following sets of inputs: Set 1: t, T, $, 3 Set 2: T, 4, T, $, # [4] attempt f$ fv$ 0 t 1 T $ 0 T 4 1 T $ sx$ output Access denied 3 Access denied 2 Access denied # Access granted 2 ©AIS Computer Science - P2 Mock Exam – 2021-22 Grade 10 - 9 of 10 b. What is the purpose of the above algorithm? [1] c. The above algorithm has a bug which cannot be found with the given test data. Identify the error. [1] d. Write down the steps to be taken to correct the algorithm. [2] 4. Define the following with a suitable example for each. [6] a. Totalling b. Counting c. Inbuilt function ©AIS Computer Science - P2 Mock Exam – 2021-22 Grade 10 - 10 of 10 - 5. A single-table database, CCTV needs to be set up to store details of CCTV Cameras for sale. CCTVID Brand Type Resolution Face detection Price Motion detection stock a. Suggest the data type for each of the required fields listed below. Field Name [5] Data Type CCTVID Brand Type Resolution Price Face detection Motion detection Stock b. Name the field that is suitable to be the key field. [1] c. Give a validation check that could be used on stock data. [1] d. The following results were output when a query was run. 2688x1520 Face detection Yes $125.00 1920x1080 No $100.00 CCTVID Brand Resolution D101 Hikvision B105 Bosch Price Complete the query-by-example grid that caused the above records to be output. [5] Field Table Sort Show Criteria or ©AIS Computer Science - P2 Mock Exam – 2021-22 Grade 10