Object Oriented Programming MCQs

Page No. 62

If const version of a function when overloading is used, the function ___________________


aReturns reference to object

✖


bReturns volatile reference

✖


cReturns mutable reference

✖


dReturns const reference

✓



Functions which differ in const-ness are considered ______________________


aTo have same signature

✖


bTo have different signature

✓


cTo produce compile time error

✖


dTo produce runtime error

✖



If a function is to be made const, which is the correct syntax?


aconst functionName(parameters);

✖


bconst returnType functionName(parameters);

✓


cconst functionName(returnType)(Parameters);

✖


dconst (functionName(parameters));

✖



When both the const and non-const version of functions are required?


aReturn value have to be different in const

✓


bReturn value have to be same in const

✖


cReturn values have to be ignored

✖


dReturn values have to be suppressed

✖



How is it possible to have both const and non-const version of a function?


aFunction overriding

✖


bFunction prototyping

✖


cFunction overloading

✓


dFunction declaring

✖


View Answer Function overloading

A function can have both the const and non-const version in the same program.


aTrue

✓


bFalse

✖


cA & B

✖


d None of these

✖


View Answer True

Can a constructor function be constant?


aYes, always

✖


bYes, only if permissions are given

✖


cNo, because objects are not involved

✖


dNo, never

✓


View Answer No, never

If a const object calls a non-const member function then ____________________


aRun time error may get produced

✖


bCompile time error may get produced

✓


cEither compile time or run time error is produced

✖


dThe program can’t be compiled

✖



Which is the correct condition on const member functions?


aConst member functions can’t call non-const member functions

✓


bConst member functions can’t call any other function

✖


cConst member functions can call only the functions which are neither const nor non-const

✖


dConst member functions can call only data members of call not member functions

✖



Non-const functions _______________________


aCan be called only from non-const object

✓


bCan be called only from const object

✖


cCan be called both by const and non-const object

✖


dCan’t be called with object

✖



Goto Page No.

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