Deciding which details to keep and which to ignore

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

Deciding which details to keep and which to ignore

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A library system records who borrowed a book. Which detail should it keep?
A The borrower's name
B The colour of the book's cover
2. Which statement about abstraction is correct?
A Keep every detail so nothing is missed
B Keep the details the solution needs and ignore the rest
3. A library system stores the book title but not the borrower. What is the problem?
A Too little detail, so it cannot show who has the book
B Too much detail, so the system is slow to understand
4. A library system also stores each book's weight, cover colour and the author's favourite food. What is the effect?
A Too much detail makes the problem harder to solve
B More detail always makes the solution better
5. A school timetable program is being designed. Which detail is irrelevant to it?
A The time of each lesson
B A teacher's favourite colour

Match the Pairs

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

Left columnRight column
1abstraction ARemove a detail that does not help the solution work, such as the colour of a library book
2IF detail NOT needed THEN IGNORE it BToo much detail: colour, weight and cover art are not needed, so the problem is harder than it should be
3A library system needs the book title and the borrower to record a loan, so these details are kept Cloan <- [bookTitle, borrowerName]
4The book's colour is irrelevant to lending, so it is left out of the record DToo little detail: the borrower is missing, so the system cannot tell who has the book and the solution fails
5loan <- [bookTitle] Ebook <- [title, author] // no colour
6loan <- [title, borrower, colour, weight, coverArt] FKeeping only the details the solution needs to work and ignoring the rest

Definitions

abstraction

Fill in the Blanks

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

1.
_____ BookTitle
2.
Borrower _ "Mia"
3.
INPUT BookTitle OUTPUT _________
4.
IF DaysLate _ 0 THEN OUTPUT "Fine due" ENDIF
5.
PROCEDURE CheckOut(Borrower, BookTitle) OUTPUT Borrower, BookTitle ____________

Spot the Error

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

Question 1
A DECLARE Title : STRING
B DECLARE Borrower : STRING
C INPUT Title
D INPUT BookColour
Question 2
A INPUT Title
B INPUT Borrower
C OUTPUT Title, Colour
Question 3
A INPUT Available
B IF Available = TRUE
C OUTPUT "Can borrow"
D ENDIF
Question 4
A Fine = 0
B INPUT DaysLate
C Fine ← DaysLate * 0.5
D OUTPUT Fine
Question 5
A INPUT Distance
B INPUT Age
C Price ← Distance * 0.2
D IF Age < 16 DO
E Price ← Price / 2
F ENDIF

Answer Key

Deciding which details to keep and which to ignore
Section A: Quick Questions
Q1
A — The borrower's name
Q2
B — Keep the details the solution needs and ignore the rest
Q3
A — Too little detail, so it cannot show who has the book
Q4
A — Too much detail makes the problem harder to solve
Q5
B — A teacher's favourite colour
Section B: Match the Pairs
Q1
abstraction → Keeping only the details the solution needs to work and ignoring the rest
Q2
IF detail NOT needed THEN IGNORE it → Remove a detail that does not help the solution work, such as the colour of a library book
Q3
A library system needs the book title and the borrower to record a loan, so these details are kept → loan <- [bookTitle, borrowerName]
Q4
The book's colour is irrelevant to lending, so it is left out of the record → book <- [title, author] // no colour
Q5
loan <- [bookTitle] → Too little detail: the borrower is missing, so the system cannot tell who has the book and the solution fails
Q6
loan <- [title, borrower, colour, weight, coverArt] → Too much detail: colour, weight and cover art are not needed, so the problem is harder than it should be
Section C: Definitions
Q1
abstraction — Keep only the details the solution needs to work and ignore the rest. A library system needs the book title and borrower, not the book's colour. Too few details fails; too many makes it harder.
Section D: Fill in the Blanks
Q1
INPUT BookTitle
Q2
Borrower ← "Mia"
Q3
INPUT BookTitle OUTPUT BookTitle
Q4
IF DaysLate > 0 THEN OUTPUT "Fine due" ENDIF
Q5
PROCEDURE CheckOut(Borrower, BookTitle) OUTPUT Borrower, BookTitle ENDPROCEDURE
Section E: Spot the Error
Q1
D — The library system needs the borrower, so Borrower must be input. The book's colour is an irrelevant detail, and Borrower is never given a value. It should be INPUT Borrower.
Q2
C — Colour is an irrelevant detail that was never input. The loan record needs the title and the borrower, so it should be OUTPUT Title, Borrower.
Q3
B — Whether the book is available is a relevant detail, and the program uses it in a decision. Every IF needs the keyword THEN, so it should be IF Available = TRUE THEN.
Q4
A — The fine only needs the number of days late, and the book's colour is ignored. Cambridge pseudocode uses the assignment arrow ←, so the line should be Fine ← 0.
Q5
D — The ticket price only needs the distance and the age, not the bus colour. An IF statement must use THEN, not DO. It should be IF Age < 16 THEN.