Object Oriented Programming MCQs

Page No. 65

If a class have a public member function and is called directly in the main function then ___________________________


aUndeclared function error will be produced


bOut of memory error is given


cProgram gives warning only


d Program shut down the computer



A derived class object can access the public members of the base class.


aTrue


bFalse


cA & B


d None of these


View Answer False

If public members are to be restricted from getting inherited from the subclass of the class containing that function, which alternative is best?


aMake the function private


bUse private inheritance


cUse public inheritance


dUse protected inheritance



Which public function call among the following is correct outside the class, if return type is void (C++)?


aobject.void functionName(parameters);


bobject.functionName(parameters);


cobject.functionName void (parameters)


dobject.void functionName();



Which call is correct for public members of a nested class?


aCan be called from object of enclosing class


bCan be called within enclosing class only with direct names


cDirect names should be used for the nested classes


dOnly with help of nested class object pointer



Which is not a proper way to access public members of a class?


aUsing object pointer with arrow operator


bUsing object of class in main function


cUsing object of class with arrow operator


dUsing object anywhere in the program



How many public members are allowed in a class?


aOnly 1


bAt most 7


cExactly 3


dAs many as required


View Answer As many as required

In java, which rule among the following is applicable?


aKeyword public can’t be preceded with all the public members


bKeyword public must be preceded with all the public members


cKeyword public must be post mentioned the function declaration


dKeyword public is not mandatory



Which syntax is applicable to declare public member functions in C++?


apublic:


bpublic()


cpublic void


dpublic::


View Answer public:

Which syntax among the following is correct for public member functions?


apublic::void functionName(parameters)


bpublic void functionName(parameters)


cpublic(void functionName(parameters))


dpublic:-void functionName(Parameters)



Goto Page No.

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