Vidyalelo
C++ Programming · all questions

Introduction to C++
practice.

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

138

Questions

1/7

Page

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

What is the extension of a C++ source file?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What does the 'cin' object in C++ represent?

Select an option to see the answer and solution.

What keyword is used to define a class in C++?

Select an option to see the answer and solution.

In C++, what operator is used to allocate dynamic memory?

Select an option to see the answer and solution.

What is the syntax for a single-line comment in C++?

Select an option to see the answer and solution.

What function is used to output data to the console in C++?

Select an option to see the answer and solution.

Which header file is needed to use the 'cin' and 'cout' objects in C++?

Select an option to see the answer and solution.

What does the 'endl' manipulator do in C++?

Select an option to see the answer and solution.

What is the output of the following code: cout << (5 > 2) ? "True" : "False";

Select an option to see the answer and solution.

Which keyword is used to define a constant in C++?

Select an option to see the answer and solution.

What is the output of the following code: int x = 5, y = 2; cout << x / y;

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What is the keyword used for inheritance in C++?

Select an option to see the answer and solution.

What function is used to return the length of a string in C++?

Select an option to see the answer and solution.

What is the output of the following code: int x = 10; cout << "Value of x is: " << x++ << endl;?

Select an option to see the answer and solution.

Which of the following is not a valid C++ identifier?

Select an option to see the answer and solution.

What is the result of the expression: sizeof(int) in C++?

Select an option to see the answer and solution.

Which C++ feature allows a function to call itself?

Select an option to see the answer and solution.

What is the correct syntax to dynamically allocate memory for an array of integers in C++?

Select an option to see the answer and solution.