Computational Thinking: Planning Solutions Before Coding

Learn to plan solutions the way computer scientists do. Define a problem clearly, break it into smaller parts, spot patterns, focus on the details that matter and build simple models of real situations. Then write precise algorithms with sequence, selection and repetition, trace and debug them, and judge which solution works best, with or without a computer.

Grade 6, Grade 9Lesson 1 of 10 in Computing for Ages 11 to 14 Course

What you will learn

  1. Explain what computational thinking is and why a plan comes before code, and turn a vague real-world situation into a clearly defined problem.
    • Explain what computational thinking is
      Describe the four core practices of computational thinking, show how people use them with or without a computer, and explain why planning comes before coding.
    • Define a problem before solving it
      State what a problem is really asking: the goal, the users, the inputs and outputs, the requirements and constraints, and success criteria that can be tested.
  2. Decompose a large problem into sub-problems that can be solved one at a time, record them in a diagram, and work out how the parts fit back together.
    • Decompose a problem into sub-problems
      Split a problem into smaller parts, keep splitting until each part is easy to solve, and show the result in a decomposition diagram.
    • Connect sub-problems into a working whole
      Work out which parts depend on others, what information passes between them, and how solving and testing parts separately leads to one complete solution.
  3. Spot patterns that let one solution work for many cases, decide which details matter for a purpose, and build simple models of real situations.
    • Recognize and use patterns
      Find similarities within and between problems, turn a repeated pattern into a general rule, and reuse solutions instead of starting from scratch.
    • Use abstraction to focus on what matters
      Decide which details a solution needs for its purpose, leave out or hide the rest, and tell general information apart from specific information.
    • Model real situations
      Build a simple model of a real situation by choosing what to represent, describing its state and the rules for how it changes, and checking its predictions against reality.
  4. Write precise algorithms with sequence, selection, iteration, variables and constants; trace them with test inputs; and find and fix errors.
    • Write precise algorithms
      Explain what an algorithm is, write clear, unambiguous steps, and represent an algorithm as numbered steps, a flowchart, pseudocode or blocks.
    • Build algorithms from sequence, selection and iteration
      Combine the three basic building blocks with variables, constants and subroutines to write algorithms that make decisions and repeat steps.
    • Trace, test and debug algorithms
      Follow an algorithm step by step in a trace table, choose test inputs with expected results, and find and correct errors.
  5. Combine all the practices to plan a complete solution, unplugged or on screen, then evaluate it against its success criteria and compare alternative designs.
    • Plan a complete solution from problem to algorithm
      Take a real problem through definition, decomposition, pattern recognition, abstraction and algorithm design, and record the plan so a team can build and test it.
    • Evaluate and improve a solution
      Judge a solution against its success criteria and user stories, compare alternative algorithms for correctness, efficiency and clarity, and improve the design in small cycles.

Computational Thinking study guide

5 chapters

1

Use computational thinking to plan solutions

A useful plan begins with a clear question. You need to know who has the problem and what a successful result looks like. Computational thinking gives you ways to organize that work before choosing a device or writing code. A class event, a paper reminder system, and a game can all start with the same planning skills.

1.1 Explain what computational thinking is

Computational thinking means describing a problem and its solution clearly enough to carry out. A person, a computer, or both can follow the plan. Computer scientist Jeannette Wing helped make the term widely known in a 2006 essay.

Four practices that work together
PracticeWhat you do
DecompositionSplit a large problem into smaller parts.
Pattern recognitionFind similarities and repeated work.
AbstractionKeep the details needed for your purpose.
Algorithm designWrite precise instructions or rules.

These practices are not steps you must finish in one fixed order. While writing instructions, you may notice a missing part. You then return to decomposition. Some courses also name generalization, turning patterns into wider rules, and evaluation, judging a solution.

Plan a class bake sale

Start by splitting the job: choose products, set prices, make signs, handle money, and clean up. Each part now has a smaller goal.

Next, notice a pattern. Each product needs ingredients, baking, packaging, and a label. One checklist can serve several products.

For pricing, keep the ingredient cost and number of items. Plate color does not affect this pricing rule, so leave it out. That choice is abstraction.

Now write the pricing algorithm: "Divide the ingredient cost by the number of items. Round up to the next 25 cents. Add 50 cents." For brownies costing $9.00 for 24 pieces:

  1. Divide $9.00 by 24 to get $0.375 per piece.
  2. Round up to $0.50.
  3. Add $0.50, giving a selling price of $1.00.
Carry out the plan

Programming, or coding, writes instructions in a language a computer can run. Scratch uses blocks; Python uses text. The plan can exist before either program.

An unplugged task uses no device. You might sort cards or give a classmate drawing instructions. Bebras puzzles also exercise these skills. An on-screen task might turn the plan into a Scratch game. Both need clear reasoning.

Planning also makes mistakes easier to find before much code depends on them. A diagram or written algorithm lets teammates discuss the same idea and share jobs. If everyone starts coding from a different idea, the finished parts may not fit.

A computer follows the instructions it receives. It does not supply the missing steps in your plan.

Key Takeaways

  • Computational thinking makes problems and solutions clear enough to carry out.
  • Decomposition, pattern recognition, abstraction, and algorithm design support each other.
  • The practices can be revisited as a plan changes.
  • Planning helps people find errors and share work before coding.
  • Unplugged and on-screen tasks use the same thinking skills.

1.2 Define a problem before solving it

"The class library is a mess" names a concern, but it leaves much unanswered. Are books hard to find? Are loans missing? Defining the problem turns that concern into a clear goal for named users.

Ask questions before choosing a solution

For forgotten homework, ask who needs help, what they forget, and when they need a reminder. Then ask smaller questions: Which subjects? Who enters the due dates? Can students already check a shared board?

The answers may support a paper planner, a classroom board, or an app. Choosing an app first can hide the actual need. Keep the goal narrow enough to finish, such as helping seventh graders see tomorrow’s homework in one place.

Follow information through the solution

For a homework reminder:

PartExample
Input: information receivedHomework title, subject, due date
Processing: work done with itCompare due dates with tomorrow’s date
Output: result producedA list of homework due tomorrow

This helps you see what information must be available. A reminder cannot choose tomorrow’s assignments if it receives no due dates.

Separate needs from limits

A requirement says what the solution must do: "Show every homework item due tomorrow." A constraint limits the solution: "Run on school tablets," "Cost nothing," or "Be ready in three weeks." Requirements and constraints form the design criteria.

A user story describes a need from someone’s point of view:

"As a seventh grader, I want tomorrow’s homework in one list so that I can plan my evening."

It names the user, the goal, and the reason. A parent might need a weekly summary instead. Those are different stories, even if one solution serves both.

Make success something you can check

"Easy to use" leaves people judging different things. "A student can add an assignment in under 30 seconds" gives a measurable check. "Every item due tomorrow appears in the list" gives another.

Write success criteria before building. For each one, decide what evidence would show it has been met. You could time a student adding an item, then compare the reminder list with a prepared list of due dates.

At the start, the problem definition tells you what work to split into parts. At the end, the same stories and criteria guide testing and evaluation. A broad aim such as "fix homework" needs narrowing before either job is possible.

Key Takeaways

  • Define the goal and users before choosing a solution.
  • Name inputs, processing, and outputs.
  • Requirements describe needed behavior; constraints set limits.
  • A user story connects a user, a goal, and a reason.
  • Success criteria make needs testable.
  • Use the problem definition to guide both planning and evaluation.
2

Break problems into manageable parts

A large task becomes easier when each part has a clear job. Some parts can be solved separately, while others need information from elsewhere. Breaking up a problem is only half the work: the parts must also fit together. Diagrams and a few agreed data values help a team share the work and find missing pieces.

2.1 Decompose a problem into sub-problems

Decomposition breaks a problem or system into smaller parts. Each sub-problem has a goal you can understand, solve, and check. Combining those smaller solutions completes the larger job.

