C++ Fundamentals: Data Types and Variables Quiz
easy
10 Questions
Question 1 of 10
Which data type is used to store whole numbers in C++?
The 'int' data type is designed to hold integer values.
Question 2 of 10
Which keyword is used to declare a variable in C++?
Data type like 'int', 'float' are used to declare a variable.
Question 3 of 10
What data type is used to store single characters?
'char' is specifically for storing single characters, like letters.
Question 4 of 10
Which data type is used to store decimal numbers with single precision?
'float' stores single-precision floating-point numbers.
Question 5 of 10
What is the primary purpose of a variable in a C++ program?
Variables hold data that can be used and manipulated by the program.
Question 6 of 10
Which of the following is a valid variable name in C++?
Variable names can start with an underscore or a letter.
Question 7 of 10
Which data type uses more memory: float or double?
Double-precision floats ('double') uses more memory to store larger numbers.
Question 8 of 10
What is the typical size (in bytes) of an 'int' variable?
Typically, 'int' is 4 bytes, but can be system-dependent.
Question 9 of 10
What is the result of 'sizeof(char)'?
The 'sizeof' operator returns the size of data types in bytes. char is usually 1 byte.
Question 10 of 10
Which keyword is used to declare a constant variable in C++?
The 'const' keyword ensures the variable's value cannot be changed after initialization.
1 / 10