Decomposing a problem into sub-problems

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

Decomposing a problem into sub-problems

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which best describes decomposition?
A Splitting a big problem into smaller sub-problems
B Making a problem bigger so it is harder to solve
2. A class wants an app to track canteen orders. Which is a sensible first step?
A Break it into sub-problems like taking orders, working out the total and showing the receipt
B Try to solve the whole app in one go without any plan
3. In a quiz app, which sub-problem is the INPUT?
A The student types in their answer
B The app shows 'Correct!' on the screen
4. In a quiz app, which sub-problem is the PROCESS?
A The student taps the answer button
B Checking if the answer matches the right one
5. In a step counter app, which sub-problem is the OUTPUT?
A Counting each step from the sensor
B Displaying the total steps on the screen

Match the Pairs

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

Left columnRight column
1decomposition AShowing the score is an output sub-problem, not an input. Input is getting the player's answer.
2input, process, output BThree kinds of sub-problems: getting data in, working with it, and showing the result
3Sub-problems that are independent can be solved separately by different people CThis does not split the problem into smaller parts. It should be split into sub-problems like input (answers), process (check score) and output (show result).
4After solving each sub-problem, combine the solutions to solve the whole problem DSub-problem A: design the quiz questions Sub-problem B: design the score screen
5Decompose a quiz app: 1. Make the whole app at once ESplitting a big problem into smaller sub-problems that can each be solved on their own
6Sub-problems: Input = the score is shown on screen FCombine: menu + order form + receipt = canteen ordering app

Definitions

decomposition

Fill in the Blanks

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

1.
Problem: Make a quiz score app Sub-problem 1: _____ the answers Sub-problem 2: Process the score
2.
Sub-problem 1: Input the answers Sub-problem 2: _______ the score Sub-problem 3: Output the result
3.
Input: type in the quiz answers Process: add up the correct answers ______: show the final score
4.
Problem: Plan a class party _________ into: food, music, invites Solve each part on its own
5.
Sub-problem A: solved on its own Sub-problem B: solved on its own solution = _______(A, B)

Spot the Error

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

Question 1
A COMBINE Quiz App
B INPUT: read the answer
C PROCESS: check the answer
D OUTPUT: show the score
Question 2
A DECOMPOSE Weather App
B INPUT: get the city name
C PROCESS: find the forecast
D OUTPUT: get the city name
E END
Question 3
A DECOMPOSE Canteen Orders
B PROCESS: read the order
C PROCESS: add up the cost
D OUTPUT: print the receipt
Question 4
A SUB A: design the board
B SUB B: write the rules
C A must wait for B to finish
D Combine A and B at the end
Question 5
A SUB A: count the votes
B SUB B: make the chart
C COMBINE A and B before solving
D Result: one working program

Answer Key

Decomposing a problem into sub-problems
Section A: Quick Questions
Q1
A — Splitting a big problem into smaller sub-problems
Q2
A — Break it into sub-problems like taking orders, working out the total and showing the receipt
Q3
A — The student types in their answer
Q4
B — Checking if the answer matches the right one
Q5
B — Displaying the total steps on the screen
Section B: Match the Pairs
Q1
decomposition → Splitting a big problem into smaller sub-problems that can each be solved on their own
Q2
input, process, output → Three kinds of sub-problems: getting data in, working with it, and showing the result
Q3
Sub-problems that are independent can be solved separately by different people → Sub-problem A: design the quiz questions Sub-problem B: design the score screen
Q4
After solving each sub-problem, combine the solutions to solve the whole problem → Combine: menu + order form + receipt = canteen ordering app
Q5
Decompose a quiz app: 1. Make the whole app at once → This does not split the problem into smaller parts. It should be split into sub-problems like input (answers), process (check score) and output (show result).
Q6
Sub-problems: Input = the score is shown on screen → Showing the score is an output sub-problem, not an input. Input is getting the player's answer.
Section C: Definitions
Q1
decomposition — Splitting a big problem into smaller sub-problems, such as input, process and output. Each part can be solved on its own, then the solutions are combined.
Section D: Fill in the Blanks
Q1
Problem: Make a quiz score app Sub-problem 1: Input the answers Sub-problem 2: Process the score
Q2
Sub-problem 1: Input the answers Sub-problem 2: Process the score Sub-problem 3: Output the result
Q3
Input: type in the quiz answers Process: add up the correct answers Output: show the final score
Q4
Problem: Plan a class party Decompose into: food, music, invites Solve each part on its own
Q5
Sub-problem A: solved on its own Sub-problem B: solved on its own solution = combine(A, B)
Section E: Spot the Error
Q1
A — The first step is to split the big problem into smaller parts, so the line should start with DECOMPOSE. COMBINE is what you do later, once the parts are solved.
Q2
D — Getting the city name is an input sub-problem, not an output. The output sub-problem should show the weather to the user.
Q3
B — Reading the order is an input sub-problem. The process sub-problem should do the work on the data, such as adding up the cost.
Q4
C — Independent sub-problems can each be solved on their own. A should not need to wait for B, so the line should say A can be solved without B.
Q5
C — You combine the solutions after each sub-problem has been solved. The line should say COMBINE A and B at the end.