Build a decomposition tree

Write the whole problem at the top. Under it, name the main parts. Ask whether each part is small enough to solve directly. If it still hides several jobs, split it again.

For "Make a quiz game," the first branches could be:

  • Show the questions.
  • Check each answer.
  • Keep score.
  • Show the final result.

The "Check each answer" branch can split further:

  • Get the player’s answer.
  • Compare it with the correct answer.
  • Show "Correct!" or display the right answer.

A decomposition diagram shows these branches as a tree. The lines mean "this is part of that job." They do not show which instruction runs next. An algorithm will supply the order.

Find parts at a useful size

"Make the game" is too large to hand someone as a clear task. "Press a key" is usually too small to deserve its own branch. "Check an answer" has a useful goal, with a short set of steps behind it.

The right size depends on what the team understands. If nobody knows how to handle answers, split that branch until the work is clear. Stop when each part can be solved with a clear step or short algorithm.

Use the same approach away from a screen

A museum trip can have five main parts:

PartSmaller jobs
TransportationBook a bus; agree on departure and return times
MoneyCalculate the cost per student; collect payments
PermissionSend and collect permission slips
ScheduleChoose exhibits; plan lunch
SafetyForm groups; assign adult chaperones

Different people can take responsibility for different branches. Decomposition also works for systems: a bicycle has a frame, wheels, brakes, and gears. Understanding a part helps you locate a repair or improvement.

Check that nothing is missing

Go back to every requirement and user story. Find the branch that serves each one. If a quiz player must see a final score, "Keep score" alone is insufficient: something must display it.

Testing parts separately also narrows the search for errors. If answer checking works but the score is wrong, you can inspect scoring and the connection between them. You do not need to restart every part of the game.

Key Takeaways

  • Give each sub-problem one clear goal.
  • Split a part again when its solution is still unclear.
  • A decomposition tree shows parts, not the order of instructions.
  • Check every requirement against the branches.

2.2 Connect sub-problems into a working whole

Separate parts need clear connections. One part may produce information that another part needs. A dependency exists when a part needs another part’s result.

Follow outputs into inputs

In a quiz, checking an answer produces "correct" or "incorrect." The scoring part receives that result and updates a number. The result display receives the final score.

Agree on exactly what each part sends and receives:

PartReceivesProduces
Check an answerPlayer’s answer and correct answerCorrect or incorrect
Keep scoreCorrect or incorrectUpdated whole-number score
Show the resultFinal whole-number scoreA score message

If one teammate sends the word "five" but another expects the number 5, both parts may work alone and still fail together. Agreeing on the data early prevents that mismatch.

Work out what must be known first

For a trip, collecting payments depends on knowing the cost per student. The bus costs $450. Tickets cost $8 each for 25 students.

  1. Ticket cost: 25 times $8 gives $200.
  2. Total cost: $450 plus $200 gives $650.
  3. Cost per student: $650 divided by 25 gives $26.

Now payments can be collected at the correct amount. Booking transport and designing permission slips can be independent jobs: neither needs the other’s result.

A program part can be built before its supplier is ready. To test a score display, provide a sample score of 4. That checks the display without waiting for the scoring part. When the full game runs, the real score must arrive from scoring.

Combine parts a little at a time

First check each part alone with known inputs. Then connect two parts and check the information passed between them. Add the next part when that connection works.

If scoring accepts a sample "correct" result but fails with the answer checker, inspect their connection. Perhaps one part sends "Correct" while the other expects a different value. Waiting until every part is built makes such problems harder to locate.

Reuse a named set of steps

A subroutine is a named group of steps written once and called when needed. Many languages use the names procedure or function. A quiz can call "Check an answer" for every question.

Recognizing that question 1 and question 2 need the same checking process links decomposition to pattern recognition. The data changes; the steps can stay the same. One shared subroutine also gives you one place to fix a checking error.

Key Takeaways

  • A dependency means one part needs another part’s result.
  • Agree on the values passed between parts.
  • Independent jobs can be done in either order or together.
  • Sample values let you test a program part before its supplier is ready.
  • Combine and test parts gradually.
  • A subroutine gives repeated work one reusable name.
3

Find patterns and use abstraction to model the world

Similar problems often share a useful rule. Finding that rule can save work, but you still need to decide which details matter. A simple model combines those choices with rules for change. You can then explore a real situation, predict a result, and compare the prediction with what actually happens.

3.1 Recognize and use patterns

Pattern recognition means noticing similarities within a problem or between problems. Repeated steps, matching calculations, and trends in data can suggest a solution you can reuse.

Turn repeated steps into a loop

A drawing sprite makes a square by moving forward 50 steps and turning right 90 degrees. It performs that pair of actions four times:

REPEAT 4 TIMES
  MOVE FORWARD 50 STEPS
  TURN RIGHT 90 DEGREES
END REPEAT

The loop expresses the repeated pair once. Changing the length now requires one edit, without changing eight separate instructions.

Find what changes between cases

A regular polygon has equal sides and equal angles. A sprite drawing one makes a full turn overall: 360 degrees. Divide that turn equally among its corners:

turn angle=360∘÷number of sides

A triangle needs 120 degrees per turn, a square 90 degrees, and a hexagon 60 degrees. The sprite turns through the outside angle at each corner.

Generalization turns this pattern into a rule for many cases. Repeat once per side, moving the chosen length and turning by 360 divided by the number of sides. The values that change can become parameters: inputs to a subroutine such as drawShape(sides, length).

Look for shared calculations

Five movie tickets at $8 each cost $40. Three pizzas at $12 each cost $36. The objects differ, but both use:

total=number of items×price per item

One algorithm can receive the count and price as inputs. It does not need a new set of steps for each product.

Patterns also appear in data. The numbers 3, 7, 11, 15 increase by 4. Adding 4 gives the next number, 19. A direct rule gives the value at any position:

value=position×4−1

Position 1 gives 3. Position 5 gives 19. Position 100 gives 399 without listing the earlier values.

Check the rule before using it

The start 1, 2, 4 can fit different rules. Doubling continues with 8, 16. Adding 1, then 2, then 3, then 4 continues with 7, 11. More examples or a reason for the rule helps decide what pattern is intended.

Key Takeaways

  • Patterns can occur in steps, data, and different problems.
  • Repeated steps can become a loop.
  • Generalization makes a rule useful across cases.
  • Parameters supply the values that change.
  • Check a proposed pattern with more cases or a reason behind it.

3.2 Use abstraction to focus on what matters

Abstraction focuses on the information needed for a purpose. It leaves out or hides other details so you can work with a simpler description. You must still be precise about the details you keep.

Let the purpose choose the details

Harry Beck’s 1933 London Underground map showed stations, their order on lines, and places to change trains. Straight lines at a few angles made the routes easier to follow. Station spacing did not show real distances.

That abstraction helps plan a train journey. It cannot reliably tell you how far to walk. A cycling map needs bike lanes and hills. A delivery map needs addresses and one-way streets. A detail can matter for one purpose and be unnecessary for another.

Choose data for a bus seat plan

The goal is to assign suitable seats without booking any seat twice. Start with the details available:

KeepWhy it matters
Seat numbersIdentify each seat
Free or booked statusPrevent a second booking
Student namesShow who has each booking
Accessible-seat informationMatch seats to students who need them

Seat color and the driver’s name do not help make these bookings. Leave them out of this plan.

Now check the smaller description against the goal. Can it identify a free seat, make a booking, and meet access needs? Dropping accessible-seat information would make the description too simple. A student who needs such a seat could receive an unsuitable one.

Describe a whole kind of case

"Jordan’s locker code is 4-7-2" is specific information about one locker. "A locker code has three digits, each from 0 to 9" is general information about the whole kind of code.

There are 10 choices for each digit, including a leading zero:

10×10×10=1,000

The possible codes run from 000 to 999. A general code checker needs the three-digit rule, not Jordan’s particular code.

