Which of the following is a correct way to declare an integer variable in C++?
Analysis & Theory
In C++, variables are declared by writing the type followed by the variable name, e.g., `int x;`.
What is the default value of an uninitialized `int` variable in C++?
Analysis & Theory
Local variables in C++ are not automatically initialized; they contain garbage values.
Which of the following is a valid declaration of multiple variables in one line?
Analysis & Theory
You can declare and initialize multiple variables of the same type in one line using commas.
Which keyword is used to declare a constant variable in C++?
Analysis & Theory
`const` is the keyword used in C++ to declare a constant variable.
What is the correct way to declare a float variable?
Analysis & Theory
`float x = 5.0;` correctly declares a float. Using quotes would create a char/string, not a float.
Which of these is **not** a valid C++ data type?
Analysis & Theory
`real` is not a standard C++ data type. `int`, `float`, and `char` are valid.
How do you declare a string variable in modern C++?
Analysis & Theory
`string` (lowercase) is used from the `std` namespace in C++, like `std::string name = "John";`.
Which header is required to use `std::string` in C++?
Analysis & Theory
`#include <string>` is required to use `std::string` in C++.
Which of the following declares a boolean variable in C++?
B
boolean isReady = true;
Analysis & Theory
`bool` is the correct type for boolean variables in C++.
Which variable declaration will cause a compile-time error?
Analysis & Theory
Variable names cannot begin with digits. `int 5x = 10;` is invalid.