0% found this document useful (0 votes)
23 views5 pages

OODP Unit-2 QB

The document is a question bank for the course 21CSC101T – Object-Oriented Design and Programming at SRM Institute of Science and Technology, focusing on concepts such as constructors, destructors, polymorphism, operator overloading, and UML interaction diagrams. It includes multiple choice questions and descriptive questions covering various topics related to object-oriented programming. The document is structured into three parts: Part A consists of multiple choice questions, Part B contains descriptive questions, and Part C includes practical programming tasks.
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)
23 views5 pages

OODP Unit-2 QB

The document is a question bank for the course 21CSC101T – Object-Oriented Design and Programming at SRM Institute of Science and Technology, focusing on concepts such as constructors, destructors, polymorphism, operator overloading, and UML interaction diagrams. It includes multiple choice questions and descriptive questions covering various topics related to object-oriented programming. The document is structured into three parts: Part A consists of multiple choice questions, Part B contains descriptive questions, and Part C includes practical programming tasks.
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/ 5

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

RAMAPURAM CAMPUS - CHENNAI


DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
21CSC101T – OBJECT-ORIENTED DESIGN AND PROGRAMMING
QUESTION BANK
UNIT II
Constructors- Types of constructors - Static constructor and Copy constructor -Destructor -
Polymorphism: Constructor overloading - Method Overloading Operator Overloading - UML Interaction
Diagrams -Sequence Diagram - Collaboration Diagram - Example Diagram
PART-A (Multiple Choice Questions)
Q. Questions Course Competen
Outcom ce
No e BT Level
1 While overloading binary operators using member function, it requires
___ arguments.
a. Zero
CO2 BT1
b. One
c. Two
d. Three
2 Which of the followings are true about constructors?
A. A class can have more than one constructor.
B. They can be inherited.
C. Their address can be referred.
D. Constructors cannot be declared in protected section of the class. CO2 BT1
E. Constructors cannot return values.
a. Only A, B, D
b. A,B,D,E
c. A,C,E
d. A,D,E
3 Which of the following keyword is used to overload an operator?
a. overload
b. operator CO2 BT1
c.friend
d.overrider
4 What will happen if a class is not having any name?
a. it cannot have a destructor
b. It cannot have a constructor. CO2 BT1
c. It is not allowed.
d. Both A and B
5 Which inheritance type is used in the class given below?
class A : public X, public Y
a. Multilevel inheritance
b. Multiple inheritance
c. Hybrid inheritance CO2 BT1
d .Hierarchical Inheritance
6 Which of the following operators cannot be overloaded?
a. []
b. -> CO2 BT1
c. ?:
d. *
7 In which of the following a virtual call is resolved at the time of
compilation?
a. From inside the destructor.
b. From inside the constructor. CO2 BT2
c. From inside the main ().
d. Both A and B

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

1 What is the necessity of constructor overloading? CO2 BT2


2 Categorize the types of Constructors CO2 BT1
3 Define method overloading. Write a program to implement method
CO2 BT3
overloading with different number of arguments and same return types
4 Write down the restrictions on Operator overloading CO2 BT2
5 Can we have virtual destructors? If so what is the use of virtual
CO2 BT3
destructors.
6 Define collaboration diagram with its notation CO2 BT1
7 Explain the modes of inheritance with an example CO2 BT2
8 Judge the output of the following C++ code?
#include <iostream>
using namespace std;
class Integer
{ int i;
public: Integer(int ii) : i(ii) {}
const Integer
operator+(const Integer&rv) const
{
cout<< "operator+" <<endl;
return Integer(i + rv.i);
} CO2 BT4
Integer&
operator+=(const Integer&rv)
{
cout<< "operator+=" <<endl;
i += rv.i; return *this;
} };
int main()
{
int i = 1, j = 2, k = 3;
k += i + j;
Integer ii(1), jj(2), kk(3); kk += ii + jj;
}

9 Relate the differences between constructors and destructors CO2 BT2

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy