HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A swimming pool gives a teen ticket to anyone aged from 13 to 19, both included…
MediumComputer ScienceHigh School (9–10)Computer Science › Algorithms and Problem-SolvingConceptualNumericalIGCSE

A swimming pool gives a teen ticket to anyone aged from 13 to 19, both included…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A swimming pool gives a teen ticket to anyone aged from 131313 to 191919, both included. A programmer writes this.

pseudocode
INPUT Age
IF Age > 12 AND Age < 19
  THEN
    OUTPUT "Teen ticket"
  ELSE
    OUTPUT "Standard ticket"
ENDIF

The test plan uses the ages 161616, 131313, 191919 and 202020. Which age shows that the algorithm is wrong? Correct the algorithm.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

Normal data is accepted. Abnormal data should be rejected. Extreme data is the largest or smallest accepted value. Boundary data is the largest or smallest accepted value and the value next to it that is rejected. Find errors by dry-running with simple data and comparing with the expected result.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. Each test.

  • 161616: expected teen; 16 > 12 AND 16 < 19 is true. Teen. Pass.
  • 131313: expected teen; 13 > 12 is true and 13 < 19 is true. Teen. Pass.
  • 191919: expected teen; 19 < 19 is false. Standard. Fail.
  • 202020: expected standard; standard. Pass.

Step 2. The correction. IF Age >= 13 AND Age <= 19, or IF Age > 12 AND Age < 20.

Answer: the age 191919 shows the error. It is boundary data (the largest accepted value), which is why boundary tests matter.

Check. After the correction, run all four tests again. They all pass.

Log in to save this for later
← All Problems
← This algorithm should input five marks, each from 0 to 100, and output the highest mark…A school weather station records the rain each day, in millimetres… →
More onComputer Science › Algorithms and Problem-Solving

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Test data and finding errorsPseudocode, Trace Tables and Testing

More on this topic

  1. This is the kind of long scenario question that ends Paper 2…Hard
  2. A delivery company adds a check digit to each parcel number…Medium
  3. Name the check in each case. Say whether it is validation or verification…Easy
  4. A bubble sort is changed so that it sorts in descending order: the comparison becomes IF…
Hard
  • A shop stores the colours of the ten bicycles in its window in an array Colours: red, blue, red…Medium
  • All problems on this topic →