0% found this document useful (0 votes)
37 views8 pages

OOPs C++ Major 2023

Uploaded by

s.sankrit29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views8 pages

OOPs C++ Major 2023

Uploaded by

s.sankrit29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

(No..

of Printe d Pages - 8] J 120

ES203
[ET]

END SEMESTER EXA MINA TION ; NOV EMB ER-


DECE MBE R, 2023

OBJ ECT ORIE NTE D PROGRAMMING


USIN G C++

Time : 3 Hn1. Maximum Mark i : 6()

Note : Attem pt ques tlon6 from all 11ection• a•


direc ted.

SECT ION - A (24 Mark t)


Attem pt any four quest ion, out of five .
Each que.,tion carrie6 06 mark.,.

1, State the uniqu e adva ntage s of Obje ct Orien ted

Prog ramm ing parad igm . Also focu1 on message

pa8$,i,ng and dynam ic bindi ng conce pt.

2. (aJ Write a C-r+ program to dyna mica lly allocate an

array of integ ers and string B al~o initJa lize its

cJcme-nu. (4}
P,T.O.
ES203 2
(b) Suppose th at t he following code fra gm en t is

ex ec ut ed .

co ns t int LENGTH = 21 ;

ch ar me ss ag e[ LE NG TH ];

co ut << .. En ter a se nt en ce
on th e lin e be lo w. " <<
endl;

cin~getlinc(messagc, LE NG
TH , '\n ');

co ut << me ss ag e << en dl
;

In th e pr om pt , the interact
ive user types th e
foil owing line and presses En
ter: Please go away.
:,
~
~ ES203 3 1120
I

~
What will the output of the code fragmen t look
~
like? (2)
~
I

r'
~ 3 (a) Write a program in C++ to illustrat e the use of

~ inline member function . Also discuss the similari ty

and dissimil arity in macro an inline function . (3)

(b) Disting uish between the followin g two stateme nts

Distanc e D2(D 1);

Distanc e D2=Dl; (3)

4. Explain the visibilit y of base class member s for the

access specifie s: private, protecte d and public while

creating the derived class and also explain the syntax

for creating derived class.

P .T.O.
ES203 4 1120

5. (a) What is meant by virt ual bas e clas s. Wh


at is its
use? Give a suitable exa mp le.
(3)

(b) Write a program to make a fun ctio n


"ac cou nt"
tha t can acc ess the pri vat e me mb ers
of two
different classes "Employee" and "Student"
usin g
the concept of friend function.
(3)

SEC TIO N - B (20 Ma rks )


Atte mpt any two que stio ns out of thr ee.

Eac h que stio n car ries 10 ma rks .

6. Write a program to cre ate a cla ss DA TE


hav ing data
mem ber s DD ,MM ,YY .

(i) constructor to intialize the data memb


ers
!S203 5 1120

(ii) show () to display date

(iii)overload ++ operator to increment date by one


day

(iv)overload - operator to decrement date by one day.


Consider one month =30 days (8)

ere is a need of static variable in a class?

(2)

name RealEstate that has data member

•ce of a house, the number of bedrooms

of bathrooms.

function that instantiates a Real Estate

to enter data and displays the

10 the main () function should

own error message if non-

P.T.O.
ES203 6 1120

numeric or negative values arc entered for any of the

data 1ne1nbcr.

8. Create a program that uses multiple inheritance and

contain functions having same name in both the base

classes. Solve the ambiguity using

(a) Overriding the derive class function

(b) Scope resolution operator (5)

(b) Discuss the various file mode operations available

in C++. Also write a program to read the content

of a file and store the content in reverse order in

other file,. (5)


ES203 7 1120

SECTION - C (16 Marks)

(Compulsory)

9.. Create a base class Electricity where an electricity

board charges the following rates to domestic users

discourage large consumption of energy:

For first 100 units: SO paise

For next 200 units: 60 paise

Paise

a minimum of Rs 3000/

n Rs. 2000.00 an additional

to Implement a code to add

d member (unction to read

aumbcr of units consumed.


with names. Use Array
(10)

P..T.O.
ES203 8
1120
(b) Write a C++ Program to Swap data using function

template. Also mention ho\v it is different from

class template
(6)

(2100)

'

You might also like