Hide details behind a useful name

A variable named score represents the score’s current value. A subroutine named drawSquare(size) lets you request a square without reading every drawing step. A "Save" button similarly hides the storage steps from its user.

These are levels of abstraction. "Make a quiz game" is high level. "Check each answer" is a smaller, middle-level job. "Compare typed text with the stored answer" is lower level. Decomposition creates the parts; abstraction lets you think about one level without tracking every detail below it.

Key Takeaways

  • Choose details by the purpose of the solution.
  • Check that simplifying has kept every detail needed by the users.
  • General information describes a kind of case; specific information describes one case.
  • Names and subroutines can hide lower-level steps.

3.3 Model real situations

A model is a simplified representation of a real object or situation. It keeps the features needed to answer a question. A simulation runs a model step by step to explore what happens over time.

Describe a state and rules for change

A model’s state is its values at one moment. Its behavior is the set of rules that changes those values. To build a model:

  1. State the question.
  2. Choose the quantities to represent and name them.
  3. Set their starting values.
  4. Write the rules that change them.
  5. Run the rules step by step and record the values.
  6. Compare predictions with real observations.
Model a phone battery

The battery starts at 80%. Gaming uses 15 percentage points each hour. How many full hours pass before the level drops below 20%?

Hours playedPredicted battery level
080%
165%
250%
335%
420%
55%

Each row uses the previous level minus 15. At four hours, the level equals 20%; it is not below 20%. The model therefore allows four full hours before it drops below that level during hour five.

The rule assumes the same use each hour. A brighter screen could use more battery. If the real level after three hours is 30%, the prediction of 35% was too high. The observed average use is:

(80−30)÷3≈17

Try a rule of about 17 percentage points per hour, then test it with new observations.

Model savings

A student starts with $10. Each week, $5 arrives and $2 goes on snacks. The weekly change is $3.

After week 1, the balance is $13. After week 8, it is $34. Headphones cost $40. Week 9 gives $37; week 10 gives $40, so the student can buy them after ten weeks.

This model assumes the weekly income and spending stay fixed. A gift or skipped snack changes the real balance. Assumptions are the conditions the model treats as true; they help you judge when its prediction will be useful.

Choose enough detail to answer the question

A cafeteria-line model needs arrival times and service times to predict waiting. Tray colors do not help with that question. More detail takes more work to build and check, so keep what affects the prediction.

A board game can model traffic without a computer. A spreadsheet can record one row per week. A Scratch simulation can update a pond’s fish count. Each needs a starting state, clear rules, and checks against the situation it represents.

Key Takeaways

  • A model keeps features needed for a question or prediction.
  • State describes current values; behavior describes rules for change.
  • Run rules from the stated starting values and record the results.
  • Assumptions identify what the model treats as true.
  • Compare predictions with real observations and revise the model.
  • More detail is useful only when it helps answer the question.
4

Design, trace and debug algorithms

A plan becomes an algorithm when its instructions are precise enough to follow. Order, decisions, and repetition let a short plan handle many inputs. Following the steps by hand shows how values change and where errors begin. Carefully chosen tests help you check ordinary cases and the edges where behavior changes.

4.1 Write precise algorithms

An algorithm is a finite set of precise, unambiguous instructions or rules for a task. It starts clearly, follows a definite order, and finishes with a result. Someone following it should not have to guess the missing details.

Make an instruction precise

"Put peanut butter on bread" leaves several choices open. A clearer version is:

  1. Open the jar.
  2. Take about one spoonful with the knife.
  3. Spread it over one side of one slice of bread.

For a movement task, replace "walk a little way" with "walk 20 steps." For repetition, replace "a few times" with "3 times." In an unplugged task, another person can follow the instructions literally to reveal gaps.

Follow a decision to a result

To find the larger of two numbers:

INPUT a
INPUT b
IF a > b THEN
  OUTPUT a
ELSE
  OUTPUT b
END IF

For 7 and 12, the condition is false, so the output is 12. For 5 and 5, it is also false: the second 5 is output. That still gives the largest value, since both values are equal.

Choose a way to show the steps
FormHow it shows an algorithm
Numbered stepsPlain-language instructions in order
FlowchartShapes joined by arrows
PseudocodeShort, structured statements like the example above
BlocksConnected instructions, as in Scratch

In a simple flowchart, an oval or rounded rectangle marks start or end. A rectangle shows processing. A diamond holds a decision, with labeled "Yes" and "No" paths. A parallelogram shows input or output. Arrows show where to go next.

Pseudocode has no single official style. Clear, consistent statements matter because another person must be able to follow the plan. A program expresses algorithms in a programming language a computer can run. The same plan can be carried out in different languages or followed by a person.

Give repetition a way to finish

"Keep stirring" never says when to stop. A loop needs a fixed count or a reachable stopping condition. "Stir for 30 seconds" gives a limit.

A WHILE loop stops when its condition becomes false. A REPEAT UNTIL loop stops when its condition becomes true. The repeated steps must be able to reach that stopping point.

Several algorithms can solve one problem. Directions using stairs and directions using an elevator can both reach a library. Their suitability depends on the user: a student on crutches may need the elevator route.

Key Takeaways

  • An algorithm needs precise steps and a finish.
  • Algorithms can be represented in steps, flowcharts, pseudocode, or blocks.
  • A program writes algorithms in a runnable language.
  • A loop must have a fixed count or a reachable stopping point.
  • Different correct algorithms can serve different user needs.

4.2 Build algorithms from sequence, selection and iteration

Algorithms combine three basic structures: sequence, selection, and iteration. Named values keep track of what changes, while subroutines let you reuse a group of steps.

Order and decisions

Sequence carries out steps one after another. Put socks on before shoes. Even correct instructions can fail in the wrong order.

Selection chooses steps using a condition that is true or false. Comparisons include =, <, >, <=, and >=. The last two mean "less than or equal to" and "greater than or equal to."

For movie tickets, under-13s pay $8, people aged 65 and over pay $9, and everyone else pays $12:

IF age < 13 THEN
  SET price TO 8
ELSE IF age >= 65 THEN
  SET price TO 9
ELSE
  SET price TO 12
END IF

Age 12 gives $8. Ages 13 and 40 give $12. Age 65 gives $9. Conditions are checked from the top, and the first true condition chooses the branch. Changing < 13 to <= 13 would wrongly include age 13 in the cheaper group.

Repeat the right steps

Iteration repeats work. A count-controlled loop has a fixed number of repetitions, such as REPEAT 4 TIMES. A condition-controlled loop depends on a changing condition, such as WHILE lives > 0.

Use a fixed count when you know how many repetitions are needed. Use a condition when the number depends on what happens. A repeated pair of drawing instructions can be edited once inside a loop, avoiding separate copies.

Store values with names

A variable stores a value that can change. SET score TO 0 gives a starting value. SET score TO score + 1 reads the current score, adds one, and stores the new score.

Values have data types. An integer is a whole number, such as 42. A string holds text, such as "Ana." A Boolean is true or false.

A constant is a named value that stays the same during a run. CONSTANT MAX_LIVES = 3 makes the limit easy to recognize. Capital letters are a common naming habit, not a universal language rule.

Combine the structures
SET score TO 0
REPEAT 5 TIMES
  SHOW NEXT QUESTION
  INPUT answer
  IF answer = correctAnswer THEN
    SET score TO score + 1
  END IF
END REPEAT
OUTPUT score

The starting value comes before the loop. Only a correct answer changes the score. The final output comes after all five questions. Moving that output inside the loop would show a score after every answer.

Reset the score at the start of each game. Scratch can retain a value from the previous game. Python reports an error if you use a name that has never received a value.

A subroutine such as drawSquare(size) stores reusable steps. The parameter size supplies the changing length. At a call, follow the subroutine with that value, then return to the instruction after the call.

