C++ MCQs with answers Page - 17

Here, you will find a collection of MCQ questions on C++. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. A language able to generate new data types is called

  • (A) overloaded
  • (B) extensible
  • (C) encapsulated
  • (D) scalable

A

Admin • 833.24K Points
Coach

Q. What is the output of the following C++ code?

Code:
#include <iostream>
using namespace std;
  
int main()
{ 
    int n = 5, i;
    for (i = 0; i < n; i++)
    {
        n++;
        cout << n << endl;
        goto a;
    }
a: 
    do
    {
        cout << "label a" << endl; 
        break; 
    } 
    while( 0 );
    return 1;
}
  • (A) 5 label a
  • (B) 5
  • (C) label a
  • (D) 6 label a

A

Admin • 833.24K Points
Coach

Q. The size of objects in C++ is expressed in terms of multiples of ____ size and the size of a “char” is _______

  • (A) char, 4
  • (B) int, 1
  • (C) char, 1
  • (D) float, 8

A

Admin • 833.24K Points
Coach

Q. Which of the following statements are true about Catch handler?

1. It must be placed immediately after try block T.
2. It can have multiple parameters.
3. There must be only one catch handler for every try block.
4. There can be multiple catch handler for a try block T.
5. Generic catch handler can be placed anywhere after try block.

  • (A) Only 1, 4, 5
  • (B) Only 1, 2, 3
  • (C) Only 1, 4
  • (D) Only 1, 2

A

Admin • 833.24K Points
Coach

Q. Static variable declared in a class are also called_________ .

  • (A) instance variable
  • (B) named constant
  • (C) global variable
  • (D) class variable

A

Admin • 833.24K Points
Coach

Q. Which of the following operator is used to release the dynamically allocated memory in CPP?

  • (A) remove
  • (B) free
  • (C) delete
  • (D) both b and c

A

Admin • 833.24K Points
Coach

Q. Which of the following is not a false statement about new operator?

  • (A) It can’t be overloaded.
  • (B) It returns garbage value when memory allocation fails.
  • (C) It automatically computes the size of the data object.
  • (D) All of these

A

Admin • 833.24K Points
Coach

Q. Run time polymorphism can be achieved with______ .

  • (A) Virtual Base class
  • (B) Container class
  • (C) Virtual function
  • (D) Both a and c

A

Admin • 833.24K Points
Coach

Q. To create an output stream, we must declare the stream to be of class ___________ .

  • (A) ofstream
  • (B) ifstream
  • (C) iostream
  • (D) None of these

A

Admin • 833.24K Points
Coach

Q. Inline functions may not work ______ .

1. If function contain static variables.
2. If function contain global and register variables.
3. If function returning value consists looping construct(i.e. for, while).
4. If inline functions are recursive.
5. If function contains const value.

  • (A) Only 1,4,5
  • (B) Only 2,3,5
  • (C) Only 1,3,4
  • (D) All of these

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