Skip to main content
O-LevelComputer ScienceProgramming2210/21 · May/June 2017 · Q120 Marks

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 A teacher is planning a school trip to a theme park at the end of term. You have been asked to write a program to work out the cost per student, to record those who are going and whether they have paid. The maximum number of students who can go on the trip is 45. Write and test a program for the teacher. • Your program must include appropriate prompts for the entry of data. • Error messages and other output need to be set out clearly. • 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 – Work out the cost. The cost of the trip for each student is a share of the cost of a coach plus the cost of entry to the theme park. The total cost of the coach will be $550. The entry cost to the park is $30 for each student. The theme park gives one free ticket for every ten that are bought, which must be taken into consideration. Set up a program that: • stores the cost of the coach • stores the cost of an entry ticket • inputs the estimated number of students taking part, this must be validated on entry and an unsuitable entry rejected • calculates and outputs the recommended cost per student to ensure the trip does not make a loss. TASK 2 – Record the students who are going and whether they have paid. Input and store the names of the students who have asked to go on the trip up to the maximum number allowed. Input and store whether each student has paid. Enable printouts to be produced to show students who have not paid and those who have paid. TASK 3 – Work out final costs. Not all students will end up going on the trip, for example they might not have paid. Modify the program so that it gives overall totals for the costs charged and the amount of money collected. Output whether the school trip has made a profit or loss, or has broken even, and the amount of the final balance.

  1. (a)(i)Name two constants you used for Task 1 and state the value of each one.[2]
  2. (a)(ii)Name two arrays you used for Task 2 and state the purpose of each one.[2]
  3. (b)Write an algorithm to complete Task 1, using either pseudocode, programming statements or a flowchart.[5]
  4. (c)(i)Name and describe one suitable validation check you used for Task 1, and one suitable validation check for Task 2. Each check MUST be different.[4]
  5. (c)(ii)For each validation check in part (c)(i), give an example of suitable test data and explain why you chose the test data.[4]
  6. (d)Explain how your program calculates whether or not you have made a profit (Task 3). Any programming statements used in your answer must be fully explained.[3]

Mark scheme

Marking points from the official mark scheme (May/June 2017). The mark or mark type is shown in brackets.

  1. [1] 1 mark for two meaningful names of constants
  2. [1] 1 mark for two relevant values related to Task 1
  3. Many correct answers, they must be meaningful. These are examples only.
  4. Coach_cost, 550
  5. Ticket_cost, 30
  6. Max_Students, 45
  7. Free_Ticket, 10 (allow 9)
  8. [1] 1 mark for Any meaningful name AND purpose related to Task 2
  9. Many correct answers, they must be meaningful. These are examples only.
  10. Students / ArrayStudents to store the students' names
  11. paid / arrayPaid to record whether a student has paid or not
  12. Max 2 marks
  13. [5] Any five from:
  14. - Initialise values for both coach and ticket
  15. - Prompt for number of students taking part and input of number
  16. - Attempt at validation
  17. - Working validation for the entry for the number of students covering both ends of the range
  18. - Working out the number of free ticket(s)
  19. - Calculation of total cost of tickets including consideration of free tickets
  20. - Calculation of actual cost per student including coach
  21. - Output of cost to be charged with suitable annotation
  22. Example
  23. Coach <- 550
  24. Ticket <- 30
  25. PRINT "Please enter the number of students taking part "
  26. INPUT NumberOfStudents
  27. WHILE NumberOfStudents <= 0 OR NumberOfStudent > 45
  28. PRINT "Your number of students is out of range, please try again"
  29. INPUT NumberOfStudents
  30. ENDWHILE
  31. FreeTickets <- NumberOfStudents DIV 10
  32. TotalCostTickets <- (NumberOfStudents - FreeTickets) * Ticket
  33. CostPerStudent <- (Coach + TotalCostTickets) / NumberOfStudents
  34. PRINT "The cost to be charged to each student is $", CostPerStudent
  35. [1] 1 mark for check and 1 mark for related description
  36. Task 1
  37. Many correct answers, they must relate to the pre-release task. These are examples only.
  38. Type/Character check to make sure only integers are entered for number of students
  39. Range/Limit check to make sure the number of students entered is not too large or small
  40. Presence check to make sure an entry has been made (for the number of students)
  41. Task 2
  42. Many correct answers, they must relate to the pre-release task. These are examples only.
  43. Type/Character check to make sure only letters are entered for names of students
  44. Length check to make sure the name entered is not too long
  45. Presence check to make sure an entry has been made (for a student name)
  46. Max 4 marks
  47. [1] 1 mark for appropriate test data and 1 mark for related reason
  48. Task 1
  49. Many correct answers, they must relate to the pre-release task and part (c)(i). These are examples only.
  50. Test data: -50 for number of students
  51. Reason: To check that negative values for number of students are rejected
  52. Task 2
  53. Many correct answers, they must relate to the pre-release task and part (c)(i). These are examples only.
  54. Test data: Smith@ for name
  55. Reason: To check that invalid characters are rejected in names
  56. Max 4 marks
  57. [3] Any three from:
  58. - Explanation of how the actual total costs are calculated - (cost of coach and cost of tickets)
  59. - Explanation of how the actual total income is calculated – (totalled money collected from students)
  60. - Explanation to show how the profit or loss is calculated – (total income - total expenditure)
  61. - Indicate whether a profit, break even, or loss has been made

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Programming, O-Level Computer Science (syllabus 2210). Structured question, 20 marks.
Source
O-Level Computer Science, May/June 2017 Paper 2 Variant 1, question 1.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep