Object Oriented Programming MCQs

Page No. 81

Which is the correct syntax for using default arguments with the constructor?


adefault constructorName(default int x=0)


bconstructorName(default int x=0)


cconstructorName(int x=0)


dconstructorName()



Can a class have more than one function with all the default arguments?


a Yes, always


b Yes, if argument list is different


c Yes, if argument list is different


d No, never


View Answer No, never

Which among the following can be used in place of default constructor?


a constructorName(int x, int y=0)


bconstructorName(int x=0, int y=0)


cconstructorName(int x=0, int y)


d constructorName(int x, int y)



The Constructors with all the default arguments are similar as default constructors.


aTrue


b False


cA & B


d None of these


View Answer True

If a constructors should be capable of creating objects without argument and with arguments, which is a good alternative for this purpose?


aUse zero argument constructor


b Use constructor with one parameter


c Use constructor with all default arguments


dUse default constructor



Which among the following is true for constructors overloading?


aConstructors can’t be overloaded


bConstructors can be overloaded using different signatures


cConstructors can be overloaded with same signatures


dConstructors can be overloaded with different return types



Which among the following is true?


aUpcasting is possible only for single level inheritance


bUpcasting is possible only for multilevel inheritance


cUpcasting is possible only for multiple inheritance


dUpcasting is possible for any type of inheritance



If two classes are defined “Parent” and “Child” then which is the correct type upcast syntax in C++?


aParent *p=child;


bParent *p=*child;


cParent *p=&child;


dParent *p=Child();


View Answer Parent *p=&child;

When are the object type known for upcasting the objects?


aCompile time


bRuntime


cSource code build time


dDoesn’t apply to objects directly


View Answer Runtime

When are the pointer types known for upcasting the objects?


aCompile time


bRuntime


cSource code build time


dDoesn’t apply to pointer types


View Answer Compile time

Goto Page No.

Page 81 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