Abstraction (7b)

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

Abstraction (7b)

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement best describes abstraction?
A Keeping only the detail that matters for the problem and leaving out the rest
B Including every possible detail about the problem so nothing is missed
2. A tube map shows stations and lines but not the exact distances between stations. Why is this an example of abstraction?
A It is wrong because it leaves out some real-world information
B It keeps the detail travellers need and hides detail they do not need
3. A programmer is making a program to work out a student's average mark. Which detail can be left out by abstraction?
A The student's favourite colour
B The student's marks
4. True or false: A model built using abstraction is simpler than the real thing.
A False
B True
5. Which is a purpose of abstraction?
A Hiding unnecessary detail so the problem is easier to solve
B Removing the essential facts so the program runs faster

Match the Pairs

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

Left columnRight column
1abstraction AAbstraction: exact distances and real street layouts are hidden because travellers do not need them
2A tube map shows stations and lines only BBus timetable app keeps: route number, stop name, departure time
3A model is simpler than the real thing because unnecessary detail has been removed CKeeping only the details that matter for the problem and leaving out the rest
4Abstraction does not mean losing the essential facts: the details needed to solve the problem are kept DModel of a school canteen: menu, price, quantity (no wall colour or room size)
5Abstraction means keeping every detail about the problem EAbstraction is the opposite: it removes unnecessary detail and keeps only what matters for the problem.
6Quiz app abstraction: remove the questions and keep the logo colour FThe essential facts (questions, answers, score) were removed and an irrelevant detail was kept. Abstraction should keep what is needed.

Definitions

abstraction

Fill in the Blanks

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

1.
// ___________ hides unneeded detail
2.
// Tube map keeps stations and lines DECLARE Station : ______
3.
// A model is _______ than the real thing
4.
// Room area: colour is not needed FUNCTION Area(Length, Width) _______ REAL RETURN Length * Width
5.
// Keep essential facts, hide the rest Station _ "Bank" OUTPUT Station

Spot the Error

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

Question 1
A OUTPUT "Start station?"
B input startStation
C OUTPUT startStation
Question 2
A // Tube map model
B stations ← 12
C exactMetres ← 8731
D OUTPUT stations
Question 3
A INPUT busNumber
B IF busNumber = 42
C OUTPUT "Town Centre"
D ENDIF
Question 4
A FUNCTION Label(n : STRING) RETURNS STRING
B RETURN n
C ENDPROCEDURE
D OUTPUT Label("Bank")
Question 5
A count ← 0
B FOR i ← 1 UNTIL 5
C count ← count + 1
D NEXT i
E OUTPUT count

Answer Key

Abstraction (7b)
Section A: Quick Questions
Q1
A — Keeping only the detail that matters for the problem and leaving out the rest
Q2
B — It keeps the detail travellers need and hides detail they do not need
Q3
A — The student's favourite colour
Q4
B — True
Q5
A — Hiding unnecessary detail so the problem is easier to solve
Section B: Match the Pairs
Q1
abstraction → Keeping only the details that matter for the problem and leaving out the rest
Q2
A tube map shows stations and lines only → Abstraction: exact distances and real street layouts are hidden because travellers do not need them
Q3
A model is simpler than the real thing because unnecessary detail has been removed → Model of a school canteen: menu, price, quantity (no wall colour or room size)
Q4
Abstraction does not mean losing the essential facts: the details needed to solve the problem are kept → Bus timetable app keeps: route number, stop name, departure time
Q5
Abstraction means keeping every detail about the problem → Abstraction is the opposite: it removes unnecessary detail and keeps only what matters for the problem.
Q6
Quiz app abstraction: remove the questions and keep the logo colour → The essential facts (questions, answers, score) were removed and an irrelevant detail was kept. Abstraction should keep what is needed.
Section C: Definitions
Q1
abstraction — Keeping only the detail that matters for the problem and hiding the rest, like a tube map showing stations and lines but not exact distances.
Section D: Fill in the Blanks
Q1
// abstraction hides unneeded detail
Q2
// Tube map keeps stations and lines DECLARE Station : STRING
Q3
// A model is simpler than the real thing
Q4
// Room area: colour is not needed FUNCTION Area(Length, Width) RETURNS REAL RETURN Length * Width
Q5
// Keep essential facts, hide the rest Station ← "Bank" OUTPUT Station
Section E: Spot the Error
Q1
B — Cambridge pseudocode keywords must be written in capitals. In this tube map model the station name is the detail kept, and the line should be INPUT startStation.
Q2
C — A tube map uses abstraction. It keeps stations and lines but hides exact distances. Storing exact metres keeps unnecessary detail, so the line should be tubeLines ← 3.
Q3
B — An IF statement needs the keyword THEN after the condition. The bus display model only needs the number and destination, and the line should be IF busNumber = 42 THEN.
Q4
C — A FUNCTION must be closed with ENDFUNCTION, not ENDPROCEDURE. This function returns only the station name and hides the rest of the detail.
Q5
B — A FOR loop uses TO to give the end value, not UNTIL. UNTIL belongs to REPEAT loops. The line should be FOR i ← 1 TO 5.