Object Oriented Programming MCQs

Page No. 82

Which concept is needed because of implicit type casting use?


aStatic binding

✖


bDynamic binding

✓


cCompile time binding

✖


d Source code binding

✖


View Answer Dynamic binding

Upcasting is _____________________ without an explicit type cast.


aAlways allowed for public inheritance

✓


bAlways allowed for protected inheritance

✖


cAlways allowed for private inheritance

✖


dNot allowed

✖



If class C inherits class B and class B inherits class A ________________


a Class C object can be upcasted to object of class B only

✖


bClass C object can be upcasted to object of class A only

✖


c Class C object can be upcasted to object of either class A or B

✓


dClass C object can’t be upcasted

✖



If multiple inheritance is implemented, which upcasting will be correct?


aUpcast to first base class listed in inheritance

✖


b Upcast to send base class listed in inheritance

✖


cUpcast to any base class

✓


dUpcast is not possible

✖



Which casting among the following is allowed for the code given below?


aCasting 1

✖


bCasting 2

✓


ccasting 1 and casting 2

✖


dcasting 1 nor casting 2

✖


View Answer Casting 2

Upcasting and downcasting objects are the same as casting primitive types.


a True

✖


bFalse

✓


cA & B

✖


d None of the above

✖


View Answer False

Which property is shown most when upcasting is used?


aCode reusability

✖


bCode efficiency

✖


cComplex code simple syntax

✓


d Encapsulation

✖



Which among the following is the best situation to use upcasting?


aFor general code dealing with only subtype

✖


bFor general code dealing with only supertype

✓


cFor general code dealing with both the supertype and subtype

✖


d For writing a rigid code with respect to subtype

✖



Which among the following is safe?


aUpcasting

✓


bDowncasting

✖


cBoth upcasting and downcasting

✖


dIf upcasting is safe then downcasting is not, and vice versa

✖


View Answer Upcasting

Which among the following is true for upcasting in inheritance?


aDownward to the inheritance tree

✖


bUpward to the inheritance tree

✓


cEither upward or downward

✖


dDoesn’t apply on inheritance

✖



Goto Page No.

Page 82 of 93

Alphabetical MCQs Categories
—

Here below You find all kind of categories of MCQs in alphabetical order.


"Comprehensive Collection of MCQs: Alphabetically Organized by Subject"
—

"Discover an extensive collection of multiple-choice questions (MCQs) neatly categorized by subject from A to Z. This resource is designed for anyone eager to explore various topics in a straightforward and organized manner. Whether you're a student preparing for exams, an educator seeking supplementary materials, or simply curious about different subjects, this compilation offers a convenient way to learn and assess your knowledge. With questions arranged alphabetically, navigation is effortless, allowing you to delve into subjects of interest at your own pace. Engage, learn, and expand your understanding with this accessible and comprehensive repository of MCQs!"


BolPakistan

bolpakistan.com.pk includes Job Mcqs and Pak Mcqs is the Top Largest Mcqs Forum in World, in which you can read Mcqs of All Subjects, PPSC test preparation, FPSC, NTS and PPSC PAST PAPERS, PPSC PAST MCQS. A Collection of Repeated MCQs for JOBs seekers.

Copyright © 2024, Designed & Developed by BolPakistan