Applying abstraction to a scenario

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Applying abstraction to a scenario

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A school quiz app needs to store each student's score. Which detail should be kept?
A The colour of the student's school bag, because it is part of the scenario
B The student's score, because the app must show results
2. You are abstracting a bus timetable app. Which detail would you cross out?
A The colour of the bus, because it does not help passengers find times
B The departure time, because it is the same for every bus
3. What is the correct first step when applying abstraction to a scenario?
A Read the description and list the details the solution needs
B Start writing the program code straight away
4. A game scoreboard shows the top players. Which detail is needed?
A The player's favourite food, because it is a detail about the player
B Each player's name and score, because the scoreboard ranks players
5. Which statement about abstraction is correct?
A Details are crossed out when the solution does not need them
B Every detail in the scenario must be kept in case it is useful

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1KEEP: stop names, departure times AREMOVE avatar colour because it does not change the ranking
2REMOVE: bus colour, driver's name BKEEP score because the app must show how many answers are right
3Justify keeping a detail in a school quiz app using 'because' CThese details are not needed by the timetable app, so they are crossed out as irrelevant
4Justify removing a detail from a game scoreboard using 'because' DThese details are needed for a bus timetable app to tell passengers when buses leave, so they are listed as needed
5REMOVE departure times from the bus app EDeparture times are essential to a timetable app, so removing them is wrong. Only details the solution does not need should be crossed out.
6KEEP the quiz writer's favourite colour FThe detail is kept with no 'because' and it is not needed by the quiz app. It should be crossed out, with a reason given.

Definitions

abstract a scenario

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
// Quiz app: keep Score _______ it is used
2.
// Keep: Stop and DepartureTime INPUT ____ OUTPUT DepartureTime
3.
// Scoreboard keeps Points, not the avatar Total _ Total + Points
4.
// Scoreboard keeps Score, not the logo ______ Score
5.
INPUT Answer IF Answer = CorrectAnswer ____ Score ← Score + 1

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A APP: school quiz
B KEEP questions because asked
C REMOVE score because it ranks
D REMOVE font because not needed
Question 2
A APP: bus timetable
B KEEP colour because it looks
C REMOVE colour because unused
Question 3
A APP: game scoreboard
B REMOVE name because players see
C KEEP points because it ranks
D REMOVE avatar because unused
Question 4
A APP: school quiz
B KEEP questions and answers
C KEEP score for each student
D REMOVE answers: not needed
Question 5
A 1 Write the code first
B 2 List details it needs
C 3 Cross out details not needed
D 4 Say because for each choice

Answer Key

Applying abstraction to a scenario
Section A: Quick Questions
Q1
B — The student's score, because the app must show results
Q2
A — The colour of the bus, because it does not help passengers find times
Q3
A — Read the description and list the details the solution needs
Q4
B — Each player's name and score, because the scoreboard ranks players
Q5
A — Details are crossed out when the solution does not need them
Section B: Match the Pairs
Q1
KEEP: stop names, departure times → These details are needed for a bus timetable app to tell passengers when buses leave, so they are listed as needed
Q2
REMOVE: bus colour, driver's name → These details are not needed by the timetable app, so they are crossed out as irrelevant
Q3
Justify keeping a detail in a school quiz app using 'because' → KEEP score because the app must show how many answers are right
Q4
Justify removing a detail from a game scoreboard using 'because' → REMOVE avatar colour because it does not change the ranking
Q5
REMOVE departure times from the bus app → Departure times are essential to a timetable app, so removing them is wrong. Only details the solution does not need should be crossed out.
Q6
KEEP the quiz writer's favourite colour → The detail is kept with no 'because' and it is not needed by the quiz app. It should be crossed out, with a reason given.
Section C: Definitions
Q1
abstract a scenario — Read the scenario, list the details the solution needs and cross out the rest, saying 'because' for each choice (e.g. a bus app keeps times, not bus colour).
Section D: Fill in the Blanks
Q1
// Quiz app: keep Score because it is used
Q2
// Keep: Stop and DepartureTime INPUT Stop OUTPUT DepartureTime
Q3
// Scoreboard keeps Points, not the avatar Total ← Total + Points
Q4
// Scoreboard keeps Score, not the logo OUTPUT Score
Q5
INPUT Answer IF Answer = CorrectAnswer THEN Score ← Score + 1
Section E: Spot the Error
Q1
C — The quiz needs the score to rank students, so it must be kept. The line should start with KEEP, not REMOVE.
Q2
B — Bus colour does not help riders find a bus, so it should be removed. Line 2 should keep the times because riders wait for them.
Q3
B — A scoreboard must show who scored, so the player name is needed. It should be KEEP, not REMOVE.
Q4
D — A quiz cannot mark responses without the answers, so they are needed. The detail to remove is the unrelated room colour.
Q5
A — Abstraction starts by reading the scenario. Writing code comes later, after the needed details are chosen.