Key Takeaways

  • Sequence fixes order; selection chooses a branch; iteration repeats work.
  • Choose a fixed-count or condition-controlled loop to match the task.
  • A variable has a name, a value, and a data type.
  • A constant keeps the same value during a run.
  • Initialize variables before using them.
  • A loop’s boundaries determine which steps repeat.
  • A subroutine call uses its parameters, then returns to the calling algorithm.

4.3 Trace, test and debug algorithms

Tracing means following an algorithm by hand, one step at a time. Record the values as they change. A trace table makes it easier to spot where the actual steps stop matching the intended result.

Trace a running total
SET total TO 0
SET n TO 1
WHILE n <= 4
  SET total TO total + n
  SET n TO n + 1
END WHILE
OUTPUT total
Point reachedtotaln
Start01
After pass 112
After pass 233
After pass 364
After pass 4105

Each pass adds the current value of n, then increases n. When n becomes 5, the condition is false. The output is 10, the sum of 1, 2, 3, and 4.

Do not jump straight to the intended answer when tracing. Follow the written steps, including errors. A table is useful because it shows the point where a wrong value first appears.

Choose tests before running them

Testing compares actual results with expected results worked out beforehand. Include:

  • Normal data: an ordinary valid input.
  • Boundary data: values around an edge where behavior changes.
  • Unexpected data: an empty answer, an impossible value, or the wrong kind of input.

For the ticket rule, age 30 should cost $12. Ages 12 and 13 should cost $8 and $12. Ages 64 and 65 should cost $12 and $9. These boundary pairs check both price changes.

Age −5 should be rejected. Without an extra check, age < 13 accepts it and charges $8. A normal test alone would miss this problem.

Find and repair a bug

An algorithm meant to display 1 through 10 says:

SET count TO 1
WHILE count < 10
  OUTPUT count
  SET count TO count + 1
END WHILE

It shows 1 through 9. Once count is 10, the test fails before output. Change the condition to count <= 10, or count < 11. This is an off-by-one error: the loop runs once too few.

To debug, find an input that reliably produces the error. Trace to the first unexpected value. Suggest a cause, change one thing, and repeat that test. Then rerun earlier tests to check that the repair has not broken working behavior.

Explaining each instruction aloud can expose a missing step. The same method works with a classmate following drawing instructions. Passing varied tests increases confidence, but an untried input can still reveal a bug.

Key Takeaways

  • Trace the written instructions and record changing values.
  • Work out expected results before testing.
  • Use normal, boundary, and unexpected inputs.
  • Find the first wrong value before choosing a repair.
  • Change one thing, retest it, and rerun earlier tests.
5

Solve and improve real problems with computational thinking

A complete solution brings planning, algorithms, and testing together. The goal is to meet the users’ needs, including awkward cases such as ties or missing data. A recorded plan helps a team build the parts. Evidence from tests and users then guides the next change and helps you compare possible solutions.

5.1 Plan a complete solution from problem to algorithm

A complete plan connects the users’ goal to smaller jobs, useful data, algorithms, and tests. Its stages can overlap. A test that reveals a missing case may send you back to the problem definition or decomposition.

Define a recycling challenge

Homerooms collect cans each school day. The student council needs weekly totals and a winner. A useful story is:

"As a student council member, I want the weekly can totals so that I can announce the winning homeroom on Friday."

Success criteria require each homeroom’s total, the winner, and a tie message whenever several homerooms share the highest total.

Split the work and find shared steps

The main parts are recording daily counts, totaling each homeroom, finding the highest total, and displaying results. Every homeroom needs the same five-day addition. One loop or subroutine can handle that repeated job.

Keep homeroom names and daily counts. The can brands and the people who carry the bags do not affect the totals. That abstraction tells the team what data to record.

Test the plan with a tie
HomeroomDaily countsWeekly total
Room 1212, 15, 9, 14, 1060
Room 1420, 8, 11, 13, 961
Room 1510, 10, 18, 12, 1161

A first algorithm remembers one winner. It replaces that winner only when it finds a greater total. Room 14 replaces Room 12, but Room 15 does not replace Room 14: 61 is not greater than 61. The algorithm misses a required tie.

Fix the design by keeping all names tied for the best total. Start with the first homeroom’s total and name. For each remaining homeroom:

  • A greater total becomes the new best, with a new list containing that homeroom.
  • An equal total adds that homeroom to the current list.
  • A smaller total leaves the list unchanged.

The test now gives Rooms 14 and 15 together. Also plan how zero counts and missing daily entries will be handled. A missing entry must not silently be treated as a known zero.

Record enough for a team to build

Keep the decomposition diagram, named values, algorithms for each part, and tests with expected results. Give team jobs owners and deadlines. A possible timeline is week 1 for planning, week 2 for building parts, and week 3 for combining and testing.

The plan can run on a tally sheet with a calculator, in a spreadsheet, or in Scratch or Python. The method of carrying it out changes; the need for correct totals and fair tie handling stays the same.

Key Takeaways

  • A complete plan connects user needs, parts, data, algorithms, and tests.
  • Repeated jobs can share one algorithm.
  • Test ties, zero counts, and missing data.
  • Record algorithms, expected results, responsibilities, and deadlines.

5.2 Evaluate and improve a solution

Evaluation judges how well a solution meets its problem definition. Use evidence from tests and real users. Record whether each success criterion was met, along with the result that supports that judgment.

Judge the solution against its purpose

A recycling system that adds every total correctly but hides a tie still fails a success criterion. A homework reminder that lists the right items may still be too slow to use. Check each criterion separately.

Ask users to try the solution. A small button or confusing message may reveal a need the team missed. Turn that finding into a clear user story and a measurable check for the next version.

Compare algorithms fairly
QualityWhat you check
CorrectnessDoes it give the required result?
EfficiencyHow much work or time does it take?
ClarityCan people understand, change, and reuse it?

Correctness comes first. A quicker algorithm that gives the wrong result is not an acceptable solution. Among correct solutions, compare efficiency and clarity against the project’s needs.

Compare two guessing methods

A secret whole number is from 1 to 100. Each wrong guess receives a truthful "too high" or "too low" hint.

Guessing 1, then 2, then 3, and so on can need 100 guesses. Guessing the middle of the remaining range rules out about half the possibilities each time. It needs at most 7 guesses for this range.

For the secret number 37:

  1. Guess 50. "Too high" leaves 1 through 49.
  2. Guess 25. "Too low" leaves 26 through 49.
  3. The middle is 37.5. Round down and guess 37: correct.

The ranges shrink because each hint removes values that cannot be the secret. Counting guesses gives a simple efficiency comparison.

Choose an improvement that fits

The fastest correct method is not always the best fit for a small team. A slightly slower method may be easier for everyone to understand and change. Consider how much data the solution will handle and what its success criteria require.

Improve in small cycles: design, build, test, evaluate, and revise. Choose the most important problem found, change it, and repeat the earlier tests. If you change several unrelated things at once, a new failure becomes harder to explain.

Record the evidence for each improvement. "The tie test now names both winning rooms" gives a useful result. "It worked once" leaves most of the success criteria unchecked.

Key Takeaways

  • Evaluate every success criterion using evidence.
  • Check correctness before comparing speed or clarity.
  • Count steps or guesses for a simple efficiency comparison.
  • User feedback can reveal missing needs.
  • Improve in small cycles and rerun earlier tests.

Computational Thinking examples

5 Walkthroughs

1

Turn a concern into a clear problem

