0% found this document useful (0 votes)
109 views

Object Oriented Programming in C++

This document provides instructions for a 3 hour exam on Object Oriented Programming in C++. It consists of 7 questions worth a total of 100 marks. Candidates are instructed to answer all questions in their own words. The questions cover topics such as abstractions in OOP, behavior-driven design, inheritance, composition, operator overloading, polymorphism, and stacks. Candidates are asked to provide examples to explain concepts and create classes, functions, and a program to demonstrate their understanding.

Uploaded by

Nikash Subedi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

Object Oriented Programming in C++

This document provides instructions for a 3 hour exam on Object Oriented Programming in C++. It consists of 7 questions worth a total of 100 marks. Candidates are instructed to answer all questions in their own words. The questions cover topics such as abstractions in OOP, behavior-driven design, inheritance, composition, operator overloading, polymorphism, and stacks. Candidates are asked to provide examples to explain concepts and create classes, functions, and a program to demonstrate their understanding.

Uploaded by

Nikash Subedi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

POKHARA UNIVERSITY

Level: Bachelor Semester: Fall Year : 2015


Programme: BE Full Marks: 100
Course: Object Oriented Programming in C++ Pass Marks: 45
Time : 3hrs.

Candidates are required to give their answers in their own words as far
as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.

1. a) How does making use of abstractions help in designing of an Object 7


Oriented System? Explain with an example.
b) What is the role of behaviour in OOP? Along with a figure and an 8
example of a CRC card, explain its significance in Object Oriented
Design.
2. a) What is an inline function? Explain its importance with the help of an 7
example program.
b) How do we make use of a Virtual Destructor when we need to make 7
sure that the different destructors in an inheritance chain are called in
order? Explain with an example in C++.
3. a) Create classes called class1 and class2 with each of having one private 8
member. Add member function to set a value (say setvalue) on each
class. Add one more function max () that is friendly to both classes.
max () function should compare two private member of two classes
and show maximum among them. Create one-one object of each class
then set a value on them. Display the maximum number among them.
b) Explain how Inheritance support Reusability? Describe the syntax of 7
multiple and multilevel inheritance?
4. a) Compare and contrast composition and inheritance. 5
b) Differentiate between is-a and has-a rule with suitable example. 5
c) Write a program to enter the information of n students and then 5
display it using the concept of multilevel inheritance.
5. a) What is the benefit of overloading an operator? Design a Soccer 8
Player class that includes three integer fields: a player’s jersey
number, number of goals, number of assists and necessary

1
constructors to initialize the data members. Overload the > operator
(greater than). One player is considered greater than another if the
sum of goals plus assists is greater than that of the others. Create an
array of 11 soccer players, then use the overloaded > operator to find
the player who has the greatest total of goals plus assists.
b) How can you achieve run time polymorphism in C++? Discuss with a 7
suitable example.
6. a) Define a class called stack and implement generic methods to push 8
and pop the elements from the stack.
b) Path-follower Robot: 7
A Path-follower Robot senses the path it needs to follow thru its
sensors. Based on the data received thru its sensors, the Robot makes
use of its actuators (Robotic Wheels) to steer itself forward. For the
above mentioned system, identify as many components (collaborating
objects) as you can, draw CRC card for at least three of them and
show the interaction between these components thru an interaction
diagram.
7. Write short notes on: (Any two) 2×5
a) Responsibility Driven Design.
b) Stack versus Heap Based Allocation.
c) Virtual functions.

You might also like