

MCQOPTIONS
Saved Bookmarks
This section includes 3 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming Using C++ knowledge and support exam preparation. Choose a topic below to get started.
1. |
If two classes are defined Parent and Child then which is the correct type upcast syntax in C++? |
A. | Parent *p=child; |
B. | Parent *p=*child; |
C. | Parent *p=&child; |
D. | Parent *p=Child(); |
Answer» D. Parent *p=Child(); | |
2. |
Upcasting and downcasting objects are the same as casting primitive types. |
A. | True |
B. | False |
Answer» C. | |
3. |
Which among the following is the best situation to use upcasting? |
A. | For general code dealing with only subtype |
B. | For general code dealing with only supertype |
C. | For general code dealing with both the supertype and subtype |
D. | For writing a rigid code with respect to subtype |
Answer» C. For general code dealing with both the supertype and subtype | |