0% found this document useful (0 votes)
19 views

Chap Functionoverloading, Const, Inhertiance MCQs

Computer 2nd puc function overloading mcqs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Chap Functionoverloading, Const, Inhertiance MCQs

Computer 2nd puc function overloading mcqs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Chapter 8: Function Overloading

1. Function cannot be overloaded when -


(a) Function names are same
(b) Number of parameters are different
(c) Number of parameters are same
(d) Data types of parameters are different
2. Function can be overloaded when
(a) Function names are same (c) The data types of parameters are
(b) Number of parameters are different
different (d) All the above
3. Friend function is a
(a) Non member function of class (c) Both a and b
(b) Can access both private and (d) None of the above
protected members
4. C++ Implements polymorphism through
(a) Inline function
(b) Friend function

(c) Function overloading and operator overloading


(d) Both a and b
5. Need for function overloading is
(a) Code maintenance is easy
(b) Easy to understand the flow of information and debug
(c) Easier interface between program and real world objects
(d) All the above
6. The Restrictions on overloaded functions are
(a) Each function in a set of overloaded function must have different argument list
(b) If typedef is used for naming functions then the function is not considered as differenttype
(c) Both a and b
(d) None of the above
7. The other functions used in class are
(a) Overloaded functions (c) Friend function
(b) Inline functions (d) All the above
8. The inline function means
(a) Very long function (c) Short function
(b) Can contain too complicated code (d) Both a and b
9. The inline function can be
(a) Very short function

(b) The compiler replace function call with (c) Both a and b
function code (d) None of the above
10. The advantages of inline functions are
(a) Inline functions are compact (c) Very efficient code can be
function calls generated
(b) The size of object code is reduced (d) All the above
11. In which type of functions, the compiler replaces the function call statement with thefunction
code is
(a) Friend function b) Inline function c) Function overloading d) Both a and b
12. In which function category two or more function have same name but different in numberof argument
list and their data type.
(a) Function overloading (b)Inline function
(c) Friend function (d) All the above
13. The inline function cannot include the
(a) goto statement (b) looping (c) Recursive function body (d) all the above
14. The keyword to create the inline function is
(a) Friend (b) private (c) Class (d) inline
15. The friend function means
(a) A short function
(b) run little faster
(c) can access private and protected members outside the class.
(d) Both a and b
16. Using friend function members are accessed using following syntax
(a) Objectname.membername (c) Only membername
(b) Only object name (d) All the above

17. While defining friend function it does not use either keryword or __operator.
(a) & or . (b) friend or :: (c) objectname.membername or objectname (d) all theabove
18. How to accesses the member of the friend function
(a) Member are accessed directly using member names
(b) Specifying objectname.membername
(c) Any above method
(d) All the above methods
19. The friend function declaration in the class is of
(a) Only public scope
(b) Only private scope
(c) Only Protected scope
(d) Can be any scope in the class (private, protected, public)
20. A friend function is a of a class
(a) Non member function (c) Inline function
(b) Private function (d) Public function of a class

21. Use of friend function is rare since it violates the rule of


(a) Encapsulation (c) Both a and b
(b) Data hiding (d) None of the above
22. Function overloading is not possible when
(a) Function name are same
(b) Number of arguments are different

(c) Number and data types or arguments are same


(d) Data types of argument are different
23. Inline function may not work when
(a) Function has looping (c) Function has recursive function
(b) Function has switch or goto (d) All the above
24. Friend function can access members of class
(a) Private (c) Protected
(b) Public (d) All the above
25. How friend function can access members of class
(a) Using dot (.) operator

(b) Using objectname.membername with each membername


(objectname.membername)
(c) Using objectname’
(d) Using classname and object name
26. The Function overloading can include
(a) Ordinary functions
(b) Member function
c) Both a and b
d) Only member function
27. The disadvantage of inline functions can also be
(a) The size of the executable file increases and more memory needed
(b) The body of inline function is substituted in place of function call
(c) Both a and b
(d) None of the above

