Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1Score ← 0 | AScore ← Score + 5 | |
| 2Score ← 10 | BReplaces the old value of Score with 10, showing that a variable's value can change | |
| 3A variable is a name that labels a place in memory where a value is kept | CWrong: after Score ← 10 the old value is gone. Score now holds 10, because a variable's value can be replaced. | |
| 4A program can change the value held in a variable while it runs | DDECLARE Score : INTEGER | |
| 5Score ← 0 Score ← 10 // Score is still 0 now | EStores the value 0 in the variable Score, so the program remembers the starting score | |
| 6// A variable's value can never change once it is set Score ← 0 | FWrong: a variable's value can change while the program runs. It is a constant whose value cannot change. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
variable — A named storage location in memory whose value can change while a program runs, such as Score going from 0 to 10. Programs use it to remember values.Score ← 0
Score ← 10
OUTPUT ScoreLives ← 3
Lives ← 2
OUTPUT LivesScore ← 0
Score ← 10
OUTPUT ScoreLevel ← 1
Level ← 2
OUTPUT LevelLives ← 3
Lives ← 2
OUTPUT Lives