Scenario-Based Problem Solving · Lesson 1 of 3
Unseen Problems
The last question on Paper 2 is an unseen 15-mark scenario, worth about 30 minutes. Extract its requirements instead of relying on a memorised program: identify the data, decisions, repetition, outputs and exceptional cases, and use a small worked input to check your interpretation. It is the only question where Python, Visual Basic or Java is accepted as well as pseudocode; everywhere else in Paper 2 coding answers must be pseudocode.
By the end, you can
- Extract requirements from an unfamiliar scenario.
- Identify required inputs and outputs.
- Select appropriate programming constructs.
- Plan a complete algorithm before implementation.
- Know that pseudocode is accepted for every coding answer in Paper 2, and that the 15-mark scenario question also accepts Python, Visual Basic or Java.
- Recognise how pseudocode constructs are written in Python, Visual Basic and Java.
- Write comments in Python, Visual Basic and Java.
Scenario analysis
A scenario question describes a situation in ordinary language and expects a complete solution. The difficulty is not the programming but the reading, and the marks are lost in the reading far more often than in the code.
Read it twice. The first time for the shape of the problem; the second with a pen, underlining every requirement. Phrases such as for each, until, if, at least, no more than and in order are not description — each one is a construct. For each is a loop, if is selection, until is a condition, at least is a comparison with an inclusive boundary.
Pull out the numbers and rules explicitly: how many items, what range is valid, what counts as a pass, what must be rejected. These become constants and validation rules, and a number mentioned once in the middle of a paragraph is exactly the one that gets missed.
Separate what must be stored from what is merely mentioned. If the problem needs the highest value it needs a variable; if it needs all the values afterwards, or a second pass over them, it needs an array. Decide this before writing anything, because adding an array halfway through a solution means rewriting it.
Then plan on paper: inputs, outputs, the main steps in order, and the structures needed. A few minutes here is why one candidate writes a working solution and another writes three false starts.
Know the exam facts. The scenario question is the last question on Paper 2: unseen, worth 15 marks, and expected to take about 30 minutes. It is the only place where an answer may be written in Python, Visual Basic or Java as well as pseudocode; everywhere else in Paper 2, a coding answer must be pseudocode, and program code earns no marks. The answer should include comments explaining the code. Paper 2 as a whole lasts 1 hour 45 minutes and is worth 75 marks, half of the qualification, and calculators are not allowed in either paper.
Worth remembering
- Underline every requirement; for each, until and if each name a construct.
- Extract the numbers and rules as constants and validation checks.
- Decide what must be stored before writing, because adding an array later means rewriting.
Answering in program code
Pseudocode is accepted for every coding answer on Paper 2, the scenario question included, so a student who answers everything in pseudocode loses nothing. Program code is accepted in one place only: the final 15-mark scenario question, where the answer may instead be written in Python, Visual Basic or Java. Anywhere else on the paper program code earns no marks, and in the scenario question so does any other language.
Choosing a language is worth it only if you write it fluently, because the examiners mark the logic, not the syntax, and a language you half know adds mistakes without adding marks. The figures show one small task four ways: input five marks, total them, keep the highest, and output both. The steps are identical in every version; only the way each one is written changes.
Python marks a block by indentation alone, with a colon at the end of the line that opens it, and has no ENDIF or NEXT. A count-controlled loop uses range, which stops before its second number, so range(1, 6) gives the counts 1 to 5. Assignment is written =, a comparison for equality is written ==, and input arrives as text, so int() turns it into a whole number.
Visual Basic declares each variable with Dim and a type, closes each block with its own keyword — End If for an IF, Next for a FOR loop — and reads a typed line with Console.ReadLine(). Java declares a type before each variable, ends every statement with a semicolon and puts each block inside curly brackets; its FOR loop gives the start, the condition to keep going and Count++, which adds 1 to Count.
Whichever is used, comment the answer. The scenario question expects comments that say what each part of the program does, written the way the chosen language writes them: // in pseudocode and Java, # in Python, and an apostrophe in Visual Basic. A comment can sit on its own line before the code it explains, or at the end of a short line, as the figures show.
Worth remembering
- Pseudocode is accepted for every coding answer on Paper 2.
- Python, Visual Basic or Java are accepted only in the final 15-mark scenario question.
- Comments: // in pseudocode and Java, # in Python, an apostrophe in Visual Basic.
- The logic earns the marks, so write in the language you know best.
Worked example
A ticketing task might require category-based prices, a quantity limit and a final total; each rule should appear in the plan.
Practice
Warm-up · not marked
Check your understanding
Answer in your own words, then compare with the worked answer. Nothing here is saved or scored.
Worked answer
Whether the repetition count is known or depends on a condition or sentinel, and what causes it to stop.
Check your method, units and explanation against it.
Marked practice
Set 1 of 5 · easiest first · Checked as you go, with the worked answer. Sign in or create a free account to save your progress.