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

BARANI INSTITUTE OF MANAGEMENT SCIENCES

Mid-Term Exam Spring Semester 2021

Course Title : Object Oriented Programming Course Code : CS- 423

Discipline /Program : BSCS/BSIT Total Marks : 18


Time allowed : 12 Hours Instructor’s Name: TAYYABA KALSOOM

Attempt all questions.

Q.No.1 Let’s assume we have a class ‘Arithmetic’ with two member functions Add() and Subtract().
Suppose Add() function is defined within class then how will the subtract() function be defined out
of the class boundary. Explain it with the help of some suitable program.
(Marks 3)

Note: write a C++ program to demonstrate the definition of Add() and subtract() functions.

Q.No.2 Let’s assume we have two classes, one is Employee class and another is Bank_account class.

(Marks 3)
Employee Bank_account

Private Data Private Data


ID=10;
Salary=30000;
Name=Ali;
BankAccountNo=3A12C;

Write a program to display the private data members of class Employee and class Bank_account
through a friend function Display();

Q.No.3 Write a C++ program to announce student’s result. Demonstrate this scenario through
three classes: Students, Results and Examination. The Student class has data members {1st is roll
number and 2nd is name}. Create the class Examination by inheriting the Student class. The
Exam class input three subjects Marks out of 100 (OOP, English,Maths). Derive the child class
Result from the Exam class and it has its own fields such as total Marks. Based on the total marks
students must be declared pass or Fail if the total marks achieved by students equal or greater
than 150/300 then only he be declared as Pass. Write an interactive program to model this
relationship.
(Marks 6)
Q.No.4 Sony TV Manufacturer want you to design a program that will help their customers to
check the price along with the dimensions for their products to be purchased. For this
Carefully read all the instructions and follow the requirements.
o Create a class called SONY_TV along with two constructors as follows:
o A Default constructor to set the length of TV.
o A parameterized constructor that will receive the width in float.
o By using a friend function calculate the area of the SonyTV
o Create a member function to calculate the price of the sony TV by multiplying the area
with Rs 100.
o Create a show( ) function to show the details of the purchased sony TV.
In the main you will construct three objects that will show the use of the two constructors. After
calling the constructor it will call the area function, and then the price calculation function.

( Marks 6)

Good Luck 

You might also like