C++ Programming MCQ (Multiple Choice Questions) - SchoolingAxis

C++ Programming MCQ (Multiple Choice Questions)

 Que- What does modularity mean? 

a. Hiding part of program 

b. Subdividing program into small independent parts 

c. Overriding parts of program 

d. Wrapping things into single unit 


Answer- Subdividing program into small independent parts        


Que- Which of the following class allows to declare only one object of it? 

a. Abstract class 

b. Virtual class 

c. Singleton class 

d. Friend class 


Answer- Singleton class        


Que- Which of the following is not a type of Constructor? 

a. Friend constructor 

b. Copy constructor 

c. Default constructor 

d. Parameterized constructor 


Answer- Friend constructor        


Que- Which of the following is correct? 

a. Base class pointer object cannot point to a derived class object 

b. Derived class pointer object cannot point to a base class object 

c. A derived class cannot have pointer objects 

d. A base class cannot have pointer objects 


Answer- Derived class pointer object cannot point to a base class object        


Que- Out of the following, which is not a member of the class? 

a. Static function 

b. Friend function 

c. Constant function 

d. Virtual function 


Answer- Friend function        


Que- What is the other name used for functions inside a class? 

a. Member variables 

b. Member functions 

c. Class functions 

d. Class variables 


Answer- Member functions        


Que- Which of the following cannot be a friend? 

a. Function 

b. Class 

c. Object 

d. Operator function 


Answer- Object        


Que- Why references are different from pointers? 

a. A reference cannot be made null 

b. A reference cannot be changed once initialized 

c. No extra operator is needed for dereferencing of a reference 

d. All of the mentioned 


Answer- All of the mentioned        


Que- Which of the following provides a programmer with the facility of using object of a class inside other classes? 

a. Inheritance 

b. Composition 

c. Abstraction 

d. Encapsulation 


Answer- Composition        


Que- How many types of polymorphism are there in C++? 

a. 1 

b. 2 

c. 3 

d. 4 


Answer- 2        


Que- How run-time polymorphisms are implemented in C++? 

a. Using Inheritance 

b. Using Virtual functions 

c. Using Templates 

d. Using Inheritance and Virtual functions 


Answer- Using Inheritance and Virtual functions        


Que- How compile-time polymorphisms are implemented in C++? 

a. Using Inheritance 

b. Using Virtual functions 

c. Using Templates 

d. Using Inheritance and Virtual functions 


Answer- Using Templates        


Que- Which of the following is an abstract data type? 

a. int 

b. float 

c. class 

d. string 


Answer- class        


Que- Which concept means the addition of new components to a program as it runs? 

a. Data hiding 

b. Dynamic binding 

c. Dynamic loading 

d. Dynamic typing 


Answer- Dynamic loading        


Que- Which of the following explains the overloading of functions? 

a. Virtual polymorphism 

b. Transient polymorphism 

c. Ad-hoc polymorphisms) Pseudo polymorphism 

d. None of the mentioned 


Answer- Ad-hoc polymorphisms) Pseudo polymorphism        


Que- Which of the following approach is used by C++? 

a. Top-down 

b. Bottom-up 

c. Left-right 

d. Right-left 


Answer- Bottom-up        


Que- Which operator is overloaded for a cout object? 

a. >> 

b. << 

c. < 

d. > 


Answer- <<        


Que- Which of the following cannot be used with the virtual keyword? 

a. Class 

b. Member functions 

c. Constructors 

d. Destructors 


Answer- Constructors        


Que- Which concept is used to implement late binding? 

a. Virtual functions 

b. Operator functions 

c. Constant functions 

d. Static functions 


Answer- Virtual functions        


Que- Which of the following is correct? 

a. C++ allows static type checking 

b. C++ allows dynamic type checking. 

c. C++ allows static member function to be of type const. 

d. C++ allows both static and dynamic type checking 


Answer- C++ allows both static and dynamic type checking        


Que- Which of the following supports the concept that reusability is a desirable feature of a language? 

a. It reduces the testing time 

b. It reduces maintenance cost 

c. It decreases the compilation time 

d. It reduced both testing and maintenance time 


Answer- It reduced both testing and maintenance time        


Que- Which of the following is a static polymorphism mechanism? 

a. Function overloading 

b. Operator overloading 

c. Templates 

d. All of the mentioned 


Answer- All of the mentioned        


Que- Which of the following is true?I) All operators in C++ can be overloaded.II) The basic meaning of an operator can be changed. 

a. I only 

b. II only 

c. Both I and II 

d. Neither I nor II 


Answer- Neither I nor II        


Que- Which of the following is not a type of inheritance? 

a. Multiple 

b. Multilevel 

c. Distributive 

d. Hierarchical 


Answer- Distributive        


Que- What happens if a class does not have a name? 

a. It will not have a constructor 

b. It will not have a destructor 

c. It is not allowed 

d. It will neither have a constructor or destructor 


Answer- It will not have a destructor        


Que- Which of the following statement is true?I) In Procedural programming languages, all function calls are resolved at compile-timeII) In Object Oriented programming languages, all function calls are resolved at compile-time 

a. I only 

b. II only 

c. Both I and II 

d. Neither I nor II 


Answer- I only        


Que- Which members are inherited but are not accessible in any case? 

a. Private 

b. Public 

c. Protected 

d. Both private and protected 


Answer- Private        


Que- Which of the following is correct? 

a. Friend functions can access public members of a class 

b. Friend functions can access protected members of a class 

c. Friend functions can access private members of a class 

d. All of the mentioned 


Answer- All of the mentioned        


Que- Which of the following is correct in C++? 

a. Classes cannot have protected data members 

b. Structures can have member functions 

c. Class members are public by default 

d. Structure members are private by default 


Answer- Structures can have member functions        


Que- Which of the following is used to make an abstract class? 

a. By using virtual keyword in front of a class declaration 

b. By using an abstract keyword in front of a class declaration 

c. By declaring a virtual function in a class 

d. By declaring a pure virtual function in a class 


Answer- By declaring a pure virtual function in a class

Previous Post Next Post