10 steps
Plan a classroom equipment reminder with a user story and testable success criteria.
  1. 1
    IntroductionPlan a useful reminder

    A class keeps forgetting which equipment to bring. Before building a reminder, you need to understand what students forget and when they need the information. We will turn that concern into a clear, testable plan, using computational thinking and a user story, with success criteria that let the team check that the reminder works. A paper board and an on-screen tool are both possible ways to carry it out.

  2. 2
    ExplanationMake the thinking visible

    Computational thinking makes a problem and its solution clear enough to carry out. Four practices help: split the work, find patterns, keep useful details, and write precise steps. Their names are decomposition, pattern recognition, abstraction, and algorithm design. You can use them on paper before any code exists.

  3. 3
    ExampleSplit the reminder job

    For the equipment reminder, separate collecting lesson information, deciding what is needed, and showing reminders. Each part has its own job. Then notice that every lesson needs the same checks. One checklist can serve art, sports, and science, with different equipment data for each lesson.

  4. 4
    ChallengeName the planning practice

    The class keeps the lesson date and equipment list. It leaves out the classroom wall color. What planning practice is this, and why does the choice help?

    ---reveal---

    It is abstraction: selecting the details the reminder needs. Dates and equipment affect what students bring. Wall color does not help with that job, so leaving it out makes the plan simpler.

  5. 5
    ExplanationAsk what students need

    "Remember equipment" is still broad. Ask who needs the reminder, which lessons it covers, and when students pack their bags. Smaller questions reveal the actual problem. If students pack the night before, a reminder that first appears after the lesson starts cannot meet their need.

  6. 6
    ExampleWrite a user story

    A user story connects a person, a goal, and a reason: "As a student, I want to see tomorrow’s equipment so that I can pack my bag tonight." This story focuses the plan. It also leaves the method open: a shared board or a digital reminder might both meet the need.

  7. 7
    ExampleFollow the information

    The inputs are lesson dates and required equipment. Processing compares the lesson dates with tomorrow’s date. The output is tomorrow’s equipment list. A requirement says "Show every item needed tomorrow." A constraint might say "Use the school’s existing devices." One names needed behavior; the other sets a limit.

  8. 8
    ChallengeMake success testable

    The team writes "The reminder should be helpful." Replace it with a criterion that checks whether tomorrow’s equipment is shown correctly.

    ---reveal---

    "Every equipment item listed for tomorrow’s lessons appears in the reminder." Prepare lesson data, predict the needed items, and compare the result. "Helpful" alone gives no agreed check.

  9. 9
    ChallengeReturn to a missing need

    A test shows the reminder works for sports but misses art supplies. What should the team revisit, and what would show the repair worked?

    ---reveal---

    Revisit the problem definition and the part that collects lesson equipment. The reminder must cover art as well as sports. Add an art test with expected items, repair the missing work, and rerun both tests.

  10. 10
    RecapKeep a plan you can check

    Start with the users’ need, then use the four practices to shape a solution. Record inputs, outputs, requirements, limits, and success checks. When a test reveals a missing need, return to the plan and revise the relevant part.

2

Split and connect a result board

11 steps
Decompose a sports result board and test the information passed between its parts.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionBuild a result board in parts
  2. 2
    ExplanationChoose the main jobs
  3. 3
    ExampleSplit a broad branch again
  4. 4
    ChallengeFind the uncovered requirement
  5. 5
    ExplanationAgree on what crosses a connection
  6. 6
    ExampleSpot a dependency
  7. 7
    ChallengeTest a part early
  8. 8
    ConnectionFind a job worth reusing
  9. 9
    TipJoin and check gradually
  10. 10
    ChallengeLocate a connection error
  11. 11
    RecapMake the parts fit
3

Find a rule and run a model

16 steps
Generalize a drawing pattern, select useful information, and predict a changing savings balance.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionReuse rules and model change
  2. 2
    ExampleFind the repeated pair
  3. 3
    ExplanationGeneralize the drawing rule
  4. 4
    ChallengeChoose a new turn
  5. 5
    Key InsightA short pattern can fit several rules
  6. 6
    ExplanationChoose details for a purpose
  7. 7
    AnalogyRead a simple transit map
  8. 8
    ChallengeKeep a needed detail
  9. 9
    ConnectionHide the steps behind a name
  10. 10
    ExplanationName the model’s state
  11. 11
    ExampleRun one update at a time
  12. 12
    ExampleCheck the purchase threshold
  13. 13
    ChallengeTest the model’s assumption
  14. 14
    TipCompare predictions with observations
  15. 15
    ChallengeConnect the model to its purpose
  16. 16
    RecapKeep the rule and its conditions clear
4

Write, trace, and repair a score algorithm

19 steps
Combine sequence, selection, and repetition, then find a misplaced reset and check the repair.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionBuild and check a score algorithm
  2. 2
    ExplanationGive the plan clear instructions
  3. 3
    ExampleRepresent the same decision
  4. 4
    ChallengeRepair an unclear repeat
  5. 5
    ExplanationSet the starting state
  6. 6
    ExplanationGive the fixed award a name
  7. 7
    ExamplePut the decision inside the loop
  8. 8
    ExampleShow the whole algorithm
  9. 9
    ChallengePredict a changed award
  10. 10
    ConnectionCall a reusable part
  11. 11
    ExplanationTrace the original award
  12. 12
    ExampleCompare against a reset bug
  13. 13
    ChallengeFix the first wrong step
  14. 14
    ExplanationChoose tests that expose the bug
  15. 15
    TipCheck where behavior changes
  16. 16
    ExampleFollow a loop’s last pass
  17. 17
    ChallengeTest the repair without losing old behavior
  18. 18
    Key InsightUse a failure to narrow the search
  19. 19
    RecapConnect structure with evidence
5

Plan and improve a fair contest

13 steps
Build a complete donation-drive plan, handle tied totals, and evaluate the result against user needs.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionPlan a fair contest result
  2. 2
    ExplanationDefine what success requires
  3. 3
    ExampleChoose parts and useful data
  4. 4
    ExampleTry a first winner algorithm
  5. 5
    ChallengeRepair the tie handling
  6. 6
    TipRecord a buildable plan
  7. 7
    ExplanationEvaluate one criterion at a time
  8. 8
    ChallengeJudge a fast but incomplete design
  9. 9
    ConnectionCompare work with simple counts
  10. 10
    Key InsightClarity affects the next change
  11. 11
    ExampleUse feedback to choose a revision
  12. 12
    ChallengeConnect feedback with a test
  13. 13
    RecapKeep evidence with the improvement

Computational Thinking practice questions

50 Practice Questions in 5 sets

Set 1: Plan and follow clear solutions10 Practice Questions

Question 1 of 10

Nora writes card-sorting instructions, then asks a friend to follow them. No device is used. What kind of computing activity is this?
  1. An on-screen task
  2. A finished program
  3. An unplugged task
  4. A data-storage task
Show answerHide answer
Answer: C
This is an unplugged task because it practices clear instructions without a device. Computational thinking can be carried out by people. Calling the instructions a finished program would require them to be written in a programming language a computer can run.

Question 2 of 10

A club sign-up tool must work without internet access. What part of the problem definition is that?
  1. A constraint
  2. An output
  3. A user story
  4. An input
Show answerHide answer
Answer: A
Working without internet access is a constraint: it limits how the tool can operate. A requirement describes a needed job, such as recording a sign-up. An output is a result the tool produces, so it does not name this operating limit.

Question 3 of 10

A team has parts for entering race times and ranking runners. Its requirements also call for a printed results list. What part is missing?
  1. Choose a race date
  2. Record each finish time
  3. Compare runners’ times
  4. Produce the results list
Show answerHide answer
Answer: D
The missing part must turn the rankings into the required results list. Recording times and comparing them already have assigned parts. Adding more timing work would still leave the printing requirement without a part responsible for it.

Question 4 of 10

A badge printer receives a name and prints it. The sign-up form is unfinished. How can the team test the printer now?
  1. Wait until all forms are finished
  2. Send a sample name to the printer
  3. Remove the name from each badge
  4. Print the form instead of a badge
Show answerHide answer
Answer: B
A sample name supplies the input the badge printer needs, so its behavior can be checked on its own. The finished system will later send real names from the form. Waiting for the form is unnecessary for this separate test, though the connection must also be tested later.

Question 5 of 10

A sprite draws a regular octagon with eight equal sides. How far must it turn after each side?
  1. 45 degrees
  2. 60 degrees
  3. 135 degrees
  4. 360 degrees
