Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Class Roll: Jahangirnagar University

Obtained Marks:
Department of Computer Science and Engineering
_______________ CSE 159 Object-Oriented Programming Laanguage-1 (C++) _______________
Tutorial-2 Total Marks: 20 (5 x 4), Time: 40 Minutes
1. Answer the followings:

a) Which of the following is not true for a 2. When do we use protected access specifier?
constructor? What is the difference between public and
i) it has the same name as the class name private inheritance?
ii) it is executed automatically when an object is
created
iii) it has void return type
iv) it can be overloaded

b) Write a statement that defines an array called


manybirds that holds 50 objects of type bird.

c) Composition is a ___________ form of


____________.

d) Member functions defined inside a class


definition are ________ by default.

e) A data member declared _________ can be


changed even if the object is declared const.
i. final.
ii. mutable.
iii. const.
iv. explicit.

Page 1 of 2
3. Write a program that contains a class named 4. Create a class myComplex that represents
Student which includes three data items including complex numbers (realPart and
the name, ID, and gender of a student and imaginaryPart). Overload + operator for
contains two methods named input and display to addition of two myComplex objdects (to add two
take input and display the data. In the main complex numbers). Again, overload * operator for
program, create an array of 5 student objects and multiplication of two myComplex objdects (to
operate with them using basic loop statement. multiply two complex numbers).

Page 2 of 2

You might also like