You are on page 1of 4

Student Declaration

I__________________________________ Registration No.__________________, hereby

declare that by attempting the paper for the course _________________________________,

I will not be involved in any kind of cheating/copying/plagiarizing in solving the short

questions-based paper of Final Term Examination Spring 2021. I take full responsibility of

my conduct and if I found involved in any kind of such activity of

cheating/copying/plagiarizing, then Institute reserves the right to reject my paper and take

any disciplinary action against me.

Student Signature
Final Term Exam / Spring 2021 (Paper Duration 24 hours)
(Online Assignment Based Question Paper)

Course No.: CS-423 Course Title: Object Oriented Programming 4(3-2)


Total Marks: 30 Date of Exams: 06-07-2021
Degree: BSCS/BSIT Semester: 2nd Section: (A/B)

Marks
Q.No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
Obtaine
d
Total Marks in Words:

Name of the Teacher: Mr. Irfan Ahmad

Who taught the course: Signature of Teacher / Examiner:

To be filled by Student

Registration No.: Name:

(Theoretical Examination)

Answer the following questions.


Q. No. 1. Write a class array that contains an array of integers as data member. The class contains
the following member functions: (Marks 8)

 A constructor that initializes the array element to -20.

 Input function to input the values in array.

 Show function to display the values of the array.

 Overload == operator to compare the values of 2 objects. The overloaded function return 1 if

all values of both objects are same and return 0 if not same.
Answer

__________________________________________________________________________________

__________________________________________________________________________________

__________________________________________________________________________________

Q. No. 2. Write a class LocalPhone that contains an attribute phone to store local phone number.
The class contains member functions to input and display phone number. Write a child class
NatPhone for national phone number that inherits LocPhone class. It additionally contains an
attribute to store city code. It also contains member functions to input and display the city code.
Write another class intPhone for international phone number that inherits NatPhone Class. It
additionally contains an attribute to store country code. It also contains member functions to input
and show the country code. (Marks 8)

Answer

__________________________________________________________________________________

__________________________________________________________________________________

__________________________________________________________________________________

Q. No. 3. Write a class template that inputs the index of the array and displays the value in the
specified index. (Marks 8)

Answer

__________________________________________________________________________________

__________________________________________________________________________________

__________________________________________________________________________________

Q. No. 4. Answer the questions related to the following code: (Marks 6)


class X
{
public:
void x1();
protected:
void x2();
};
class Y: public X
{
void y1();
protected:
void y2();
};
class Z : public Y
{
Public:
void z1();
};
main ()
{
X temp1; Y temp2; Z temp3;
}
a) Name all member functions of all classes visible through temp1 in the main function.
b) Name all member functions of all classes visible through temp2 in the main function.
c) Name all member functions of all classes visible through temp3 in the main function.

Answer

__________________________________________________________________________________

__________________________________________________________________________________

__________________________________________________________________________________

You might also like