Question 1
A soccer video game keeps track of a player's score during a match by running these steps in order.
- Set score to 5.
- Add 3 to score.
- Multiply score by 4.
What is the value of score after step 3 has finished?
Enter a number.
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.
(opens in a new tab)2 pages · Student copy, no answers
Print worksheet (opens in a new tab)Answer keyPremiumStudents trace steps that store and change values in variables: setting a value, adding to it, replacing it, copying one variable into another, swapping two values, and joining words. Each question asks for a value at a named step or at the end. Coding and computer science practice with no programming language.
Learning goal: Trace steps that set, change, copy and swap the values of variables, and find a variable's exact value at the end or at a named step.
The estimate is the middle score of five readability formulas. Their scores run from 1.9 to 7.0.
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: number answer, multiple choice.
The questions as students see them, without the answers.
A variable is a name that stores a value, like a labeled box that holds one thing at a time. In these steps, "Set" replaces whatever value a variable was holding, and each step changes only the variable it names. Work through the steps in order, one at a time.
A soccer video game keeps track of a player's score during a match by running these steps in order.
What is the value of score after step 3 has finished?
Enter a number.
Rory wrote a savings program that tracks the money in his piggy bank, and it runs these steps in order.
What is the value of savings after step 3 has finished?
Enter a number.
A gardening program tracks the height of a hedge as it grows and then gets trimmed.
What is the value of height right after step 3, before step 4 runs?
Enter a number.
These steps use two variables named original and backup. The step "Set backup to original" gives backup the value that original has at that moment.
What is the value of backup after step 3 has finished?
Enter a number.
A variable can store words as well as numbers. Follow these steps from a word-building game.
What is stored in word after step 2?
Choose one answer.
Dina's program stores 3 in a variable named first and 8 in a variable named second. She wants to swap them, so that first ends at 8 and second ends at 3. Which steps do that?
Choose one answer.
A hiking app keeps track of how far a hiker has walked on a trail and how much of the trail is left.
What is the value of hiked after step 4 has finished?
Enter a number.
A school supply program counts the pencils and markers in a classroom bin by running these steps in order.
What is the value of markers after step 4 has finished?
Enter a number.
No reviews yet.
Reviews come from teachers who assigned this activity to a class.
Have a topic of your own? Make a printable worksheet and online quiz, free.
Create an activity