Recall & Review
beginner
What is a variable in programming?
A variable is a name that holds a value in a program. It is like a labeled box where you can store information to use later.
Click to reveal answer
beginner
Why do we need variables in a program?
Variables let us store and change data while the program runs. They help us remember information and use it multiple times.Click to reveal answer
beginner
How do variables help in real-life programming?
Variables let programmers write flexible code. For example, instead of writing a fixed number, we store it in a variable so it can change easily.Click to reveal answer
beginner
What happens if we don’t use variables?
Without variables, we would have to write the same values many times. This makes programs long, hard to read, and hard to change.
Click to reveal answer
beginner
Give an example of a variable in Java.
Example: <br>
int age = 25; <br> Here, age is a variable that stores the number 25.Click to reveal answer
What does a variable do in a program?
✗ Incorrect
A variable stores data so the program can use or change it later.
Why is it better to use variables instead of writing numbers directly?
✗ Incorrect
Using variables means you can change values easily without rewriting many parts of the code.
Which of these is a correct variable declaration in Java?
✗ Incorrect
In Java, the type comes first, then the variable name, then the value.
What would happen if you don’t use variables and repeat the same number everywhere?
✗ Incorrect
Repeating values makes code long and hard to update.
Which statement is true about variables?
✗ Incorrect
Variables hold data that can be updated during the program.
Explain in your own words why variables are important in programming.
Think about how you remember things in daily life to use later.
You got /4 concepts.
Describe what would happen if a program did not use variables.
Imagine writing the same number many times instead of using a name.
You got /4 concepts.