Object Oriented Programming MCQs

Page No. 22

If a constructor is defined in protected access, then?


aIt’s instance can be created inside the subclasses

✓


bIt’s instance can be created anywhere in the program

✖


cIt’s instance can be created inside the subclasses and main() function

✖


dIt’s instance can be created inside the parent class only

✖



Which among the following best describes the protected specifier?


aMembers are most secure and can’t be used outside class

✖


bMembers are secure but can be used outside the class

✖


cMembers are secure as private, but can be inherited

✓


dMembers are secure like private, but can’t be inherited

✖



Which specifier allows to secure the public members of base class in inherited classes?


aPrivate

✖


bProtected

✖


cPublic

✖


dPrivate and Protected

✓


View Answer Private and Protected

In multi-level inheritance(all public), the public members of parent/superclass will ________


aWill continue to get inherited subsequently

✓


bWill not be inherited after one subclass inheritance

✖


cWill not be available to be called outside class

✖


dWill not be able to allocated with any memory space

✖



If a class doesn’t have public members, then________


aNone of its members will be able to get inherited

✖


bNone of its instance creation will be allowed

✖


cNone of its member function can be called outside the class

✓


dNone of its data members will be able to get initial value

✖



Which among the following is true for public class?


aThere can be more than one public class in a single program

✖


bPublic class members can be used without using instance of class

✖


cPublic class is available only within the package

✖


dPublic classes can be accessed from any other class using instance

✓



Which specifier can be used to inherit protected members as protected in subclass but public as public in subclass?


aPrivate

✖


bDefault

✖


cPublic

✓


dProtected

✖


View Answer Public

A class has its default constructor defined as public. Class B inherits class A privately. The class ___________


aB will not be able to have instances

✖


b Only A can have instances

✖


cOnly B can have instances

✖


dBoth classes can have instances

✓



Which among the following for public specifier is false?


aThe static members can’t be public

✓


bThe subclasses can inherit the public members privately

✖


cThere can be only one public class in java program

✖


dThe static members can’t be public

✖



What is the output of the following code?


aOutput is: object created

✖


bOutput is: object createdobject created

✖


cCompile time error

✓


dRun time error

✖


View Answer Compile time error

Goto Page No.

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