Object Oriented Programming MCQs

Page No. 24

What is the keyword used to make data members have same value?


astatic

✖


b const

✓


cdouble

✖


dabstract

✖


View Answer const

A class can have self-referential data members.


aTrue

✖


bFalse

✓


cA & B

✖


dNone of these

✖


View Answer False

The static member functions can only use ________


aStatic data members

✓


bPrivate data members

✖


cProtected data members

✖


d Constant data members

✖


View Answer Static data members

What is the output of following code?


a1050100

✖


b1005010

✖


cn5010

✖


dn50100

✓


View Answer n50100

Which among the following is true for use of setter() and getter() function?


aConsidered best for manipulating data values

✖


bConsidered the only proper way to manipulate the values

✖


c Considered specially for private members manipulation

✖


d Considered a red flag, and not recommended for large scale use

✓



To create a pointer to a private data member of a class, outside the class, which among the following is correct?


aReturn the address of the private data member using a member function

✓


b Access the private member using a pointer outside class

✖


cDeclare the member as pointer inside the class

✖


dNot possible to create pointer to a private member

✖



How to access data members of a class?


a Dot operator

✖


bArrow operator

✖


cDot or arrow as required

✓


dDot, arrow or direct call

✖



How many data members can a class contain?


a27

✖


b255

✖


c1024

✖


dAs many as required

✓


View Answer As many as required

What should be done for data member to be of user defined structure type?


aThe structure must have been defined before class.

✓


bThe structure must have been defined after the class definition

✖


cThe structure must be predefined

✖


d The structure type data members can’t be used

✖



Which among the following is true for data members?


aPrivate data members can be initialized with declaration in class

✖


bStatic members are initialized in constructors

✖


cProtected data members can be initialized in class directly

✖


dStatic data members are defined outside class, not in constructor

✓



Goto Page No.

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