Show answerHide answer
Answer: A
The sprite makes a full 360-degree turn over eight equal corners, so each turn is 45 degrees. The 135-degree angle is inside the octagon. Using that interior angle as the sprite’s turning instruction would not follow the required outside turn.

Question 6 of 10

A map must help a robot choose a route through doors it fits through. What information is essential?
  1. Room names and wall colors
  2. Door colors and room names
  3. Wall colors and door numbers
  4. Door widths and room connections
Show answerHide answer
Answer: D
Door widths tell the robot whether it can pass, and room connections tell it where each door leads. Together they support the route choice. Room names alone can label places, but they do not show whether a route exists or whether the robot fits through its doors.

Question 7 of 10

A student writes "move forward a bit" for a floor robot. What change makes that instruction precise?
  1. Move forward fairly slowly
  2. Move forward 6 floor tiles
  3. Move forward toward the front
  4. Move forward a short distance
Show answerHide answer
Answer: B
Moving 6 floor tiles gives the robot a measurable distance with a clear stopping point. "A short distance" still leaves the amount open to interpretation. Describing speed alone would not fix the missing distance in the original instruction.

Question 8 of 10

What is output after this algorithm runs?

SET points TO 3
REPEAT 4 TIMES
  IF points < 8 THEN
    SET points TO points + 2
  ELSE
    SET points TO points - 1
  END IF
END REPEAT
OUTPUT points
  1. 7
  2. 9
  3. 8
  4. 11
Show answerHide answer
Answer: C
The values after the four passes are 5, 7, 9, and 8. The last pass starts at 9, so the condition is false and 1 is subtracted. Adding 2 on every pass would give 11, but that ignores the branch chosen when the value reaches the cutoff.

Question 9 of 10

A club accepts ages 10 through 14, including both endpoints. Its check is age > 10 followed by age <= 14. A member must pass both checks. What test exposes the error, and what should happen?
  1. Age 10; it should be rejected
  2. Age 15; it should be accepted
  3. Age 14; it should be rejected
  4. Age 10; it should be accepted
Show answerHide answer
Answer: D
Age 10 belongs in the accepted range but fails the first check because 10 is not greater than 10. The first comparison must include equality. Age 14 passes both checks already, so testing it does not expose the lower-end error.

Question 10 of 10

A roster must include every signed-up student. Design X includes everyone in 12 steps. Design Y uses 8 steps but drops students with the same last name. How should the team judge them?
  1. Choose Y because it uses fewer steps
  2. Reject Y because it misses required students
  3. Reject X because extra steps mean errors
  4. Choose Y if most last names are different
Show answerHide answer
Answer: B
Design Y fails the requirement to include every student, so its shorter method is not acceptable. Correctness comes before efficiency. Having mostly different names does not repair the failure for students who share a last name.
Set 2: Connect parts and check the edges10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A school garden tool receives plant names and watering dates, then displays plants needing water today. What is its output?
  1. The list needing water today
  2. The entered watering dates
  3. The entered plant names
  4. The rule for checking dates
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A team’s only branch under "Run a talent show" is "Organize everything." Why is this decomposition not useful yet?
  1. It already gives the running order
  2. It contains too many tiny actions
  3. Its branch is still too broad to solve
  4. Its branch needs a programming language
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A trip costs 360 dollars for transport and 6 dollars per visitor for 30 visitors. Payments can start once the shared cost per visitor is known. What amount should each visitor pay?
  1. 12 dollars
  2. 18 dollars
  3. 20 dollars
  4. 16 dollars
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A designer makes the same greeting card for many names. The steps stay the same, but each call receives a different name. What is that changing input called?
  1. A constant
  2. A sub-problem
  3. An output
  4. A parameter
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A water tank model starts at 42 liters and removes 6 liters each hour. What state does the model predict after three hours?
  1. 18 liters
  2. 24 liters
  3. 36 liters
  4. 30 liters
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A flowchart asks "Is the locker free?" and follows a Yes or No path. What shape holds that question?
  1. A rectangle
  2. A parallelogram
  3. An oval
  4. A diamond
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A game checks IF stars >= 12 THEN OUTPUT "Gold" ELSE OUTPUT "Silver" END IF. What is output when stars is 12?
  1. "Silver"
  2. "Gold"
  3. "Gold", then "Silver"
  4. "Silver", then "Gold"
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A counter should display 2, 3, 4, 5. It starts at 2 and repeats "output count; add 1" while count < 5. What one change fixes the missing value?
  1. Start at 1
  2. Add 2 each time
  3. Use count <= 5
  4. Output only after the loop
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A reading contest must display every class tied for the highest total. So far, Class Cedar has 28 books and is the only stored winner. Pine then has 31, and Birch has 31. How should the winner list change?
  1. Replace Cedar with Pine, then add Birch
  2. Keep Cedar, then add Pine and Birch
  3. Replace Cedar with Pine, then keep Pine alone
  4. Replace Cedar with Pine, then replace Pine with Birch
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A team changes its score calculation and button labels together. A previously correct score now fails. What should it have done to make the cause easier to find?
  1. Change both and skip earlier tests
  2. Change the labels after the next release
  3. Change one thing and rerun earlier tests
  4. Change every scoring rule at the same time
Show answerHide answer

Save this lesson to see this answer.

Set 3: Read models and follow changing values10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A student writes "Mika’s code is 8-1-6." Is this general or specific information?
  1. General: it describes every code
  2. Specific: it describes one case
  3. General: it contains three digits
  4. Specific: it gives every possible code
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A model predicts a toy’s battery will lose 8 percentage points per hour. It starts at 90%, but after two hours the real level is 70%. What hourly loss matches that observation on average?
  1. 8 percentage points
  2. 12 percentage points
  3. 20 percentage points
  4. 10 percentage points
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A sequence is generated by "position times 5 plus 2." What value is at position 6?
  1. 32
  2. 30
  3. 37
  4. 27
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A club gives every visitor a badge. Its algorithm starts SET total TO 0, then runs INPUT visitors; SET total TO visitors + 1. With 7 visitors, what total is stored?
  1. 7
  2. 1
  3. 8
  4. 0
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

Trace this algorithm. What is the final output?

SET total TO 2
SET n TO 1
WHILE n <= 3
  SET total TO total + n
  SET n TO n + 1
END WHILE
OUTPUT total
  1. 5
  2. 6
  3. 9
  4. 8
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Two tested parts fail when joined: a checker sends the word "yes," but the scoring part expects the Boolean value true. What needs fixing?
  1. The connection’s agreed data format
  2. The order of all the quiz questions
  3. The final display’s background color
  4. The number of scoring tests performed
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

Students need to find an assigned room quickly. The team’s criterion says "The screen looks good." What replacement directly tests the stated need?
  1. The screen has a room-themed title
  2. Every room uses the same text color
  3. A student finds the assigned room within 10 seconds
  4. Every button has a different room picture
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A points contest records one daily total for each team. A blank entry appears for Tuesday. The team knows no rule for handling a missing entry. What should it do before claiming the weekly totals are correct?
  1. Treat every blank as a known zero
  2. Show only teams with positive totals
  3. Reuse Monday’s value for Tuesday
  4. Agree how missing entries are handled
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A queue model predicts waits using arrival and service times. Actual waits are repeatedly longer during lunch, when service slows. What change best addresses this evidence?
  1. Remove arrival times from the model
  2. Use the observed lunch service times
  3. Add tray colors to the model
  4. Keep the rule and raise the starting count
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Malik plans how to share equipment fairly, then follows the written plan on paper. Why can this count as computational thinking?
  1. It turns every paper plan into a runnable program.
  2. A clear solution can be carried out without code.
  3. It needs no clear steps when a person follows it.
  4. A computer has already chosen the sharing rules.
Show answerHide answer

Save this lesson to see this answer.

