Object Oriented Programming MCQs

Page No. 12

If constructors of a class are defined in private access, then __________


aThe class can’t be inherited


bThe class can be inherited


cInstance can be created only in another class


dInstance can be created anywhere in the program



When is the static constructor called?


aAfter the first instance is created


bBefore default constructor call of first instance


cBefore first instance is created


dAt time of creation of first instance



Default constructor initializes all data members as ___________


aAll numeric member with some garbage values and string to random string


bAll numeric member with some garbage values and string to null


cAll numeric member with zero and strings to random value


dAll numeric member with zero and strings to null



Within a class, only one static constructor can be created.


aTrue


bFalse


cA & B


d None of these


View Answer True

Which among the following is true for static constructor?


aStatic constructors are called with every new object


bStatic constructors are used initialize data members to zero always


cStatic constructors can’t be parameterized constructors


dStatic constructors can be used to initialize the non-static members also



When and how many times a static constructor is called?


aCreated at time of object destruction


bCalled at first time when an object is created and only one time


cCalled at first time when an object is created and called with every new object creation


dCalled whenever an object go out of scope



Why do we use static constructors?


aTo initialize the static members of class


bTo initialize all the members with static value


cTo delete the static members when not required


dTo clear all the static members initialized values



Which type of constructor can’t have a return type?


aDefault


bParameterized


cCopy


dConstructors don’t have a return type



Which among the following is true?


aDefault constructor can’t be defined by the programmer


bDefault parameters constructor isn’t equivalent to the default constructor


cDefault constructor can be called explicitly


dDefault constructor is and always called implicitly only



Which specifier applies only to the constructors?


a Public


bProtected


cImplicit


dExplicit


View Answer Explicit

Goto Page No.

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