2nd PUC computer science
Chapter-8: Function overloading MCQs-2024:Test-1
Q1.A)the inline function is a compact function B) inline function run little slower than normal function C)very efficient code can be generated.
a.both A and C are correct
b.both A and B are correct
c.both B and C are correct
d.All A,B,C, are correct view Answer
ans: a.both A and C are correct
Q2.(A) each function in a set of overloaded function must have different arugument list (B).if type of is used for naming function from the function is not considered as different types (C). in function overloding two or more function having same name
Reason (R): intrger data structures directly operated upon by machine level instructions.
a.Both A and B are correct
b.Both A and C are correct
c.Both B and C are correct
d.All A,B,C are correct view Answer
ans:d.All A,B,C are correct
Q3.(A)The inline function should be defined before all the functions call it (B).Inline function run little faster than normal function
a.A is true b is false
b.Both A and B are true
c.Both A and B are false
d.A is false B is true
view Answer
ans:b.Both A and B are true
Q4.which is the Disadvatages of inline function
a.The speed of execution of a progran increases
b.Very efficient code can be generated
c.The size of the executable file increases and more memory is needed
d.All of the above view Answer
ans:c.The size of the executable file increases and more memory is needed
Q5.in which situation inline function may not work
a.the inline function is recursive
b.the inline function has looping statement
c.the inline function has switch or goto
d.all of the above view Answer
ans:d.all of the above
Q6.Friend function is a
a.member function
b.inline function
c.non member function
d.special member function
view Answer
ans:c.non member function
Q7.(A)the friend fuction is declared with keyword friend (B) while defining friend function we use either keyword friend or :: operator (C).A friend function cannot be called using the object of that class
a.only A is correct
b.only C is correct
c.all A,B,C are correct
d.none of the above
view Answer
ans:c.all A,B,C are correct
Q8.A non member function of a class that has occess to both private and protected members is called
a.constructor function
b.inline function
c.friend function
d.destructor function
view Answer
ans:c.friend function
Q9.Function cannot be overloaded
a.function names are same
b.number of parameters are different
c.number of parameters are same
d.data types of parameters are different
view Answer
ans: c.number of parameter are same
Q10.Overloaded functions are
a.very long functions that can hardly run
b.One function contaning another one or more function inside it
c.Two or more functions with the same name but different number of parameters or type
d.None of the above
view Answer
ans:c.Two or more functions with the same name but different number of parameters or type
Q11.in which conditions inline function may not work
a.Function is lengthy
b.Recursive
c.looping
d.All of the above
view Answer
ans:d.All of the above
Q12.Function overloading is also known as_________
a.Polymorphism
b.data abstraction
c.Message passing
d.Compile time polymorphism
view Answer
ans:d.Compile time polymorphism
Q13.Friend function must be declared in ___________ section
a.Private
b.protected
c.public
d.In any section ( private or public or protected)
view Answer
ans: d.In any section ( private or public or protected)
Q14.How Friend function can access member of a class
a.using dot operator with each member name
b.using only object name
c.using object name and dot operator with each member name
d.using class name and object name
view Answer
ans:c.using object name and dot operator with each member name
Q15.which function replace function call with function body
a.friend function
b.inline function
c.non-member function
d.destructor function
view Answer