Home›Lesson Plans›Computer Science›Computer Science · Grade 5

Debugging: Finding the Fix

Fifth graders learn debugging — the essential skill of finding and fixing the mistakes (“bugs”) in code — and discover that every coder makes mistakes, so patient problem-solving is part of the fun.

Grade 5Programming40 minutes1 class periodUse → Modify → CreateExplicit teaching4 StandardsCSTA
Start the Lesson
Lesson at a Glance

Everything you need before the bell rings

Learning Objectives

Students will be able to…

  • ✓Explain what a bug is.
  • ✓Explain debugging.
  • ✓Find a mistake in steps.
  • ✓Stay persistent.
Essential Question

Even the best coders in the world make mistakes! When a program doesn’t work, the trick isn’t to give up — it’s to become a code detective. How do we find and fix the bugs?

0
Lesson Phases
0
Vocabulary Terms
0
Standards Aligned
0
Interactive Task
Explore · Interactive

Debugging Check

Project each item and have students answer about debugging. The tool explains bugs and how to fix them.

🐛 Understand debuggingTry it
Answer each question about debugging.
The Lesson · Use → Modify → Create (a coding progression with Unplugged practice)

40 minutes, five moves

Tap any phase to open the teacher moves and student actions.

1

Hook — Everyone Makes Bugs

5 min

Even great coders make mistakes — so what do they do when code breaks?

👩‍🏫 Teacher Moves

  • Show a broken program.
  • Ask how to fix it.
  • Set the goal.

🎒 Student Actions

  • See the bug.
  • Wonder how.
  • Predict debugging.
2

Unplugged — Unplug It

10 min

Students practice.

👩‍🏫 Teacher Moves

  • Find the mistake in an algorithm.
  • Fix the wrong step.
  • Test it again.

🎒 Student Actions

  • Find it.
  • Fix it.
  • Test it.
3

Use — Debugging in Code

10 min

Students use the tool.

👩‍🏫 Teacher Moves

  • Send students to Debugging Check.
  • Note what a bug is.
  • Note how to fix it.

🎒 Student Actions

  • Answer them.
  • Note bugs.
  • Note fixing.
4

Modify — Change It

10 min

Students modify.

👩‍🏫 Teacher Moves

  • Fix a buggy set of steps.
  • Test the fix.
  • Explain the bug.

🎒 Student Actions

  • Fix it.
  • Test it.
  • Explain it.
5

Create — Create

5 min

Students conclude.

👩‍🏫 Teacher Moves

  • Debug a partner’s steps.
  • Explain the fix.
  • Complete the exit ticket.

🎒 Student Actions

  • Debug it.
  • Explain it.
  • Complete the exit ticket.
Standards Alignment

Built to the standards you report on

Aligned to the CSTA K-12 Computer Science Standards and ISTE Standards for Students.

CSTA
1B-AP-15

Test and debug a program to ensure it runs as intended.

CSTA
1B-AP-16

Take on roles when collaborating to fix programs.

CSTA
1B-AP-10

Create and correct programs.

ISTE
5

Computational Thinker — persist and troubleshoot.

Differentiation

One lesson, every learner

Multilingual Learners

ELL / EMERGING READERS
  • Bug/fix picture cards.
  • Sentence frame: “The bug is ___; I fixed it by ___.”
  • Fix a wrong step together.

Support & Access

IEP / 504
  • Start with one obvious bug.
  • Fix one step.
  • Test right away.

Stretch & Extend

GIFTED / EARLY FINISHERS
  • Debug a longer program.
  • Explain a tricky bug.
  • Help a friend debug.
Materials

What to gather

  • 📽️Projector / board
  • 🐛Buggy step cards
  • 💻Debugging Check
  • 🔍Magnifiers (detective fun)
  • ✏️Pencils
  • 🎫Exit-ticket slips
Vocabulary

Key terms — hover for a quick definition

buga mistake in codedebugto find and fix mistakeserrorsomething that’s wrongtestto try the programfixto correct a mistakepersistentnot giving uptroubleshootto hunt for problemsprograma set of instructions
Evaluate

Exit Ticket

Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.

QUESTION 1
What is a “bug” in coding?
A mistake or error that keeps a program from working right.
QUESTION 2
What does debugging mean?
Finding and fixing the mistakes in your code.
QUESTION 3
If your program doesn’t work, what should you do first?
Check your steps carefully to find the mistake (don’t give up!).

Create: be a code detective.

Have students trade a set of instructions with a partner, hunt for any bugs, and fix them together — celebrating persistence. A printable debugging sheet is in the Computer Science library.

Study · Flashcards

Study the key terms

Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.

🃏 DebuggingFlip
Card 1
Term
Tap to flip →
Meaning
0

Nice work!

Practice · Quiz

Check your understanding

A quick self-check with instant feedback, drawn from this lesson’s key terms.

📝 DebuggingQuiz
Score: 0
1 / 6
Question 1
0%

Nice work!

Practice · Worksheet

Printable worksheet

A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.

🖨️ DebuggingPrint
Name: ________________________
Date: ____________

Part A · Write the word that matches each meaning

Word bank: bug, debug, error, fix, persistent, program, test, troubleshoot
  1. a mistake in code
  2. a set of instructions
  3. to correct a mistake
  4. to hunt for problems
  5. not giving up
  6. to try the program
  7. something that’s wrong
  8. to find and fix mistakes

Part B · Show what you learned

  1. What is a “bug” in coding?
  2. What does debugging mean?
  3. If your program doesn’t work, what should you do first?
Answer key — Part A: 1) bug · 2) program · 3) fix · 4) troubleshoot · 5) persistent · 6) test · 7) error · 8) debug
Part B: 1) A mistake or error that keeps a program from working right. 2) Finding and fixing the mistakes in your code. 3) Check your steps carefully to find the mistake (don’t give up!).