MCQOPTIONS
Saved Bookmarks
This section includes 18 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. |
Which among the following is not allowed for data member declaration? |
| A. | int a; |
| B. | static int a; |
| C. | abstract a; |
| D. | Boolean a; |
| Answer» D. Boolean a; | |
| 2. |
The arguments passed to member functions by reference are considered as data members of class. |
| A. | True |
| B. | False |
| Answer» C. | |
| 3. |
Which data members can be inherited but are private to a class? |
| A. | Private |
| B. | Protected |
| C. | Protected and Static |
| D. | Privately inherited |
| Answer» C. Protected and Static | |
| 4. |
What is the keyword used to make data members have same value? |
| A. | static |
| B. | const |
| C. | double |
| D. | abstract |
| Answer» C. double | |
| 5. |
A class can have self-referential data members. |
| A. | True |
| B. | False |
| Answer» C. | |
| 6. |
The static member functions can only use ________ |
| A. | Static data members |
| B. | Private data members |
| C. | Protected data members |
| D. | Constant data members |
| Answer» B. Private data members | |
| 7. |
What is the output of following code? |
| A. | 1050100 |
| B. | 1005010 |
| C. | n5010 |
| D. | n50100View Answer |
| Answer» E. | |
| 8. |
Which among the following is true for use of setter() and getter() function? |
| A. | Considered best for manipulating data values |
| B. | Considered the only proper way to manipulate the values |
| C. | Considered specially for private members manipulation |
| D. | Considered a red flag, and not recommended for large scale use |
| Answer» E. | |
| 9. |
To create a pointer to a private data member of a class, outside the class, which among the following is correct? |
| A. | Return the address of the private data member using a member function |
| B. | Access the private member using a pointer outside class |
| C. | Declare the member as pointer inside the class |
| D. | Not possible to create pointer to a private member |
| Answer» B. Access the private member using a pointer outside class | |
| 10. |
How to access data members of a class? |
| A. | Dot operator |
| B. | Arrow operator |
| C. | Dot or arrow as required |
| D. | Dot, arrow or direct call |
| Answer» D. Dot, arrow or direct call | |
| 11. |
How many data members can a class contain? |
| A. | 27 |
| B. | 255 |
| C. | 1024 |
| D. | As many as required |
| Answer» E. | |
| 12. |
What should be done for data member to be of user defined structure type? |
| A. | The structure must have been defined before class. |
| B. | The structure must have been defined after the class definition |
| C. | The structure must be predefined |
| D. | The structure type data members can’t be used |
| Answer» B. The structure must have been defined after the class definition | |
| 13. |
Which among the following is true for data members? |
| A. | Private data members can be initialized with declaration in class |
| B. | Static members are initialized in constructors |
| C. | Protected data members can be initialized in class directly |
| D. | Static data members are defined outside class, not in constructor |
| Answer» E. | |
| 14. |
Data members ________________ (C++) |
| A. | Can be initialized with declaration in classes |
| B. | Can be initialized only with help of constructors |
| C. | Can be initialized either in declaration or by constructor |
| D. | Can’t be initialized |
| Answer» C. Can be initialized either in declaration or by constructor | |
| 15. |
What is the term used to indicate the variable and constants of a class? |
| A. | Data members |
| B. | Variables of class |
| C. | Data characters |
| D. | Constants |
| Answer» B. Variables of class | |
| 16. |
The static member functions can only use ________$ |
| A. | Static data members |
| B. | Private data members |
| C. | Protected data members |
| D. | Constant data members |
| Answer» C. Protected data members | |
| 17. |
1050100$ |
| A. | 1005010 |
| B. | n5010 |
| C. | n50100 |
| Answer» B. n5010 | |
| 18. |
A_class_can_have_self-referential_data_members. |
| A. | True |
| B. | False |
| Answer» C. | |