Set 4: Repair plans in new situations10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A game stores the text "Rae" as its player name. What data type is that value?
  1. An integer
  2. A Boolean
  3. A string
  4. A constant
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

While writing a drawing algorithm, a team notices that its plan has no way to choose a starting point. What should it do?
  1. Finish coding before revisiting the plan
  2. Return to planning and add the missing part
  3. Skip the starting point for every drawing
  4. Restart with a different programming language
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A student draws arrows from "Make a weather display" to "Receive data," "Choose a symbol," and "Show the forecast." What do the branches of this decomposition show?
  1. The parts that make up the job
  2. The order of every instruction
  3. The values held by each variable
  4. The repeat count of each step
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A team models room bookings to prevent time clashes. It keeps room names but removes start and finish times. Why does the abstraction fail?
  1. It keeps too many names for the model
  2. It needs room colors to identify clashes
  3. It has removed details the goal requires
  4. It needs every detail about the building
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A regular-polygon subroutine uses REPEAT sides TIMES, then "move length; turn 360 divided by sides degrees." A call uses 5 sides and length 30. A second call uses 6 sides and length 30. What must change in the second drawing?
  1. The repeat count only
  2. The turning angle only
  3. The side length and turn angle
  4. The repeat count and turn angle
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A savings model starts at 14 dollars, adds 6 dollars weekly, and subtracts 2 dollars weekly. An item costs 33 dollars. After how many whole weeks can it first be bought?
  1. 4 weeks
  2. 5 weeks
  3. 6 weeks
  4. 8 weeks
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A subroutine addBonus(amount) adds amount to score, then returns. The main algorithm sets score to 4, calls addBonus(3) twice, then adds 1 to score. What is the final score?
  1. 11
  2. 8
  3. 10
  4. 14
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A step counter starts at 1 and should display 1 through 4. Inside its loop, it adds 1 before displaying the value. It repeats while count <= 4. What sequence is actually displayed?
  1. 1, 2, 3, 4
  2. 2, 3, 4
  3. 2, 3, 4, 5
  4. 1, 2, 3, 4, 5
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A contest algorithm starts with the first team as its only winner. Whenever a later team has a total at least as high, it replaces the stored winner. Red has 17, Blue 22, and Green 22. What requirement will fail if all tied winners must be shown?
  1. Showing Green’s total as 22
  2. Showing Blue alongside Green
  3. Replacing Red after Blue is read
  4. Comparing Green with the best total
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A number game uses whole numbers 1 through 32 and truthful higher-or-lower hints. The middle-first strategy guesses 16 and is told "too low," then guesses 24 and is told "too high." What numbers remain possible?
  1. 16 through 24
  2. 17 through 24
  3. 16 through 23
  4. 17 through 23
Show answerHide answer

Save this lesson to see this answer.

Set 5: Test and improve complete designs10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A poster team can choose colors without knowing the event date. A booking team needs the date to reserve a room. How are these two jobs related to the date?
  1. Both jobs must wait for it
  2. Only the poster job must wait
  3. Only the booking job must wait
  4. Neither job needs it
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A sports club wants members to check their next session. A user story reads, "As a member, I want to see my next session so that…" What ending best completes the user’s reason?
  1. …the app uses a calendar screen.
  2. …the team can choose a database.
  3. …the page has a consistent layout.
  4. …I know when I need to arrive.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A robot repeats "move one tile east" until it reaches column 5. It starts in column 2. Is the stopping condition reachable, and how many moves reach it?
  1. Yes; 2 moves
  2. Yes; 3 moves
  3. No; it passes column 5
  4. No; the column never changes
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A reading-time tool should accept whole minutes from 1 through 60. What pair most directly checks whether the upper limit wrongly rejects 60?
  1. 59 and 60
  2. 1 and 2
  3. 30 and 31
  4. 0 and 1
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A tank model starts at 50 liters. Each completed minute adds 4 liters and removes 1 liter. It checks the level after each full minute. After how many minutes does the level first exceed 62 liters?
  1. 3 minutes
  2. 4 minutes
  3. 6 minutes
  4. 5 minutes
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A shared subroutine starts total at 0, reads three round scores, and adds each one. One event has three rounds; a new event has four scores: 2, 3, 4, 5. What repeat-count design handles both events, and what total should it produce for the new event?
  1. Use a fixed count of 4; output 14
  2. Use the supplied round count; output 9
  3. Use the supplied round count; output 14
  4. Use a fixed count of 3; output 9
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

An algorithm sets total to 0. For each of three entered scores, it resets total to 0 and then adds that score. The inputs are 4, 7, and 5. What final output and repair are needed to total all three?
  1. 16; keep both resets
  2. 5; remove the reset inside the loop
  3. 12; remove the reset before the loop
  4. 7; move output inside the loop
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A contest reads totals in this order: Oak 9, Elm 9, Ash 12, Fir 12. It must show all winners. After reading Ash, what should its best total and winner list contain?
  1. 12; Ash only
  2. 12; Oak, Elm, and Ash
  3. 9; Oak and Elm
  4. 12; Elm and Ash
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

Two designs produce correct bookings. Success criteria require at most 7 steps and at least two teammates able to maintain the design. X uses 6 steps but only one teammate can maintain it. Y uses 8 steps and everyone can maintain it. What judgment follows?
  1. Accept X; its lower step count meets both needs.
  2. Accept Y; its shared understanding meets both needs.
  3. Reject both because their booking results are wrong.
  4. Revise a design; neither meets both success criteria.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A club gives a discount for attendance counts from 8 through 15, including both endpoints. Its checks require count > 8 and count < 15. Tests at 9, 12, and 14 pass. What additional tests and comparisons directly repair the missed endpoints?
  1. Test 8 and 15; use count > 8 and count <= 15
  2. Test 9 and 14; use count >= 8 and count <= 15
  3. Test 8 and 15; use count >= 8 and count <= 15
  4. Test 8 and 15; use count >= 8 and count < 15
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

62 Key Terms, each with its definition

A

Abstraction
Abstraction focuses on details needed for a purpose and leaves out or hides details that do not help with it.
Abstraction keeps stations and line changes on a subway map without accurate walking distances.
Algorithm
An algorithm is a finite set of precise, unambiguous instructions or rules that completes a task with a result.
An algorithm compares two numbers and outputs the larger value, including when they are equal.
Assumption
An assumption is a condition treated as true when choosing a model’s rules and making its predictions.
A savings model’s assumption of fixed weekly spending fails when a student buys an extra snack.

B

Behavior
A model’s behavior is the set of rules describing how its state changes as the model runs.
In one battery model, the behavior subtracts 15 percentage points from the charge each hour.
Boolean
A Boolean is a value with exactly two possible states: true and false.
A Boolean records whether the player’s answer matches the stored correct answer.
Boundary test data
Boundary test data consists of values at and around edges where an algorithm’s behavior changes.
Ages 64 and 65 are boundary test data when a lower price begins at age 65.

C

Clarity
Clarity describes how easily people can read, understand, change, and reuse a solution’s instructions.
Clarity helps every teammate explain and maintain the algorithm after the original writer leaves.
Computational thinking
Computational thinking makes a problem and its solution clear enough for a person, a computer, or both to carry out.
Computational thinking helps a team plan how a donation drive will record totals and name winners.
Condition-controlled loop
A condition-controlled loop repeats according to a condition, so its count can depend on what happens during the run.
A condition-controlled loop keeps a game running while the number of lives is greater than zero.
Constant
A constant is a named value that stays the same during one run of an algorithm.
The constant MAX_LIVES keeps the starting limit easy to recognize in the game’s instructions.
Constraint
A constraint is a limit the solution must work within, such as a deadline, budget, or available device.
A three-week deadline is a constraint on building a class reminder tool.
Correctness
Correctness means an algorithm produces the required results for the inputs it must handle.
Correctness fails when a contest algorithm gives the right totals but misses a required tied winner.
Count-controlled loop
A count-controlled loop repeats its instructions a fixed number of times known before the loop starts.
A count-controlled loop draws four sides when a sprite is making a square.

