Vidyalelo
C++ Programming · all questions

Variables and Data Types in C++
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

123

Questions

1/7

Page

Pick an option on a question to see the right answer and solution.

What is the correct keyword to declare a variable in C++?

Select an option to see the answer and solution.

Which of the following is a valid variable name in C++?

Select an option to see the answer and solution.

What is the data type of the variable 'x' in the following declaration: double x = 3.14;?

Select an option to see the answer and solution.

Which of the following is not a primitive data type in C++?

Select an option to see the answer and solution.

What is the maximum value that can be stored in an 'int' data type in C++?

Select an option to see the answer and solution.

What is the size of a 'char' data type in C++?

Select an option to see the answer and solution.

What is the result of the following expression in C++: 5 / 2?

Select an option to see the answer and solution.

Which operator is used to find the size of a data type in C++?

Select an option to see the answer and solution.

What is the correct way to declare a constant in C++?

Select an option to see the answer and solution.

What will be the output of the following code: cout << (true && false); in C++?

Select an option to see the answer and solution.

What is the correct syntax to declare and initialize a variable 'age' of type 'int' with a value of 25 in C++?

Select an option to see the answer and solution.

What is the range of values for a 'short int' data type in C++?

Select an option to see the answer and solution.

What does the 'auto' keyword do in C++?

Select an option to see the answer and solution.

Which of the following is an example of a floating-point data type in C++?

Select an option to see the answer and solution.

What is the correct way to represent hexadecimal values in C++?

Select an option to see the answer and solution.

What is the correct data type for storing a single character in C++?

Select an option to see the answer and solution.

What will be the output of the following code: cout << sizeof(char); in C++?

Select an option to see the answer and solution.

Which of the following is a valid way to initialize a variable in C++?

Select an option to see the answer and solution.

What is the maximum value that can be stored in an 'unsigned int' data type in C++?

Select an option to see the answer and solution.

Which of the following is the correct way to declare a constant 'PI' with a value of 3.14159 in C++?

Select an option to see the answer and solution.