Object Oriented Programming MCQs

Page No. 63

Which objects can call the const functions?


aOnly const objects

✖


bOnly non-const objects

✖


cBoth const and non-const objects

✓


dNeither const not non-const objects

✖



Which keyword must be used to declare a member function as a constant member function?


aConstant

✖


bConst

✓


cFunctionConst

✖


dUnchanged

✖


View Answer Const

What are the constant member functions?


aFunctions which doesn’t change value of calling object

✓


bFunctions which doesn’t change value of any object inside definition

✖


cFunctions which doesn’t allow modification of any object of class

✖


dFunctions which doesn’t allow modification of argument objects

✖



If a function in java is declared private then it __________________


aCan’t access the standard output

✖


bCan access the standard output

✓


cCan’t access any output stream

✖


dCan access only the output streams

✖



Can main() function be made private?


aYes, always

✖


bYes, if program doesn’t contain any classes

✖


cNo, because main function is user defined

✖


dNo, never

✓


View Answer No, never

Which error will be produced if private members are accessed?


aCan’t access private message

✓


bCode unreachable

✖


cCore dumped

✖


dBad code

✖



A private function of a derived class can be accessed by the parent class.


aTrue

✖


bFalse

✓


cA & B

✖


d None of these

✖


View Answer False

If private members are to be called outside the class, which is a good alternative?


aCall a public member function which calls private function

✓


bCall a private member function which calls private function

✖


cCall a protected member function which calls private function

✖


dNot possible

✖



Which function among the following can’t be accessed outside the class in java in same package?


apublic void show( )

✖


bvoid show( )

✖


cprotected show( )

✓


dstatic void show( )

✖


View Answer protected show( )

Private member functions ____________


aCan’t be called from enclosing class

✓


bCan be accessed from enclosing class

✖


cCan be accessed only if nested class is private

✖


dCan be accessed only if nested class is public

✖



Goto Page No.

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