33
AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014 © IETE 1 Q.2 a. With an example explain how I/O is achieved in C++. (). /� -f _/ ( 6\ S a //1 F t f d � u / ( e i . bo a "d l , _ ouu evire ;' coSVIe QY scnn /0 5 f J, C + J,· /ra YJ 7 C in t: , a/ ; r f a t' /nU / Kyo O- (OUT /S �a/1d oUr r +�as: Cevv ?dclog S?"·crfly c&lj.ned sAv r Y eSS J Ca.t1 e : rer d o so ƣ� d u u v r o a loJ f ·! t . Jro f V y UJ y so n d o "7 . CO h u e d c//1_ £ a c A · o V p e! ) . de/) h· r·� y� r in� tou _ _ ; C in > C ou ; e.)L Ya c i> on /)of� V c in ; ', � t r s7 t ;7� fro rlo 0 /J.y ) ) ryac6 sf R ;'u7 so. C•'" e /? ( � O on c L n e I/ J. ou u o t7) 0 U "-1 Sf ! U I/) Su' J>on ( < <) 0 ' !a d yp · c oul S. Ho co he e. ;Ꜩ ,·. ·o n o / o < . �") . .. op�Y /11 �e rT /de J rlY l/oi I · S vr on o; t a + Y a o u U a c au+. (

Q.2 a. With an example explain how I/O is achieved in C++

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 1

Q.2 a. With an example explain how I/O is achieved in C++.

• � (CL). /� -f c) • _/ ( 6\

S a /"1 flJ'CI //1 F t.J f d � u / ( e i.s 14 Y::J bo aJ-d a "d l.__!_)

.:7,..., 7J:;__ oufpu-t- plevire ;'...s � co/ISVIe QY scn_en

/0 5 f r-� J,Y1 C +--t J,·/.:>ra YJ 7 C in t:..J 77:._ .s;h;c,ol a.JvJ/.

;'rJ fhJ r s;f �C<rYl --1-a _ct'U\-tf /n_?U j- �/'VI /.4. Kyl>o41d

O.r--...o) (OUT /S Jl:.c �f-a/1olc0>d oUr_f>trr..s+�aiYis:

Cevv et'"'-dclog S?"O--t·crfly c&.slj.ned -1-o sAvJJ

C'rrvY .rv-> e.SSO-� _g JAJ Ca.t1 /::>e of: rerfed --fo

(7:... s-fo. "'oi�d c:; u +_pu 1" v r -1 o a loJ f·! t. .

Jro f V J- y--f- ?re Cl rY1 .S. UJ C:.

fay s..Jo. n d. o.J..-d ";;7 t0 .

CO/I h � u..J e d c.?//1.__

£ � -fz, a c A·oYJ V p e.J-..-01 fv if

� ) . de/) h· r·� y� r}'">/J [_ Y- _· �

in� tou/1-f __ ;

C in > ';;? C our�-r;

/}:...L e.)L -f Ya c i> on (>/)of� ·nrfz

V-L c in ; ', � t./ r s7 J-<t.IOY")

;7� €--;<- fro. rlo;, 0 /J..oJ-Dy ) )

e_y:ryacl-6. ;-t._._ v-�� sf

R ;'n_;;>u7 s-Jre.o..rYJ C•'"

