

MCQOPTIONS
Saved Bookmarks
This section includes 56 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
is a/an __________ . |
A. | operator |
B. | function |
C. | object |
D. | macro |
Answer» D. macro | |
2. |
Which of the following cannot be used with the keyword ? |
A. | class |
B. | member functions |
C. | constructor |
D. | destructor |
Answer» D. destructor | |
3. |
Which inheritance type is used in the class given below? |
A. | Multilevel inheritance |
B. | Multiple inheritance |
C. | Hybrid inheritance |
D. | Hierarchical Inheritance |
Answer» C. Hybrid inheritance | |
4. |
How ''Late binding'' is implemented in C++? |
A. | Using C++ tables |
B. | Using Virtual tables |
C. | Using Indexed virtual tables |
D. | Using polymorphic tables |
Answer» C. Using Indexed virtual tables | |
5. |
In which of the following a virtual call is resolved at the time of compilation? |
A. | From inside the destructor. |
B. | From inside the constructor. |
C. | From inside the main(). |
D. | Both A and B. |
Answer» E. | |
6. |
Which of the following is used to make an abstract class? |
A. | Declaring it abstract using static keyword. |
B. | Declaring it abstract using virtual keyword. |
C. | Making at least one member function as virtual function. |
D. | Making at least one member function as pure virtual function. |
Answer» E. | |
7. |
Which of the following are available only in the class hierarchy chain? |
A. | Public data members |
B. | Private data members |
C. | Protected data members |
D. | Member functions |
Answer» D. Member functions | |
8. |
Which of the following statements regarding inline functions is correct? |
A. | It speeds up execution. |
B. | It slows down execution. |
C. | It increases the code size. |
D. | Both A and C. |
Answer» E. | |
9. |
Which of the following functions are performed by a constructor? |
A. | Construct a new class |
B. | Construct a new object |
C. | Construct a new function |
D. | Initialize objects |
Answer» E. | |
10. |
Which of the following is correct about the statements given below? All operators can be overloaded in C++. We can change the basic meaning of an operator in C++. |
A. | Only I is true. |
B. | Both I and II are false. |
C. | Only II is true. |
D. | Both I and II are true. |
Answer» C. Only II is true. | |
11. |
Which of the following is an abstract data type? |
A. | int |
B. | double |
C. | string |
D. | Class |
Answer» E. | |
12. |
How "Late binding" is implemented in C++? |
A. | Using C++ tables |
B. | Using Virtual tables |
C. | Using Indexed virtual tables |
D. | Using polymorphic tables |
Answer» C. Using Indexed virtual tables | |
13. |
Which of the following is not a type of inheritance? |
A. | Multiple |
B. | Multilevel |
C. | Distributive |
D. | Hierarchical |
Answer» D. Hierarchical | |
14. |
cout is a/an __________ . |
A. | operator |
B. | function |
C. | object |
D. | macro |
Answer» D. macro | |
15. |
Which of the following concepts means waiting until runtime to determine which function to call? |
A. | Data hiding |
B. | Dynamic casting |
C. | Dynamic binding |
D. | Dynamic loading |
Answer» D. Dynamic loading | |
16. |
Which of the following is correct about function overloading? |
A. | The types of arguments are different. |
B. | The order of argument is different. |
C. | The number of argument is same. |
D. | Both A and B. |
Answer» E. | |
17. |
Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object. |
A. | Inheritance |
B. | Polymorphism |
C. | Abstraction |
D. | Encapsulation |
Answer» C. Abstraction | |
18. |
Which of the following operator is overloaded for object cout? |
A. | >> |
B. | << |
C. | + |
D. | = |
Answer» C. + | |
19. |
Which of the following approach is adapted by C++? |
A. | Top-down |
B. | Bottom-up |
C. | Right-left |
D. | Left-right |
Answer» C. Right-left | |
20. |
Which one of the following is correct about the statements given below? All function calls are resolved at compile-time in Procedure Oriented Programming. All function calls are resolved at compile-time in OOPS. |
A. | Only II is correct. |
B. | Both I and II are correct. |
C. | Only I is correct. |
D. | Both I and II are incorrect. |
Answer» D. Both I and II are incorrect. | |
21. |
What is correct about the static data member of a class? |
A. | A static member function can access only static data members of a class. |
B. | A static data member is shared among all the object of the class. |
C. | A static data member can be accessed directly from main(). |
D. | Both A and B. |
Answer» E. | |
22. |
Which of the following factors supports the statement that reusability is a desirable feature of a language? |
A. | It decreases the testing time. |
B. | It lowers the maintenance cost. |
C. | It reduces the compilation time. |
D. | Both A and B. |
Answer» E. | |
23. |
Which of the following concepts of OOPS means exposing only necessary information to client? |
A. | Encapsulation |
B. | Abstraction |
C. | Data hiding |
D. | Data binding |
Answer» D. Data binding | |
24. |
Which of the following access specifier is used as a default in a class definition? |
A. | protected |
B. | public |
C. | private |
D. | friend |
Answer» D. friend | |
25. |
Which one of the following is the correct way to declare a pure virtual function? |
A. | virtual void Display(void){0}; |
B. | virtual void Display = 0; |
C. | virtual void Display(void) = 0; |
D. | void Display(void) = 0; |
Answer» D. void Display(void) = 0; | |
26. |
What will happen if a class is not having any name? |
A. | It cannot have a destructor. |
B. | It cannot have a constructor. |
C. | It is not allowed. |
D. | Both A and B. |
Answer» E. | |
27. |
Which of the following concepts is used to implement late binding? |
A. | Virtual function |
B. | Operator function |
C. | Const function |
D. | Static function |
Answer» B. Operator function | |
28. |
Which of the following header file includes definition of cin and cout? |
A. | istream.h |
B. | ostream.h |
C. | iomanip.h |
D. | iostream.h |
Answer» E. | |
29. |
Which of the following cannot be used with the keyword virtual? |
A. | class |
B. | member functions |
C. | constructor |
D. | destructor |
Answer» D. destructor | |
30. |
What happens if the base and derived class contains definition of a function with same prototype? |
A. | Compiler reports an error on compilation. |
B. | Only base class function will get called irrespective of object. |
C. | Only derived class function will get called irrespective of object. |
D. | Base class object will call base class function and derived class object will call derived class function. |
Answer» E. | |
31. |
Which of the following concepts provides facility of using object of one class inside another class? |
A. | Encapsulation |
B. | Abstraction |
C. | Composition |
D. | Inheritance |
Answer» D. Inheritance | |
32. |
Which of the following cannot be friend? |
A. | Function |
B. | Class |
C. | Object |
D. | Operator function |
Answer» D. Operator function | |
33. |
Which inheritance type is used in the class given below? class A : public X, public Y {} |
A. | Multilevel inheritance |
B. | Multiple inheritance |
C. | Hybrid inheritance |
D. | Hierarchical Inheritance |
Answer» C. Hybrid inheritance | |
34. |
How many instances of an abstract class can be created? |
A. | 1 |
B. | 5 |
C. | 13 |
D. | 0 |
Answer» E. | |
35. |
Which of the following concept of oops allows compiler to insert arguments in a function call if it is not specified? |
A. | Call by value |
B. | Call by reference |
C. | Default arguments |
D. | Call by pointer |
Answer» D. Call by pointer | |
36. |
How many types of polymorphisms are supported by C++? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» C. 3 | |
37. |
Which of the following problem causes an exception? |
A. | Missing semicolon in statement in main(). |
B. | A problem in calling function. |
C. | A syntax error. |
D. | A run-time error. |
Answer» E. | |
38. |
Which of the following is an invalid visibility label while inheriting a class? |
A. | public |
B. | private |
C. | protected |
D. | friend |
Answer» E. | |
39. |
Which of the following concepts means wrapping up of data and functions together? |
A. | Abstraction |
B. | Encapsulation |
C. | Inheritance |
D. | Polymorphism |
Answer» C. Inheritance | |
40. |
Which of the following correctly describes overloading of functions? |
A. | Virtual polymorphism |
B. | Transient polymorphism |
C. | Ad-hoc polymorphism |
D. | Pseudo polymorphism |
Answer» D. Pseudo polymorphism | |
41. |
Which of the following statements is correct in C++? |
A. | Classes cannot have data as protected members. |
B. | Structures can have functions as members. |
C. | Class members are public by default. |
D. | Structure members are private by default. |
Answer» C. Class members are public by default. | |
42. |
Which of the following keyword is used to overload an operator? |
A. | overload |
B. | operator |
C. | friend |
D. | override |
Answer» C. friend | |
43. |
Which of the following is not the member of class? |
A. | Static function |
B. | Friend function |
C. | Const function |
D. | Virtual function |
Answer» C. Const function | |
44. |
Why reference is not same as a pointer? |
A. | A reference can never be null. |
B. | A reference once established cannot be changed. |
C. | Reference doesn't need an explicit dereferencing mechanism. |
D. | All of the above. |
Answer» E. | |
45. |
Which of the following is the correct way of declaring a function as constant? |
A. | const int ShowData(void) { /* statements */ } |
B. | int const ShowData(void) { /* statements */ } |
C. | int ShowData(void) const { /* statements */ } |
D. | Both A and B |
Answer» D. Both A and B | |
46. |
Which of the following concepts means determining at runtime what method to invoke? |
A. | Data hiding |
B. | Dynamic Typing |
C. | Dynamic binding |
D. | Dynamic loading |
Answer» D. Dynamic loading | |
47. |
Which of the following term is used for a function defined inside a class? |
A. | Member Variable |
B. | Member function |
C. | Class function |
D. | Classic function |
Answer» C. Class function | |
48. |
Which of the following is the correct class of the object cout? |
A. | iostream |
B. | istream |
C. | ostream |
D. | ifstream |
Answer» D. ifstream | |
49. |
Which of the following provides a reuse mechanism? |
A. | Abstraction |
B. | Inheritance |
C. | Dynamic binding |
D. | Encapsulation |
Answer» C. Dynamic binding | |
50. |
Which of the following is correct about class and structure? |
A. | class can have member functions while structure cannot. |
B. | class data members are public by default while that of structure are private. |
C. | Pointer to structure or classes cannot be declared. |
D. | class data members are private by default while that of structure are public by default. |
Answer» E. | |