28. The feature of friend function may include


(a) These are normal external functions with special rights
(b) These are very common functions
(c) These are invoked like normal functions
(d) Both a and c
29. The inline functions are defined inside the class
(a) Member function (c) may contain goto and switch
(b) too complex functions (d) none of the above
30. The prefix used with friend functions is

(a) friend (b) inline (c) void (d) class


31. The friend function must be declared within with friend keyword
(a) Class (b) outside class (c) using :: operator (d)all the above
32. The friend function definition must be written without the prefix friend or :: operator.
(a) Outside the class
(b) Inside the class only
(c) Can be written both inside and outside
(d) All the above
33. The friend function can access the public data members like functions
(a) Non member (c) External function
(b) Member functions (d) None of the above
*********************************
Chapter 9 : CONSTRUCTORS AND DESTRUCTORS
1. Automatic initialization of object is carried out using a special member function called
a) constructors b) destructors c) friend functions d) inlinefunctions.
2. Constructors are called automatically when_
a) object is destroyed b) object is created c) class is created d)constructor iscreated
3. constructs the values of the data members of the class.
a) destructors b) constructors c) class d) member function
4. Constructors name is same as name.
a) class b) member function c)object d)member data
5. Constructors should be declared in
a) protected section b)private section c) public section d)anywhere inside class
6. There is no for constructors.
a) arguments b)parameters c) return-type d) object
7. makes implicit calls to the operators new and delete when memory allocation is required.
a)class b)object c)constructors d)member function
8. Default constructor is also called as
a)zero parameterized constructor b) copy constructors
c)parameterized constructor d)destructors
9. Which of the following is not a type of constructors.
a. default constructors b)parameterized constructors c) copy constructors
d)destructors
10. …………. are useful when the object are need to be created without having to type
initial values.
a)copy constructors b)default constructors
c)parameterized constructors d) destructors
11. When is declared for a class initialization of objects is done automatically.
a) constructors b)object c) destructorsd)interface
12. All objects of a class are initialized to same set of values by
a) copy constructors b)default constructors
c)parameterized constructors d)destructors
13.When user defined class does not contain an explicit constructors, compilers automatically invokes
__________ constructors.
a) copy b) default c) parameterized d)argument
14. Declaring constructors with argument it hides constructors.
a) default b)parameterized c)copy d)argument
15. It is no possible to initialize different objects with different initial values using
a) copy constructors b) parameterized constructors
c) default constructors d)destructors
16. A constructors that takes one or more arguments are called _ constructors
a) copy b)default c)parameterized d)zero argument
17. Using constructors it is possible to initialize different object with different values
a)copy b) parameterized c) default d)zero argument
18. constructors are invoked automatically when objects with arguments are created.
a) copy b)default c)zero parameterizedd)parameterized
19. constructors can be over loaded
a) parameterized b) default c)zero argument d)zero parameterized
20. constructors can have default arguments and default values.
a) default b) zero argument c)parameterized d) zero parameterized
21. Constructors can be invoked through
a) explicit call b) implicit call
c)initialization at the time of declaration with =operator d) all of the above
22. declaration of an object is followed by assignment operator, constructor name and
argument list enclosed in parenthesis
a) explicit call b) implicit call
c)initialization at the time of declaration with =operator d) none of the above
23. In declaration of an object is followed by argument list enclosed in parenthesis.
a) explicit call b. implicit call
b) initialization at the time of declaration with =operator d. none of the above
24. method is used for constructor with exactly one argument.
a) explicit call b) implicit call
c)initialization at the time of declaration with =operator d) destructors
25. In declaration is followed by assignment operator and value to be initialized
a) explicit call b) implicit call
c)initialization at the time of declaration with =operator d) none of the above
26. Using constructors one object can be copied to another object.
a) copy b)default c)zero parameterized d)parameterized
27. constructors are used to initialize an object with values of already existing objects
a) copy b)default c)zero parameterized d)parameterized
28. constructors are used to return object as function values
a) copy b)default c)zero parameterized d)parameterized
29. constructors are used to state object as by value parameter of a function
a) default b)parameterized c)copyd)argument
30. Copy constructors is not invoked
a) explicitly b) implicitly c)initialization at the time of declaration with =operator d) normally
31. When a new object is declared and existing object is passes as a parameter to it in the declaration
constructors are invoked
a) default b)parameterized c)copy d)argument
32. is called automatically when the object is destroyed.
a)destructors b)constructors c)class d)interface
33. Which operator is used with destructors?
a) :: b)& c)~ d) *
34. is used to de-allocate memory that was allocated for the object by the constructors.
a)class b)interface c) destructors d)constructors
35. takes no arguments
a)parameterized constructors b)copy constructors
c)argument constructors d)destructors
Chapter 10 : INHERITANCE
1. provides the concept of Reusability
a) procedural programming b)inheritance c)class d)functions
2. allows the user to create a new class from an already existing class
a) inheritance b)classc)polymorphism d)binding
is the capability of one class to inherit properties from another class.
a)polymorphism b)binding c)overloading d)inheritance
3. is a class whose properties are inherited by another class
a)sub class b)base class c) derived class d)virtual class
4. is a class that inherits properties from base class
a)sub class b)base class c)super class d)virtual class
5. Base class is also called as
a)sub class b)derived class c)virtual classd)super class
6. Derived class is also called as
a)super class b)abstract class c)base class d)sub class
7. Which of the following is the advantage of inheritance.
a)reusing existing code b) faster development time c)memory utilizationd)all of
these
8. If no visibility mode is specified then by default the visibility mode is considered as

