0% found this document useful (0 votes)
247 views12 pages

2210 s15 QP 22

Uploaded by

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

2210 s15 QP 22

Uploaded by

Mohammad Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
‘Cambridge International Examinations ‘Cambridge Ordinary Level CANDIDATE NAME CENTRE ‘CANDIDATE NUMBER NUMBER COMPUTER SCIENCE 2210/22 Paper 2 Problem-solving and Programming Mayfune 2015 Thour 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 naman the spaces al the lop of this page Wirt in dak blue o¢ black pen You may use an HB pencil for any diagrams, graphs or rough working, Do not use staples, paper clips, glue or correction fuid DO NOT WRITE IN ANY BARCODES. ‘Answor all questions. DO NOT ATTEMPT TASKS 1, 2 AND 3in the pre-release material these are for inlormation only ‘You are advised to spend no more than 40 minutes an Section A (Question 1), No marks will be awarded for using brand names of sottware packages or hardware. Atthe 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 60. This document consists of 11 printed pages and 1 blank page. be (FD) 110074 CAMBRIDGE SUCLES 2015 oral [Turn over 2 Section A You are advised to spend no longer than 40 minutes answering this section. Here is a copy of the pre-release material. DO NOT attempt Tasks 1, 2 and 3 now. Use the pre-release material and your experience from attempting the tasks before the examination to answer Question 1 Pre-release Material Write and test a program to complete the three tasks. TASK 1 A school Keeps records of the weights of each pupil, The weight, in kilograms, of each pupil is recorded on the first day of term. Input and store the weights and names recorded for a class of 30 pupils. You must store the weights in a one-dimensional array and the names in another one- dimensional array. All the weights must be validated on entry and any invalid weights rejected. You must decide your onn validation rules. You may assume that the pupils’ names are unique. Output the names and weights of the pupils in the class. TASK 2 The weight, in kilograms, of each pupil is recorded again on the last day of term. Calculate and store the difference in weight for each pupil. TASK 3 For those pupils who have a difference in weight of moro than 2.6 kilograms, output, with a suitable message, the pupil's name, the difference in weight and whether this is a rise or a fall Your program must include appropriate prompts for the entry of data. Error messages and other outputs need to be set out clearly and understandably. All variables, constants and other identifiers must have meaningful names. Each task must be fully tested. eucves 201s poramons 3 1 (@) Allvariabies, constants and other identifiers should have meaningful names. (i) Declare the array to store the pupils’ names. svseaasareansonnl a - a aera ee a] thas been decided to record the weights for the whale schoo! of 600 pupils rather than one class, Write suitable new declarations for these two arrays. (©) Write an algorithm to complete Task 2, using either pseudocode, programming statements ‘ora flowchart. Use weights for the whole school. You should assume that Task 1 has already bean compiated. euctes 2015 2atmzonunis: [urn over () @ (ii) 4 Describe suitable validation rules for Task 1 Give twe pupil weights thal you could use to check the validation used in Task 1. Explain why you chose each weight. Weight axccsairainonamuacatccinsiiancrmt aa asia ina mataaatasiasinae Reason for choice or : : sR . . Weight 2 soesesnenenes ne Reason for choice ns sastnie 7 Fs sist 3 Pitacaceeeeeeee Scsseiteouce ppepmnmspesne earmold] (3) Explain how you select the pupils with a fall in weight of more than 2.5 kilograms (part of Task 3). You may include pseudocode or programming statements as part of your explanation, eucves 201s poramons 5 Section B 2 Read this section of program code that should input 30 positive numbers and then cutput the largest number input. 1 Large = 9999 2 counter = 0 3 WHILE Counter > 30 4 Do 5 INPUT Num 6 IP Num < Large THEN Large = Num 7 Counter = Counter - 1 8 ENDWHILE 9 PRINT Large ‘There are four errors in this code. Locate these errors and suggest a corrected piece of code for each error. euctes 2015 2atmzonunis: [urn over 6 3° (@) The flowchart below inputs six single digit numbers. The predefined function map gives the value of the remainder, for example, ¥ — 10 MOD 3 gives the value Y = 1 Total — A*1+ BA2+ C#]4 Dea + Ets y cheek + Total MOD 11 OuTEUT ‘Accept ' eucves 201s poramons 7 Complete a trace table for each of the two sets of input data Seti 5.2.4,.3,4,5 Set2 3,2, 4.0.7.3 Trace table set! 5,2,4,3,1,5 [oa 8 c D E F | Total | Check | Output | | | Trace table set 2 3,2.1,0.7,3 [a B c D E F Total | Check | Output | 4) (b)_ State the purpose of the flowchart in part (a). (c) Identify a problem with this flowchart and explain how to correct it, ProbIOM assess aura aiden dem tmemnaretiopeas Solution {3} euctes 2015 2atmzonunis: [urn over 8 4 Four programming concepts and four examples of programming code are shown below, Draw a line ta link each programming concept to the correct example of programming code ee Example of programming code Counting Sum = Sum + Value(n] Repetition IE Value = 10 THEN PRINT 'x' | Selection FoR Counter = 1710 | Totaling Amount = Amount + 1 | [som = uma + wana | [4] 5 (a) Write an algorithm, using pseudocode and a FOR .. TO . NEXT loop structure, to input 1000 numbers into an array. ee em recmnmrene eB] (b) Rewrite your algorithm using another loop structure. eucves 201s poramons Question 6 begins on page 10. eucves 201s poramons [urn over 40 A database, MARKS, was set up fo record the test results for a class of students, Part of the database is shown below. Student Name | Class ID Maths English | Science | History | Geography Paul Smith 0017 70 55 65 62 59 Ravi Gupta | 0009 29 34 38 4 44 Chin Hwee | 0010 43 a7 50 45 52 John Jones | 0013 a 67 21 28 35 Diana Abur | 0001 92 a8 95 89 738 Rosanna ‘0016 21 13 "1 27 18 (@) Give the number of fields that are in each record. (¢} The query-by-example grid below selects all students with more than 60 marks in History or more than 60 marks in Geography. Field: | Student Name History Geography ‘Table: | MARKS: MARKS MARKS Sort: | Ascending Show: z oO oO ‘Criteria: 60 or: 60 ‘Show what would be output. eucves 201s poramons " (2) Compiete the query-by-example grid below to select and show the student names only of all students with less than 40 marks in both Maths and English, Field: Tabla: Sort: Show: Criteria: or (3) eucves 201s poramons 42 BLANK PAGE Permcon orepedceliore whee tie-pariyou ed rae prolecied by cps incu Nas best sch an Geared where peers Every veasonble ‘torines om me 5 ne pubisner (CLES; fo babe eapyrf hldrn ba Wary Hors roqatngconranc hav vowtngly De tind he pusher te pleased nro amerds et hm ore pene parity Taal na sue of alcosuect anawer ried Wiamaten te canacats a ecpyngh aclrawiedgarants es rprequce aright Gambge eral Enarinaons Copyright Acknonladgenon ls Bookel Tha inpreduced ke tach wifes ol exact res hon alti ts dowrlead al ware. ak lt Cems iemational Examination spare the Camtldge Asessmeri Secup Canbidge Assassmen| i fo breed name cf Urey of Care Locl xarinabone Syreeato(UCLES|, wich sells eaurruer cf ha Uwery of Canon eucves 201s povamonus

You might also like