OODP Unit-2 QB
OODP Unit-2 QB
8
Which of the following operator is overloaded for object cout?
a. >>
b. << CO2 BT1
c. +
d. =
9 Assume class TEST. Which of the following statements is/are
responsible to invoke copy constructor?
a. TEST T2 (T1)
CO2 BT2
b. TEST T4 = T1
c. T2=T1
d. Both A and B
10 Which of the following is the perfect set of operators that can’t be
overloaded in CPP?
a. +=, ?, :: , >> CO2 BT2
b. >>, <<, ?,*,sizeof()
c. ::, ., .*, ?:
d. ::, ->, *, new delete
11 How many operators are supported by C++?
a. 30 operators
b. 40 operators CO2 BT1
c. 45 operators
d. 65 operator
12 A non-member function that is given access to all members of a class
within it is declared, is called
a. Access function
CO2 BT1
b. Friend function
c. Operator functions
d. None of them
13 Which of the following operators should be preferred to overload as a
global function rather than a member method?
a. Postfix ++
CO2 BT1
b. Comparison Operator
c. Insertion Operator <<
d. Prefix++
14 We can overload which of the following C++ operators
a. Arithmetic operator (+, -, *, /) CO2 BT2
b. Class Member Access Operators (., .*)
c. Size operator (sizeof)
d. Conditional operator (?:)
15 Operator overloading is also called …………….. polymorphism
a. run time
b. initial time CO2 BT1
c. Compile time
d. Completion time
16 Operator overloading is done with the help of a special function called
……………, which describes the special task of an operator.
a. overloading function
CO2 BT1
b. special task function
c. detail function
d. operator function
17 Overload an operator by naming it a
a. variable
b. built-in type CO2 BT1
c. function
d. class
18 Which of the function operator cannot be over loaded
a. <=
b. ?: CO2 BT2
c. ==
d. *
19 Kind of diagrams which are used to show interactions between series of
messages are classified as
a. activity diagrams
CO2 BT1
b. state chart diagrams
c. collaboration diagrams
d. object lifeline diagrams
20 Dynamic aspects related to a system are shown with help of
a. sequence diagrams
b. interaction diagrams CO2 BT1
c. deployment diagrams
d. use case diagrams
21 Determine which diagrams are used to show interactions between series
of messages
a.Activity diagrams
CO2 BT1
b. State Chart diagrams
c. Collaboration diagrams
d. Object Lifeline diagrams
22 Identify the syntax of overloading operator + for class A?
a.A operator + (arg_list){}
b. A operator [+] (arg_list){} CO2 BT1
c. int +(arg_list){}
d. int [+](arg_list){}
23 Classify three different types of message arrows
a. Synchronous, asynchronous, asynchronous with instance creation
b. Self, multiplied, instance generator
CO2 BT1
c. Synchronous, asynchronous, synchronous with instance
creation
d. None of the above
24 Which feature of OOP indicates code reusability?
a. Abstraction
b. Polymorphism CO2 BT1
c. Encapsulation
d. Inheritance
25 For constructor overloading, each constructor must differ in
___________ and __________
a. Number of arguments and type of arguments
b. Number of arguments and return type
c. Return type and type of arguments CO2 BT1
d. Return type and definition
PART B
10 Define overloading unary and binary operators with an example CO2 BT2
PART C
1 Define UML Sequence diagram with its notations. Draw the sequence CO2 BT4
diagram for Online hotel management
2 Write a C++ program for Constructor overloading (parameterized, CO2 BT3
default and copy)
3 Define Sequence and Collaboration diagram. Draw the sequence and CO2 BT4
collaboration diagram for ATM amount withdrawal
4 Define interaction diagram. Draw an Sequence diagram for online CO2 BT4
hospital management
5 Explain in detail about operator overloading and its types with example CO2 BT3