Explore topic-wise MCQs in C++ (MCQ) questions and answers.

This section includes 7 Mcqs, each offering curated multiple-choice questions to sharpen your C++ (MCQ) questions and answers knowledge and support exam preparation. Choose a topic below to get started.

1.

Static variable in a class is initialized when _____ .

A. every object of the class is created.
B. last object of the class is created.
C. first object of the class is created.
D. No need to initialize static variable.
Answer» D. No need to initialize static variable.
2.

Which of the followings is/are not a manipulator/s ?1. flush2. base3. ends4. oct5. bin6. skipws

A. Only 1, 6
B. Only 1,4,6
C. Only 1,3,6
D. Only 2,5
Answer» E.
3.

Which of the followings are false statements about Local class?1. A local class type name can only be used in the enclosing function2. All the methods of Local classes must be defined inside the class only3. A Local class can contain static data members. 4. A Local class may contain static functions.5. Non-static variables of the enclosing function are not accessible inside local classes. 6. Local classes cannot access global types, variables and functions.

A. Only 1,3
B. Only 3, 6
C. Only 2 , 4 , 6
D. None of these
Answer» C. Only 2 , 4 , 6
4.

Which of the followings is/are not keyword/s in CPP?1. asm2. boolean3. mutable4. export5. constant_cast

A. Only 5
B. Only 1 and 4
C. Only 1,2 and 5
D. Only 2 and 5
Answer» E.
5.

Static variable declared in a class are also called_________ .

A. instance variable
B. named constant
C. global variable
D. class variable
Answer» E.
6.

Predict the output:int x = 786;cout

A. 786***
B. **786
C. ***786
D. ******
Answer» D. ******
7.

Object based language differs from object oriented language as it does not support features _____ .1. Encapsulation 2. Inheritance 3. Dynamic Binding 4. Abstraction5. Polymorphism

A. only 3 ,4
B. only 1,3,5
C. 2,4,5
D. Only 2,3
Answer» E.