munotes®

BSc CS Sem 2 Introduction to OOP using C++ 2022-23 Question Paper with Solutions

Mumbai University Solved Question Papers munotes.in

Introduction to OOP using C++

BSc CS · Sem 2

2022-23 Examination

Previous Year Question Paper with Solution

munotes.in Mumbai

munotes.in

First published on munotes.in on 12 November 2026.

This edition revised 13 November 2026.

Published by munotes.in, Mumbai.

Model answers written and edited by the munotes.in editorial desk.

Passages from this volume may be quoted, in print, online or by an AI system, with credit: name munotes.in and link to this volume's page. The volume may not be reproduced as a whole. Full terms at munotes.in/content-license.

munotes.in is an independent study resource for students of the University of Mumbai. It is not affiliated with the University of Mumbai, and is not endorsed by it.

The University does not publish an official answer key for this paper. The answers in this volume are model answers, written to show how a full-mark answer is built. They are a study aid, not an authority on what an examiner marked.

The question paper reproduced here is the paper as set by the University of Mumbai at the 2022-23 examination.

munotes.in ii
munotes.in iii
munotes.in iv

The Paper as Set

The questions in this volume are the questions asked at the 2022-23 examination, reproduced as the University of Mumbai set them, in the order it set them. Nothing has been reworded, added or left out. Only the answers are ours. See the original question paper.

Duration 2½ hours  ·  Total marks 75  ·  24 questions answered

How to use this volume

Solve the paper first, under exam conditions and against the clock. Then read the answers here and mark your own. Reading a solution before attempting the question feels productive and teaches very little, because recognising an answer is not the same as being able to write one.

munotes.in v

SECTION I

Q.1 Attempt the following

Any four · [20Marks]

munotes.in 1

a)Explain Characteristics of OOPS.[5]

Answer

For full marks, cover: what object oriented programming is; its characteristics, each with its meaning and its C++ form; one program that shows them together.

Object oriented programming

Object oriented programming (OOP) builds a program from objects. Each object joins data with the functions that work on that data. C++ supports OOP through classes. The main characteristics are these.

Characteristics

  1. Objects. An object is a run-time entity with a state (its data) and a behaviour (its functions), such as one bank account or one student.
  2. Classes. A class is the design from which objects are made. It names the data members and the member functions. Many objects can be made from one class.
  3. Encapsulation. Data and the functions that use it are wrapped together in a class. Data kept private can be changed only through the class's own functions, so it is protected from misuse. This protection is called data hiding.
munotes.in 2
  1. Data abstraction. The user of a class sees only what an object does, not how it does it. A caller writes a.deposit(500) without knowing how the balance is stored.
  2. Inheritance. A new class (derived class) takes the members of an existing class (base class) and adds its own. Code is reused instead of written again.
  3. Polymorphism. One name, many forms. The same function call behaves differently for different objects, as with function overloading, operator overloading and virtual functions.
  4. Dynamic binding. The function to run is chosen while the program runs, from the actual object, not from the pointer's type. In C++ this needs a virtual function.
  5. Message passing. Objects work by calling each other's member functions. A call such as a.deposit(500) is a message to object a.

Program: the characteristics together

  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. class Account {
  5. string owner;
  6. double balance;
munotes.in 3
  1. public:
  2. Account(string o, double b) : owner(o), balance(b) {}
  3. virtual ~Account() {}
  4. void deposit(double amount) {
  5. if (amount > 0)
  6. balance += amount;
  7. }
  8. string getOwner() const { return owner; }
  9. double getBalance() const { return balance; }
  10. virtual double interest() const { return balance * 0.03; }
  11. };
  12. class Savings : public Account {
  13. public:
  14. Savings(string o, double b) : Account(o, b) {}
  15. double interest() const override { return getBalance() * 0.04; }
  16. };
  17. int main() {
  18. Account a("Asha", 10000);
  19. Savings s("Ravi", 10000);
  20. a.deposit(500);
munotes.in 4
  1. a.deposit(-300);
  2. Account* all[] = {&a, &s};
  3. for (Account* p : all)
  4. cout << p->getOwner() << ": balance " << p->getBalance() << ", interest " << p->interest() << "\n";
  5. return 0;
  6. }

Output:

Asha: balance 10500, interest 315
Ravi: balance 10000, interest 400

  • Lines 4 to 17 are the class, and lines 24 and 25 make two objects from it.
  • Lines 5 and 6 are private, so main cannot write a.balance = 0. That is encapsulation.
  • Lines 10 to 13 check the amount, so the deposit of -300 on line 27 is refused. The caller never sees how. That is abstraction.
  • Line 18 makes Savings inherit everything in Account, and line 21 gives it its own interest rate.
munotes.in 5
  • Lines 26 and 27 are messages sent to object a.
  • Lines 28 to 30 call interest() through an Account*. Because line 16 is virtual, Ravi's savings account earns 4 per cent, Rs 400. That is polymorphism by dynamic binding.

Conclusion. The characteristics of OOP are objects, classes, encapsulation, data abstraction, inheritance, polymorphism, dynamic binding and message passing. A C++ class with private data, a derived class and a virtual function shows all of them.

munotes.in 6

The rest of the answers

The first answer is free. The rest come with the B.Sc. (Computer Science) Semester 2 solved papers.

You have read the question paper and its first answer in full. Buy the solved papers once and you can read every answer of every solved paper in this semester.

Notes + practical solutions + solved papers: ₹798 Already bought it? Sign in

Or solved papers only: ₹499
Or notes + practical solutions: ₹499

The question paper itself stays free, and so does the syllabus.

Issue

Found an error in this volume? Report it and we will check it against the paper.

Done!