a) private b)protected c)public d)explicit


9. All the members of the class except members are inherited.
a) private b)protected c)public d)explicit
10. operator shows the derivation from the base class in inheritance.
a):: b)& c): d) *
11. specifies the features of base class are privately derived or publicly derived or protected
derived
a) visibility mode b) derivation c)inheritance d)polymorphism
12. controls the access specifiers to be for inheritable member of base class in the derived
class
a) overloading b) visibility mode c)inheritance d)polymorphism
13. In private inheritance the public members of base class becomes members of
derived class
a) private b)protected c)public d)not inherited
14. In private inheritance the protected members of base class becomes……membersof derived class
a) protected b)private c)public d)not inherited
15. In protected inheritance the public members of base class becomes ___membersof derived class.
a) private b)protected c)public d)not inherited
16. In protected inheritance the protected members of base class becomes
members of derived class.
a) protected b)private c)public d)not inherited
17. In public inheritance the public members of base class becomes members of
derived class.
a) protected b)private c)public d)not inherited
18. In public inheritance the protected members of base class becomes members
of derived class.
a) protected b)private c)public d)not inherited
19. In public inheritance the private members of base class becomes members of
derived class.
a) protected b)private c)public d)not inherited
20. If a class is derived from single base class it is inheritance
a)single level b)multilevel c)multiple d)hybrid
21. If a class is derived from an already derived class then it is inheritance
a)single level b)multilevel c)multiple d)hybrid
23. If class is derived from more than one base class then it is inheritance
a)single level b)multilevel c)multiple d)hybrid
24.If more than one class is derived from a single base class is called inheritance
a)single level b)multilevel c)multiple d)hierarchical
25. inheritance is a combination of hierarchical and multilevel inheritance
a)single level b)multilevel c)multiple d)hybrid
26. We can prevent multiple copies of base class being present in an object from thoseobjects by
declaring the base class as
a)virtual b) abstract c) derived d)private
27. class is one that is not used to create an object.
a)virtual b) abstract c) derived d)sub
28. When it is mandatory to have constructors in derived class.
a) no base class constructors takes any arguments
b) base class having constructors with one are more arguments
c) if the is default constructors in bas class d) if there is no constructors in baseclass
29. takes the responsibility of supplying initial values to its base class
a) super class b) virtual class c)derived class d)abstract class
*************

You might also like