Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Second Periodical Test, Semester Examination, Jan- May, 2022

Class: B.Tech. (CS/IT) IV Semester


Subject: Computer Science/ Information Technology
Paper (with Code): CS 214 Object Oriented Programming
Max Marks: 10

Note: Students are required to attempt Three questions. Question No. 1 is compulsory.

Q1. Create a class Staff having fields such as Staff Id, Name, Department, Designation,
salary. Write a menu driven program for:

1) To accept the record one by one


2) To display the entire record
3) To sort the entire record by name
4) To display the sum of the salary designation wise

Note: Designation must be Assistant Professor, Associate Professor, Programmer and


Peon. Staff id should be auto incremented and Department name should be “Computer
Science” [4]

Q.2 How many arguments are required in the definition of an overloaded binary
operator? Write a program to perform multiplication using an integer and object. Use
member function. [3]

OR

Q3. Can we overload the insertion (<<) and extraction (>>) operator? If yes then explain
how with the help of suitable example. Also explain the need of overloading these two
operators. [3]

Q4. What is copy constructor? If the compiler creates a copy constructor by default then
what is the need of making it explicitly? Justify you answer with example. [3]

OR

Q5. (a)Write a program in C++ to add and multiply two complex numbers using friend
function.
(b) What is string class in C++? Write a C++ program to accept the string from the user
and print the string in reverse order. In order to solve this problem use at() function.
[1.5+1.5]

You might also like