MCQOPTIONS
Saved Bookmarks
This section includes 25 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Instance of which type of class can’t be created? |
| A. | Anonymous class |
| B. | Nested class |
| C. | Parent class |
| D. | Abstract class |
| Answer» E. | |
| 2. |
Which among the following is false for class features? |
| A. | Classes may/may not have both data members and member functions |
| B. | Class definition must be ended with a colon |
| C. | Class can have only member functions with no data members |
| D. | Class is similar to union and structures |
| Answer» C. Class can have only member functions with no data members | |
| 3. |
Which of the following pairs are similar? |
| A. | Class and object |
| B. | Class and structure |
| C. | Structure and object |
| D. | Structure and functions |
| Answer» C. Structure and object | |
| 4. |
Which syntax for class definition is wrong?a) class student{ };b) student class{ };c) class student{ public: student(int a){ } };d) class student{ student(int |
| A. | class student{ }; |
| B. | student class{ }; |
| C. | class student{ public: student(int a){ } }; |
| D. | class student{ student(int a){} }; |
| Answer» C. class student{ public: student(int a){ } }; | |
| 5. |
Which among the following is false, for a member function of a class? |
| A. | All member functions must be defined |
| B. | Member functions can be defined inside or outside the class body |
| C. | Member functions need not be declared inside the class definition |
| D. | Member functions can be made friend to another class using the friend keyword |
| Answer» D. Member functions can be made friend to another class using the friend keyword | |
| 6. |
Class with main() function can be inherited. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 7. |
What is the scope of a class nested inside another class? |
| A. | Protected scope |
| B. | Private scope |
| C. | Global scope |
| D. | Depends on access specifier and inheritance used |
| Answer» E. | |
| 8. |
Which of the following describes a friend class? |
| A. | Friend class can access all the private members of the class, of which it is a friend |
| B. | Friend class can only access protected members of the class, of which it is a friend |
| C. | Friend class don’t have any implementation |
| D. | Friend class can’t access any data member of another class but can use it’s methods |
| Answer» B. Friend class can only access protected members of the class, of which it is a friend | |
| 9. |
Which class can have member functions without their implementation? |
| A. | Default class |
| B. | String class |
| C. | Template class |
| D. | Abstract class |
| Answer» E. | |
| 10. |
Size of a class is _____________ |
| A. | Sum of the size of all the variables declared inside the class |
| B. | Sum of the size of all the variables along with inherited variables in the class |
| C. | Size of the largest size of variable |
| D. | Classes doesn’t have any size |
| Answer» E. | |
| 11. |
Which is known as a generic class? |
| A. | Abstract class |
| B. | Final class |
| C. | Template class |
| D. | Efficient Code |
| Answer» D. Efficient Code | |
| 12. |
Which is most appropriate comment on following class definition? |
| A. | Error : same variable name can’t be used twice |
| B. | Error : Public must come first |
| C. | Error : data types are different for same variable |
| D. | It is correctView Answer |
| Answer» B. Error : Public must come first | |
| 13. |
What is default access specifier for data members or member functions declared within a class without any specifier, in C++? |
| A. | Private |
| B. | Protected |
| C. | Public |
| D. | Depends on compiler |
| Answer» B. Protected | |
| 14. |
Which of the following is not type of class? |
| A. | Abstract Class |
| B. | Final Class |
| C. | Start Class |
| D. | String Class |
| Answer» D. String Class | |
| 15. |
IF_A_IS_THE_SUPERCLASS_AND_B_IS_THE_SUBCLASS,_THEN_SUBCLASS_INHERITING_THE_SUPERCLASS_CAN_BE_REPRESENTED_AS__________?$ |
| A. | B=inherit(A); |
| B. | B=A.inherit(); |
| C. | B.prototype=inherit(A); |
| D. | B.prototype=inherit(A.prototype); |
| Answer» B. B=A.inherit(); | |
| 16. |
WHICH_OF_THE_FOLLOWING_DESCRIBES_A_FRIEND_CLASS??$ |
| A. | Friend class can access all the private members of the class, of which it is a friend |
| B. | Friend class can only access protected members of the class, of which it is a friend |
| C. | Friend class don’t have any implementation |
| D. | Friend class can’t access any data member of another class but can use it’s methods |
| Answer» E. | |
| 17. |
What_is_scope_of_a_class_nested_inside_another_class?$ |
| A. | Protected scope |
| B. | Private scope |
| C. | Global scope |
| D. | Depends on access specifier and inheritance used |
| Answer» B. Private scope | |
| 18. |
Which_among_the_following_is_false,_for_member_function_of_a_class? |
| A. | All member functions must be defined |
| B. | Member functions can be defined inside or outside the class body |
| C. | Member functions need not be declared inside the class definition |
| D. | Member functions can be made friend to another class using friend keyword |
| Answer» C. Member functions need not be declared inside the class definition | |
| 19. |
When a class B can extend another class A, we say that? |
| A. | A is the superclass and B is the subclass |
| B. | B is the superclass and A is the subclass |
| C. | Both A and B are the superclass |
| D. | Both A and B are the subclass |
| Answer» D. Both A and B are the subclass | |
| 20. |
The property of JSON() method is: |
| A. | it can be invoked manually as object.JSON() |
| B. | it will be automatically invoked by the compiler |
| C. | it is invoked automatically by the JSON.stringify() method |
| D. | it cannot be invoked in any form |
| Answer» B. it will be automatically invoked by the compiler | |
| 21. |
The meaning for Augmenting classes is that: |
| A. | objects inherit prototype properties even in dynamic state |
| B. | objects inherit prototype properties only in dynamic state |
| C. | objects inherit prototype properties in static state |
| D. | object doesn’t inherit prototype properties in static state |
| Answer» D. object doesn‚Äö√Ñ√∂‚àö√ë‚àö¬•t inherit prototype properties in static state | |
| 22. |
The basic difference between JavaScript and Java is _________ |
| A. | There is no difference |
| B. | Functions are considered as fields |
| C. | Variables are specific |
| D. | Functions are values, and there is no hard distinction between methods and fields |
| Answer» B. Functions are considered as fields | |
| 23. |
Error : same variable name can’t be used twice$ |
| A. | Error : Public must come first |
| B. | Error : data types are different for same variable |
| C. | It is correct |
| Answer» D. | |
| 24. |
The keyword or the property that you use to refer to an object through which they were invoked is _________ |
| A. | from |
| B. | to |
| C. | this |
| D. | object |
| Answer» D. object | |
| 25. |
Class is pass by _______ |
| A. | Value |
| B. | Reference |
| C. | Value or Reference, depending on program |
| D. | Copy |
| Answer» C. Value or Reference, depending on program | |