Object Oriented Programming MCQs

Page No. 28

All member functions of a local class must be ___________


a Defined outside class body


bDefined outside the function definition


cDefined inside the class body


dDefined at starting of program



What are local classes?


aClasses declared inside a package


bClasses declared inside a function


cClasses declared inside a class


dClasses declared inside structure



A static nested class is _____________ class in behavior that is nested in another _________ class.


aTop level, top level


b Top level, low level


cLow level, top level


d Low level, low level


View Answer Top level, top level

If a declaration of a member in inner class has the same name as that in the outer class, then ________________ enclosing scope.


aOuter declaration shadows inner declaration in


bInner declaration shadows outer declaration in


c Declaration gives compile time error


dDeclaration gives runtime error



Instance of inner class can exist only _______________ enclosing class.


aWithin


bOutside


cPrivate to


dPublic to


View Answer Within

How to create object of the inner class?


aOuterClass.InnerClass innerObject = outerObject.new InnerClass();


b OuterClass.InnerClass innerObject = new InnerClass();


cInnerClass innerObject = outerObject.new InnerClass();


d OuterClass.InnerClass = outerObject.new InnerClass();



A nested class can have its own static members.


aTrue


bFalse


cA & B


dNone of these


View Answer False

How to access static nested classes?


aOuterClass.StaticNestedClass


bOuterClass->StaticNestedClass


cOuterClass(StaticNestedClass)


dOuterClass[StaticNestedClass]



Which among the following is the correct advantage/disadvantage of nested classes?


aMakes the code more complex


bMakes the code unreadable


c Makes the code efficient and readable


dMakes the code multithreaded



Use of nested class ____________ encapsulation.


a Increases


bdecreases


cDoesn’t affect


dSlightly decreases]


View Answer Increases

Goto Page No.

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