Recall & Review
beginner
What is a variable declaration in C?
A variable declaration in C tells the computer to create a space in memory to store a value of a specific type, but it does not assign a value yet.
Click to reveal answer
beginner
What does variable initialization mean?
Variable initialization means giving a variable its first value at the time of declaration.
Click to reveal answer
beginner
How do you declare and initialize an integer variable named 'age' with the value 25 in C?
int age = 25;
Click to reveal answer
intermediate
What happens if you declare a variable but do not initialize it in C?
The variable contains a garbage value (random data) until you assign a value to it.
Click to reveal answer
intermediate
Can you declare multiple variables of the same type in one line? Give an example.
Yes. For example: int x = 5, y = 10, z = 15;
Click to reveal answer
Which of the following is a correct variable declaration and initialization in C?
✗ Incorrect
In C, the correct syntax is: type variable = value; so 'int number = 10;' is correct.
What value does an uninitialized local variable in C hold?
✗ Incorrect
Local variables in C that are not initialized hold garbage values, which are unpredictable.
Which keyword is used to declare a variable in C?
✗ Incorrect
In C, variables are declared by specifying their data type like int, float, or char.
How do you declare three integer variables a, b, and c in one line?
✗ Incorrect
You can declare multiple variables of the same type in one line separated by commas: int a, b, c;
What is the correct way to initialize a character variable named letter with 'A'?
✗ Incorrect
Characters in C are enclosed in single quotes, so 'char letter = 'A';' is correct.
Explain the difference between variable declaration and initialization in C.
Think about what happens when you tell the computer about a variable versus giving it a value.
You got /4 concepts.
Write an example of declaring and initializing multiple variables of the same type in one line.
Use int type and assign values to variables a, b, and c.
You got /4 concepts.