D

Data format
A data format is an agreed form for information, helping one part’s output match the next part’s input.
An agreed data format sends the score as the number 5, instead of the text "five."
Debugging
Debugging finds the cause of an error, changes the faulty instructions, and tests the repair.
Debugging moves a misplaced score reset outside the round loop, then reruns the scoring tests.
Decomposition
Decomposition breaks a complex problem or system into smaller parts that are easier to understand and solve.
Decomposition separates a quiz into showing questions, checking answers, scoring, and showing results.
Decomposition diagram
A decomposition diagram is a branching tree showing a whole problem and the smaller parts within it.
A decomposition diagram for a quiz places "Get an answer" beneath the larger part "Check an answer."
Dependency
A dependency exists when one part needs the result of another part to do its job in the complete solution.
Collecting trip payments has a dependency on calculating the cost per student.

E

Efficiency
Efficiency concerns how much work or time an algorithm needs to complete its task.
Comparing the number of guesses gives a simple efficiency check for two number-game strategies.
Evaluation
Evaluation judges how well a solution meets its problem definition, using tests and evidence from users.
Evaluation records whether a success criterion about ties was met and which result supports that judgment.

F

Feedback
Feedback is information from users about how a solution works for them and what needs improving.
Feedback reveals that the result message is confusing, leading the team to test a clearer label.
Flowchart
A flowchart represents an algorithm with shapes for different jobs and arrows showing where to go next.
A flowchart sends a decision’s Yes and No paths to the appropriate next steps.

G

General information
General information describes a whole kind of case, so it can support a rule applying to many examples.
The general information "A locker code has three digits" describes the code format that every locker code shares.
Generalization
Generalization turns a pattern into a rule or reusable solution that works for many cases.
Generalization turns the steps for drawing a square into a rule for drawing other regular polygons.

I

Independent parts
Independent parts are jobs that do not need each other’s results, so they can be done in either order or together.
Booking transport and designing a permission slip can be independent parts of planning a trip.
Input
An input is information received by a solution so that its instructions can work with that information.
The date of an assignment is an input to a tool that finds homework due tomorrow.
Integer
An integer is a whole number, including zero and negative whole numbers, with no fractional part.
An integer can hold a quiz score of 7; text such as "seven" is a different data type.
Iteration
Iteration repeats a group of instructions for a fixed count or according to a condition.
Iteration runs the same question-checking steps for every round of the quiz.

L

Level of abstraction
A level of abstraction is a degree of detail, from a broad job down to the exact steps that carry it out.
At a high level of abstraction, a quiz plan says "Check answers" without showing each comparison.

M

Model
A model simplifies a real object or situation while keeping features needed for a question or prediction.
A savings model keeps the balance and weekly income and spending to predict a purchase date.

N

Normal test data
Normal test data consists of ordinary valid inputs that an algorithm is expected to handle.
An age of 30 is normal test data for a ticket-pricing algorithm that accepts adult ages.

O

Off-by-one error
An off-by-one error makes a loop run exactly one time too many or too few.
An off-by-one error makes a counter intended to show 1 through 10 stop after 9.
On-screen task
An on-screen task uses a digital device to carry out or explore a solution, often through a program.
Building a Scratch animation from a drawing plan is an on-screen task.
Output
An output is a result produced by a solution, such as a displayed message, a list, or a calculated total.
The output of a homework reminder tool is a list of assignments due tomorrow.

P

Parameter
A parameter is an input supplied to a subroutine, allowing its shared steps to handle different cases.
A length parameter lets one drawing subroutine make squares of several sizes.
Pattern recognition
Pattern recognition means spotting similarities, repeated parts, or trends within a problem or across problems.
Pattern recognition shows that every product’s cost can use the same count-times-price calculation.
Problem definition
A problem definition states the goal, users, needed results, and limits before a solution is chosen.
A problem definition for a homework reminder says who needs the reminders and when they must appear.
Processing
Processing is the work a solution performs on its inputs to produce the required result.
Processing compares each assignment’s due date with tomorrow’s date to create the reminder list.
Program
A program expresses algorithms in a programming language so that a computer can carry out the instructions.
A Scratch program can carry out the same drawing algorithm that a person follows on paper.
Programming
Programming is writing instructions in a language that a computer can run, such as Scratch or Python.
Programming can turn a written plan for a game into working blocks or text instructions.
Project plan
A project plan records the parts, data, algorithms, tests, and responsibilities needed to build a complete solution.
A project plan gives a totaling job an owner and lists expected results for a test with a tie.
Pseudocode
Pseudocode describes an algorithm with short, structured, English-like instructions, without one universal syntax.
Pseudocode can use IF and ELSE to show how an algorithm chooses a price.

R

Regular polygon
A regular polygon is a closed shape with straight sides that all have equal lengths and equal corner angles.
To draw a regular polygon, a sprite repeats a move and the same outside turn for each side.
Requirement
A requirement describes something the solution must do to meet a user’s need.
One requirement for a homework reminder tool says that every assignment due tomorrow must appear in its reminder list.

S

Selection
Selection checks a true-or-false condition and chooses which instructions to carry out.
Selection awards a point when an answer is correct and leaves the score unchanged otherwise.
Sequence
Sequence means instructions are carried out one after another in a definite order.
The sequence resets a game’s score before the first question is shown.
Simulation
A simulation runs a model step by step to explore what happens as the represented situation changes.
A battery simulation updates the predicted charge once for each hour of use.
Specific information
Specific information describes one particular case, such as one student’s locker code or current score.
The specific information "Jordan’s locker code is 4-7-2" gives one code instead of a general rule for all codes.
State
A model’s state is the set of values describing it at one moment, such as its current balance or battery level.
In a battery model of gaming, the starting state is 80% before the first hour of play.
String
A string is a value holding text, such as a name, a word, or a message.
The string "Ana" stores the player’s name, while an integer stores the player’s score.
Sub-problem
A sub-problem is a smaller part of a larger problem, with a clear goal that can be solved and checked.
Checking one quiz answer is a sub-problem within the larger job of making a quiz game.
Subroutine
A subroutine is a named group of instructions written once and called whenever that job is needed.
The quiz calls the same answer-checking subroutine for each new question.
Success criterion
A success criterion describes a checkable result that shows whether a solution has met a need.
A success criterion for a homework tool says a student must be able to add one assignment in under 30 seconds.

T

Testing
Testing runs chosen inputs through an algorithm and compares actual results with expected results worked out first.
Testing a ticket algorithm at ages 12 and 13 checks whether its first price boundary works.
Tie
A tie occurs when two or more entries share the same result, such as the highest total in a contest.
When a tie gives two rooms the same highest can count, a winner list must show both rooms.
Timeline
A timeline records when project jobs should happen and when they must be finished.
The timeline sets week 1 for planning, week 2 for building, and week 3 for combining and testing.
Trace table
A trace table records variable values and outputs at chosen steps or loop passes while following an algorithm.
A trace table shows a running total changing from 0 to 1, then 3, then 6, then 10.
Tracing
Tracing follows an algorithm by hand, one instruction at a time, while recording changing values and outputs.
Tracing reveals that the written loop stops before displaying its intended last number.

U

Unexpected test data
Unexpected test data includes missing, impossible, or wrongly typed inputs that need a clear response.
A negative age is unexpected test data for an algorithm that prices tickets for people.
Unplugged task
An unplugged task practices computational thinking without using a computer or other device.
In an unplugged task, partners write and follow drawing instructions using paper and pencils.
User story
A user story connects a type of user, what that user wants, and the reason the user wants it.
The user story "As a student, I want reminders so that I can pack my bag" gives the need a purpose.

V

Variable
A variable is a named place holding a value that can change as an algorithm runs.
The variable score starts at 0 and increases when the player gives a correct answer.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started