Object Oriented Programming MCQs

Page No. 80

If a member function have to be made both zero argument and parameterized constructor, which among the following can be the best option?


aTwo normal and one default argument


bAt least one default argument


c Exactly one default argument


dMake all the arguments default



If a member function have to be made both zero argument and parameterized constructor, which among the following can be the best option?


aTwo normal and one default argument


bAt least one default argument


cExactly one default argument


d Make all the arguments default



Which is the correct condition for the default arguments?


aThose must be declared as last arguments in argument list


b Those must be declared first in the argument list


cThose can be defined anywhere in the argument list


d Those are declared inside the function definition



What are default arguments?


aArguments which are not mandatory to be passed


b Arguments with default value that aren’t mandatory to be passed


cArguments which are not passed to functions


dArguments which are not passed to functions



Which is a good alternative instead of having one zero argument constructor and one single argument constructor with default argument?


aNo constructor defined


bOne default value constructor


cDefining the default constructor


dUsing one constructor with two arguments



If there is a constructor with all the default arguments and arguments are not passed then _________________


aThe default values given will not be used


bThen all the null values will be used


cThen all the default values given will be used


dThen compiler will produce an error



Which constructor definition will produce a compile time error?


aclassName(int x=0);


bclassName(char c);


cclassName(int x=0,char c);


dclassName(char c,int x=0);



Which constructor among the following will be called if a call is made like className(5,’a’);?


aclassName(int x=5,char c=’a’);


b int className(int x, char c, char d);


cclassName(int x, char c, int y);


d char className(char c,int x);



If the constructors are overloaded by using the default arguments, which problem may arise?


aThe constructors might have all the same arguments except the default arguments


bThe constructors might have same return type


c The constructors might have same number of arguments


dThe constructors can’t be overloaded with respect to default arguments



How many parameters must be passed if only the following prototype is given to a constructor? Prototype: className(int x, int y, int z=0);


a1


b2


c3


dCompile time error


View Answer 2

Goto Page No.

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