e,}y /? n? ( �..A-1 O"i/

on c L ?A-t. n e..<N I/ /\.f.

J:;/7>�.

ou-r_?uJ- (!ot.�7)

0 U -f .f'"-1 }- Sf re tJ<,Y>! U-' '" J7::;_ I/) Su' J>on ( < <) 0/'.J-okv

f"' _>!a>'>clt>J-d -fypct>· -r-4. coul S-/.Hor-O co.n he

Uh e.. ol � ;TZ TJ:::L ,·� � .,../> ·o n o / tJ,.o.:/o-v <' < . �-v�.".-) .::> .....

op�Y /11 �e rT..S --rJ:.-c /de. ....:f-J rlY.6 fol/o<--:Ji{) �

I· /'1 S vr A· on o;;:::.> t --r-a +-o Y -1 a � o u..J _,PUJ- ..5 .-f 1-f>a rn

c au+. (

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 2

b.Explain the following: (i) Class and Object (ii) Abstraction and Encapsulation

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 3

� (!;>) ( i) C I o J J and o b j (' c.f .

if c I oM _;;, 0<- fJ' ,0caJ; ;;offOYI 0; 0< s/rv( /vw_ ! "

C. 7 f is a I' of1S frvtl <joY '"r.'Fi'��,.J.,·1J a UJvY

cUf nd J--y f e . 0 nV- ch-f·,v.tl, S uri... 7 !)!'"' fh/foj J,,

f o " w N e Jl:J ()A<d 0-" -:tz... .1£,.�-' /"/''/ P • '-' f:J f"'.

71-. /10 fof'.c.d "I 0<. c (NV> J , 'aJW o o;, J_, .

/) cf a/YJ 5 f '-"' f'u, J]:c � -,u,v-4-oJ,·on D 1 oh j 'J t

0. ""'- 0<. S e 1- iJ ( <'! / ,J-Ia .f i 0 � .JJ:J a."' Oj'p!i t ..6/1

.fo sucJ.. eJbj, J t . (1... /""?}e."" 1 �'�akon elk I< o 1-

-;J-,. c I oM OJ.L- P"' vaL_ h .fl.< c (cvv' . rh r"'j (

In f<';, i"U- o J C! c / {LNI r oro-/' n·su. or} �

c � e.o of ([) I

.Jc�>-;,. o""' . 1;.,_ r· wr e oi.e.JO'Y roM<Jb -

o ( o. r I..Vl .-!. o Y <jv t> J> on s 1f;,_l- -,..--1;,9, � """""' "';J'f-.1

o)>J jrad>on� �oJ .:tr..... ob)'d� �ftJ'I;. . 7/.e s'"'""'

[CL�il"j C O AKu .f.6 o( frcu�Jnrr>vY f.;�cA•>-J

� (Y' 0 hi 0\ )') O J.;j I iJ: -j "'-tJ""' 0 NJ V oL cJ .S ! OJ...

fv () /1.0 f1:_u.. : . r w f ycv·p k.

· c I aM Pe).J'J, e Y\

o( /:; n' v aXe. ' C �� ':f- MrN. ; s j..-f) f!· �.-L ;

p e)1. 'y() )'\ p

Ov!J/; c . · V ' -' n f +-I ( I' , o' o. ..J r: ,-t?-fY'-L cof-11- C A.M .X J;

� AOY f 6 e f � cy {);

J, r..<;

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 4

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 5

Q.3a. With an example explain how local transfer of control is achieved in C++.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 6

b.Briefly explain the following: (i) Void Pointer (ii) Address-of Operator (iii) Indirection Operator (iv) Invalidate a Pointer

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 7

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 8

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 9

Q.4a. With an example explain inline function in C++.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 10

b. Explain function overloading. Write a C++ program to demonstrate function overloading.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 11

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 12

c. What is the difference between Return-by-value and Return-by-reference?

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 13

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 14

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 15

Q.5 a. What is a class in C++? Explain with an example.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 16

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 17

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 18

b. Differentiate between constructor and destructor.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 19

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 20

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 21

Q.6a. Describe overloading of unary and binary operators.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 22

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 23

b. With the help of an example explain the use of cast operator in C++.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 24

Q.7 a. Explain (i) Inheritance (ii) Multiple inheritance

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 25

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 26

b. Explain friend function, with example

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 27

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 28

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 29

Q.8 a. Differentiate between a template and a marco. Explain class template and function template.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 30

b. Illustrate the usage of nested try block. Is it necessary that number of catch blocks should be equal to the number of try blocks? Justify. Ans Page 335 of Text book Q.9 a. What is STL? Why should they be used? Explain the different components of STL.

Ans Page 361 of Text book b. What are the different forms of get () function of istream class? Illustrate the uses by citing proper examples.

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 31

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 32

AC105/AT105 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014

© IETE 33

Text books

1. C++ and Object-Oriented Programming Paradigm, Debasish Jana, 2nd Edition, PHI, 2005