Professional Documents
Culture Documents
CSE-159 2020 Tuto-2 (Chap 6 9) - 49
CSE-159 2020 Tuto-2 (Chap 6 9) - 49
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
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