Object Oriented Programming MCQs

Page No. 74

If an object is declared inside the function then ____________________ outside the function.


a It can be returned by reference

✖


bIt can’t be returned by reference

✓


cIt can be returned by address

✖


dIt can’t be returned at all

✖



Which is the correct syntax for defining a function which passes an object by reference?


aclassName& functionName ( )

✓


bclassName* functionName( )

✖


cclassName-> functionName( )

✖


d&className functionName()

✖



Which is the correct syntax for returning an object by value?


avoid functionName ( ){ }

✖


bobject functionName( ) { }

✖


cclass object functionName( ) { }

✖


dClassName functionName ( ){ }

✓



Where the temporary objects (created while return by value) are created?Where the temporary objects (created while return by value) are created?


aOutside the function scope

✖


bWithin the function

✓


c Inside the main function

✖


d Inside the calling function

✖


View Answer Within the function

Whenever an object is returned by value ____________________


aA temporary object is created

✓


bTemporary object is not created

✖


cTemporary object may or may not be created

✖


dNew permanent object is created

✖



In which of the following way(s) can the object be returned from a function?


aan only be returned by value

✖


bCan only be returned by reference

✖


cCan be returned either by value or reference

✓


dCan neither be returned by value nor by reference

✖



Assigning objects takes place while passing the arguments.


aTrue

✖


bFalse

✓


cA & B

✖


d None of the above

✖


View Answer False

Assigning reference to an object _________________


aWill create another copy of the object

✖


bWill create two different copies of the object

✖


cWill not create any other copy of the object

✓


dWill not refer to the object

✖



We can assign ______________________


a Value of one reference variable to another

✓


bValue of any object to another

✖


c Value of any type to any object

✖


dValue of non – reference to another reference

✖



How to make more than one object refer to the same object?


aInitialize it to null

✖


b Initialize the object with another at declaration

✓


cUse constructor to create new object

✖


dAssign the address directly

✖



Goto Page No.

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