Which of the following is a fundamental data type in C++?
Analysis & Theory
`bool` is a fundamental (primitive) data type in C++. `string`, `array`, and `vector` are derived or user-defined types.
Which data type is used to store a single character in C++?
Analysis & Theory
`char` is used to store a single character like 'A', '1', or '$'.
What is the size of an `int` in most 64-bit systems?
Analysis & Theory
On most 64-bit systems, an `int` occupies 4 bytes (32 bits).
Which data type would you use for a variable that stores monetary values with decimals?
Analysis & Theory
`float` is used for real numbers, i.e., numbers with decimal points.
Which of the following is a user-defined data type in C++?
Analysis & Theory
`struct` is a user-defined data type that allows grouping different data types.
Which of the following can store a large integer value?
Analysis & Theory
`long` can store larger integers than `int` or `short`.
What is the default value of a `bool` variable if not initialized?
Analysis & Theory
If not explicitly initialized, the value of a local variable like `bool` is undefined (contains garbage).
Which of the following types can represent a wider range of numbers?
Analysis & Theory
`double` has more precision and range than `float` and is used for more accurate decimal values.
What is the output of `sizeof(char)` in C++?
Analysis & Theory
`char` occupies exactly 1 byte (8 bits) on all systems.
Which header file is needed to use the `string` type in C++?
Analysis & Theory
To use the C++ `string` class, you must include the `<string>` header.