Object Oriented Programming MCQs

Page No. 37

If there is an abstract method in a class then, ________________


a Class must be abstract class

✓


bClass may or may not be abstract class

✖


cClass is generic

✖


dClass must be public

✖



Can abstract class have main() function defined inside it?


aYes, depending on return type of main()

✖


bYes, always

✓


cNo, main must not be defined inside abstract class

✖


dNo, because main() is not abstract function

✖


View Answer Yes, always

Which among the following best describes abstract classes?


a If a class has more than one virtual function, it’s abstract class

✖


bIf a class have only one pure virtual function, it’s abstract class

✖


cIf a class has at least one pure virtual function, it’s abstract class

✓


dIf a class has all the pure virtual functions only, then it’s abstract class

✖



Template classes must have at least one static member.


aTrue

✖


bFalse

✓


cA & B

✖


dNone of these

✖


View Answer False

How many generic types can be given inside a single template class?


aOnly 1

✖


bOnly 3

✖


c Only 7

✖


dAs many as required

✓


View Answer As many as required

If template class is defined, is it necessary to use different types of data for each call?


aNo, not necessary

✓


b No, but at least two types must be there

✖


cYes, to make proper use of template

✖


dYes, for code efficiency

✖


View Answer No, not necessary

What is the output of following program?


ax = 2 count = 0 x = 2.2 count = 0 x = 2.2 count = 0

✖


bx = 2 count = 0 x = 2 count = 0 x = 2.2 count = 0

✖


cx = 2 count = 0 x = 2 count = 1 x = 2.2 count = 0

✓


dx = 2 count = 0 x = 2 count = 1 x = 2.2 count = 2

✖



What if static members are declared inside template classes?


a All instances will share the static variable

✖


b All instances will have their own static variable

✓


cAll the instances will ignore the static variable

✖


d Program gives compile time error

✖



How is function overloading different from template class?


aOverloading is multiple function doing same operation, Template is multiple function doing different operations

✖


bOverloading is single function doing different operations, Template is multiple function doing different operations

✖


cOverloading is multiple function doing similar operation, Template is multiple function doing identical operations

✓


dOverloading is multiple function doing same operation, Template is same function doing different operations

✖



The _____________ class is a specialization of a more general template class.


aString

✓


bInteger

✖


cDigit

✖


d Math

✖


View Answer String

Goto Page No.

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