Debugging: Find the Step That Is Wrong

8 questions · 8 points · Grades 6–7 · English · Preview the 8 questions

Made by Aisha Varrick · LessonRally (AI-assisted)

Digital classroom activity

What is a digital classroom activity?

Teachers who sign in can assign LessonRally activities to their Google Classroom classes: students open them in Classroom and answer online, and their grades go to the teacher's Classroom gradebook. Practice lets you try it first, the way students see it.

Free for teachers. Sign in to assign activities to your Google Classroom classes.

Printable worksheet

Students compare what a short program shows with its goal, trace the numbered steps, and find the one step that causes the wrong result. The programs use variables, words, repeat loops and if-then-else steps written in plain language. Coding and computer science practice with no programming language.

Learning goal: Trace a short program, compare what it shows with its goal, and identify the one step that causes the wrong result.

Estimated reading level 5.3

  1. Grade 3Hard
  2. Grade 4Stretch
  3. Grade 5On level
  4. Grade 6Easier
  5. Grade 7Easy
About this estimate

The estimate is the middle score of five readability formulas. Their scores run from 3.7 to 7.1.

  • Flesch-Kincaid GradeSentence length and syllables per word4.0
  • Gunning FogSentence length and words of three or more syllables6.1
  • Coleman-Liau Middle scoreLetters per word and sentences per 100 words5.3
  • Automated Readability IndexCharacters per word and words per sentence3.7
  • SMOGWords of three or more syllables, for texts of 30 sentences or more7.1
Flesch Reading Ease
86.5 on a 0 to 100 scale where higher is easier: easy. Not part of the estimate.
Text measured
751 words, 64 sentences

Adapted from common readability formulas (Flesch-Kincaid, Gunning Fog, Coleman-Liau and ARI, plus SMOG for long texts), which look at sentence length and word length. Answer choices count toward word length only. Grades below the estimate will likely find the text harder, grades above it easier. It does not measure ideas, background knowledge or images.

Topic: Programming and Algorithms Chosen by LessonRally

Question types: multiple choice, number answer.

Student preview

The questions as students see them, without the answers.

Each program below has a goal, which lists everything the program should show on the screen, in order. "Show" puts a value or a message on the screen. Exactly one step in each program is wrong, so trace the steps one at a time, keep a list of everything the program shows, and compare your list with the goal.

Question 1

Soren is writing a program for a neighborhood bakery that keeps track of how many cookies are sitting on the front display tray during the morning.

Goal: the program should show 4, then 12, then 7, and finally the message Tray updated.

  1. Set cookies to 4, then show cookies.
  2. Add 3 to cookies, then show cookies.
  3. Subtract 5 from cookies, then show cookies.
  4. Show the message Tray updated.

Which of the four steps causes the program's first wrong result?

Choose one answer.

  • Step 3
  • Step 4
  • Step 1
  • Step 2

Question 2

Thandi built a science program that models a patch of moss growing on a rock, where the moss doubles in size every single week. The program should display the size at the very beginning and again after each of three weeks.

Goal: the program should show 2, then 4, then 8, and finally 16.

  1. Set moss to 1, then show moss.
  2. Double moss, then show moss.
  3. Double moss, then show moss.
  4. Double moss, then show moss.

Which step number is responsible for the wrong result? Enter that step number.

Enter a number.

Question 3

Elodie is making a word game for her younger cousins that builds the word sunflower, one piece at a time. In her program, "followed by" joins two pieces of text into one, keeping them in exactly the order they are written.

Goal: the program should show sun, then sunflow, then sunflower, and finally the message Word complete.

  1. Set word to "sun", then show word.
  2. Set word to "flow" followed by word, then show word.
  3. Set word to word followed by "er", then show word.
  4. Show the message Word complete.

Which step needs to be fixed so that the program reaches its goal?

Choose one answer.

  • Step 4
  • Step 3
  • Step 1
  • Step 2

Question 4

Bastian's program keeps track of the apples for sale at a farm stand, along with the paper bags the farmers use to pack apples for their customers.

Goal: the program should show 10, then 0, then 5, and finally 1.

  1. Set apples to 10, then show apples.
  2. Set bags to 0, then show bags.
  3. Subtract 5 from apples, then show apples.
  4. Add 1 to apples, then show bags.

In which of these four steps is the bug that causes the wrong result?

Choose one answer.

  • Step 2
  • Step 3
  • Step 1
  • Step 4

Question 5

Ines wrote a program that counts the laps she swims during practice, adding 3 laps for each set she finishes. During today's practice, she swims exactly three sets.

Goal: the program should show 3, then 6, then 9, and finally the message Done.

  1. Set laps to 0.
  2. Repeat 4 times: add 3 to laps, then show laps.
  3. Show the message Done.

Enter the number of the step that is wrong.

Enter a number.

Question 6

Viktor's video game program displays a player's points at the beginning of the game and again after each of three bonus rounds.

Goal: the program should show 5, then 8, then 11, then 14, and finally the message Finished.

  1. Set points to 5.
  2. Show points.
  3. Repeat 3 times: add 2 to points, then show points.
  4. Show the message Finished.

Which step contains the mistake?

Choose one answer.

  • Step 3
  • Step 2
  • Step 4
  • Step 1

Question 7

Marisol's quiz program should display Pass for any score of 60 or more and Try Again for any lower score. To test the program, she gives it a score of exactly 60.

Goal: the program should show 60, then the message Pass, and finally the message Quiz checked.

  1. Set score to 60.
  2. Show score.
  3. If score is more than 60, then show the message Pass. Else, show the message Try Again.
  4. Show the message Quiz checked.

Which step causes the program to miss its goal?

Choose one answer.

  • Step 4
  • Step 1
  • Step 3
  • Step 2

Question 8

Ronan's reading app keeps track of how many pages his library book has, how many pages he has finished, and how many pages are still remaining.

Goal: the program should show 120, then 45, then 75, and finally the message Keep reading.

  1. Set pages to 120, then show pages.
  2. Set finished to 45, then show finished.
  3. Set remaining to finished − pages, then show remaining.
  4. Show the message Keep reading.

What is the number of the step that causes the wrong result?

Enter a number.

Reviews

No reviews yet.

Reviews come from teachers who assigned this activity to a class.

Sign in to write a review

Have a topic of your own? Make a printable worksheet and online quiz, free.

Create an activity

Answer key

Answer keys come with Premium

Print this worksheet with the correct answers marked. The key includes any explanations, sample answers, and rubrics supplied with the activity.

Answer keys aren't public: only teachers with Premium and the people who can edit an activity can download one, so students can't get a ready-to-print key from this page.

Premium includes:

  • No ads for you, and no ads for your students on the assignments you post.
  • Answer keys for printable worksheets, with the correct answers marked and any explanations, sample answers, and rubrics.
  • Create with AI: up to 100 activities a year (5 during the free trial), with every answer checked before you see the draft.

$29 a year, plus sales tax where it applies.

New Premium teachers can try it free for 7 days. A card or other payment method is needed to start. Unless you cancel before the trial ends, you are charged then and the plan renews every year.

Already have Premium or edit this activity? Sign in