Object Oriented Programming MCQs

Page No. 11

If the object is passed by value to a copy constructor?


aOnly public members will be accessible to be copied


bThat will work normally


cCompiler will give out of memory error


dData stored in data members won’t be accessible



Which among the following is true for copy constructor?


aThe argument object is passed by reference


b It can be defined with zero arguments


cUsed when an object is passed by value to a function


dUsed when a function returns an object



If class C inherits class B. And B has inherited class A. Then while creating the object of class C, what will be the sequence of constructors getting called?


aConstructor of C then B, finally of A


bConstructor of A then C, finally of B


cConstructor of C then A, finally B


dConstructor of A then B, finally C



Default constructor must be defined, if parameterized constructor is defined and the object is to be created without arguments.


aTrue


bFalse


cA & B


d None of these


View Answer True

If a programmer defines a class and defines a default value parameterized constructor inside it. He has not defined any default constructor. And then he try to create the object without passing arguments, which among the following will be correct?


a It will not create the object (as parameterized constructor is used)


bIt will create the object (as the default arguments are passed)


cIt will not create the object (as the default constructor is not defined)


dIt will create the object (as at least some constructor is defined)



How many types of constructors are available for use in general (with respect to parameters)?


a2


b3


c4


d5


View Answer 2

In which access should a constructor be defined, so that object of the class can be created in any function?


aPublic


bProtected


cPrivate


dAny access specifier will work


View Answer Public

Which among the following is correct?


aclass student{ public: int student( ){ } };


bclass student{ public: void student ( ){ } };


cclass student{ public: student{ }{ } };


dclass student{ public: student( ){ } };



Which among the following is not a necessary condition for constructors?


aIts name must be same as that of class


bIt must not have any return type


cIt must contain a definition body


dIt can contains arguments



Which among the following is called first, automatically, whenever an object is created?


aClass


bConstructor


cNew


dTrigger


View Answer Constructor

Goto Page No.

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