Object Oriented Programming MCQs

Page No. 18

When is it advised to have user defined destructor?


aWhen class contains some pointer to memory allocated in class


b When a class contains static variables


cWhen a class contains static functions


dWhen a class is inheriting another class only



Global destructors execute in ___________ order after main function is terminated.


aSequential


bRandom


cReverse


dDepending on priority


View Answer Reverse

Destructors can be ________


aAbstract type


bVirtual


cVoid


d Any type depending on situation


View Answer Virtual

Destructors doesn’t accept parameters.


aTrue


b False


cA & B


d None of the above


View Answer True

How the constructors and destructors can be differentiated?


aDestructor have a return type but constructor doesn’t


bDestructors can’t be defined by the programmer, but constructors can be defined


c Destructors are preceded with a tilde (~) symbol, and constructor doesn’t


dDestructors are same as constructors in syntax



When is the destructor of a global object called?


aJust before end of program


b Just after end of program


cWith the end of program


dAnytime when object is not needed



Choose the correct sequence of destructors being called for the following code.


a~A(), ~B(), ~C()


b~B(), ~C(), ~A()


c~A(), ~C(), ~B()


d ~C(), ~B(), ~A()


View Answer ~C(), ~B(), ~A()

f in multiple inheritance, class C inherits class B, and Class B inherits class A. In which sequence are their destructors called if an object of class C was declared?


a~C() then ~B() then ~A()


b~B() then ~C() then ~A()


c~A() then ~B() then ~C()


d ~C() then ~A() then ~B()



Which among the following is correct for abstract class destructors?


aIt doesn’t have destructors


b It has destructors


c It may or may not have destructors


dIt contains an implicit destructor



When a destructor is called?


aAfter the end of object life


bAnytime in between object’s lifespan


c At end of whole program


d Just before the end of object life



Goto Page No.

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