CS: Introduction to Variables and Data Types
Storing information with names and choosing the right data type
Storing information with names and choosing the right data type
CS - Grade 6-8
- 1
In your own words, explain what a variable is in computer programming.
- 2
A program has the statement score = 25. What is the variable name, and what value is stored in it?
- 3
Choose the best data type for this value: 42. Explain your choice.
- 4
Choose the best data type for this value: 3.75. Explain your choice.
- 5
Choose the best data type for this value: "basketball". Explain your choice.
- 6
Choose the best data type for this value: true. Explain your choice.
- 7
A student writes age = "12". Is age stored as a number or as text? Explain how you know.
- 8
A program has these statements: points = 10 and points = points + 5. What value does points store after both statements run?
- 9
Write a variable assignment for a player's name, using the variable name playerName and the value Maya.
- 10
Write a variable assignment for the number of lives in a game, using the variable name lives and the value 3.
- 11
The variable temperatures stores [68, 70, 72, 69]. What data type is this most likely, and why?
- 12
A program needs to store whether a user is logged in or not. Choose a good variable name and data type, then explain your answer.
Related Cheat Sheets
More CS Worksheets
CS: Algorithms and Flowcharts
Grade 6-8 · 12 problems
CS: Arrays and Lists
Grade 9-12 · 12 problems
CS: Big-O Notation and Algorithm Efficiency
Grade 9-12 · 12 problems
CS: Binary Numbers and Number Systems
Grade 6-8 · 12 problems
More Grade 6-8 Worksheets
Ratios & Proportions
Math · 8 problems
Forces & Motion
Physics · 8 problems
Figurative Language
Language Arts · 8 problems
US Government & Civics
Social Studies · 8 problems