Object Oriented Programming Concepts Using C++

20
NPP BRILLIANT’S ® www.thebrilliants.in Code No.: MP-BSC(CS)-201 Object Oriented Programming Concepts Using C++ Bilingual (English & Hindi) S % U 7 ' 9 " 2 S = 4 n , 9 , 6 7 - 6 > / 6 3 6 / > " $ 3 6 + B.Sc. II Year (Computer Science) Paper- 1 st

Transcript of Object Oriented Programming Concepts Using C++

Page 1: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT’S®

www.thebrilliants.in

Code No.: MP-BSC(CS)-201

Object OrientedProgramming

Concepts Using C++

Bilingual (English & Hindi) SJU7'r "dS =hnXr X67Z6| ̂ 6f6 /| "H$ 36+

B.Sc. II Year(Computer Science)

Paper- 1st

Page 2: Object Oriented Programming Concepts Using C++

NPP

New SyllabusUNIT 1 : Introduction to C++Introduction to C++; Programming Paradigms, Key Concepts ofObject-Oriented Programming, Advantages of OOP's, Input andOutput in C++; Pre-Defined Streams, Unformatted Console I/OOperations, Formatted Console I/O Operations.C++ H$m n[aM¶, àmoJ«mq‘J n¡am{S>½g, Am°ãOo³Q>-Amo[aEÝQ>oS> àmoJ«mq‘J H$s ‘w»¶AdYmaUmE±, OOP's Ho$ bm^, C++ ‘| BZnwQ> VWm AmCQ>nwQ>, àr{S>’$mBÝS>ñQ>́råg, AZ’$m°‘}Q>oS> H§$gmob I/O Am°naoeÝg, ’$m°‘}Q>oS> H§$gmob I/O Am°naoeÝg&

UNIT 2 : C++ DeclarationsC++ Declarations : Parts of C++ Program, Types of Tokens, Key-words, Identifiers, Data types, Constants, Operators, Precedence ofOperators, Referencing and Dereferencing Operators, Scope AccessOperator. Control Structures: Decision Making Statement, Loop-ing Statement.C++ {S>³boaoeÝg… C++ àmoJ«m‘ Ho$ ^mJ, Q>m oH$Ýg Ho$ àH$ma, H$sdS²> ©g,AmBS>opÝQ>’$m¶g©, S>mQ>m Q>mBßg, H$m°ÝgQ>|Q²>g, Am°naoQ>g©, Am°naoQ>g© H$m {à{gS>|g,ao’$aoqgJ VWm {S>ao’$a|qgJ Am°naoQ>g©, ñH$mon E³gog Am°naoQ>a, H§$Q´>mob ñQ>́³Mg©…{S>grOZ ‘oqH$J ñQ>oQ>‘|Q²>g, byqnJ ñQ>oQ>‘|Q>&

UNIT 3 : FunctionsFunctions: main ( ), Parts of Function, Passing Arguments: Value,Address, Reference, Inline Functions, Function Overloading: Prin-ciples, Precautions, Library Functions, Classes and Objects: Declar-ing Classes and Objects, Accessing Class Members, Keyword: Pub-lic, Private, Protected, Defining Member Functions: Member Func-tion Inside the Class, Member Function Outside the Class, StaticMember Variables and Functions, Friend Function, Friend Classes,Overloading Member Functions.’§$³eÝg… main ( ), ’§$³eZ Ho$ ^mJ, Am½¶y©‘|Q²>g nmg H$aZm… d¡ë¶y, ES>́og,ao’$a|g, BZbmBZ ’§$³eÝg, ’§$³eZ AmodabmoqS>J… {gÕm§V, gmdYm{Z¶m±, bm¶~«oar’§$³eÝg, ³bmgog VWm Am°ãOo³Q²>g… ³bmgog VWm Am°ãOo³Q²>g H$mo {S>³bo¶a H$aZm,³bmg ‘oå~g© H$mo E³gog H$aZm, H$sdS>²©g… npãbH$, àm¶doQ>, àmoQ>o³Q>oS>, ‘oå~a’§$³eÝg H$mo n[a^m{fV H$aZm… ³bmg Ho$ AÝXa, ‘oå~a ’§$³eZ ³bmg Ho$ ~mha‘oå~a ’§$³eZ, ñQ>o{Q>H$ ‘oå~a do[aE~ëg VWm ’§$³eÝg, ’«|$S> ’§$³eZ, ’«|$S> ³bmgog,AmodabmoqS>J ‘oå~a ’§$³eÝg&

Page 3: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/5

UNIT 4 : Constructors, Destructors andInheritance

Constructors and Destructors: Characteristics, Applications,Constructors with Arguments, Overloading Constructors, Typesof Constructors, Operator Overloading: Overloading Unary Op-erator, Binary Operator, Inheritance: Access Specifiers: PublicInheritance, Private Inheritacne, Protected Data with PrivateInheritance, Types of Inheritances: Single, Multiple, Hierarchi-cal, Multilevel, Hybrid, Multipath, Virtual Base Class.H§$ñQ́>³Q>g© VWm {S>ñQ́>³Q>g©… {deofVmE±, AZwà¶moJ, Am½¶y©‘|Q²>g Ho$ gmW H§$ñQ>́³Q>g©,AmodabmoqS>J H§$ñQ́>³Q>g©, H§$ñQ>́³Q>g© Ho$ àH$ma, Am°naoQ>a AmodabmoqS>J… AmodabmoqS>J¶yZoar Am°naoQ>a, ~m¶Zar Am°naoQ>a& BZho[aQ>|g… E³gog ñno{g’$m¶g©… npãbH$ BZho[aQ>|g,àm¶doQ> BZho[aQ>|g, àm¶doQ> BZho[aQ>|g Ho$ gmW àmoQ>o³Q>oS> S>mQ>m, BZho[aQ>|gog Ho$àH$ma… qgJb, ‘pëQ>nb, hmBam{H©$H$b, ‘pëQ>bodb, hm¶{~«S>, ‘pëQ>nmW, dMw©Ab~og ³bmg&

UNIT 5 : Pointers and ArraysPointers and Arrays: Pointer Declaration, Pointer to Class andObject. Array: Declarations and Initialization, Array of Classes,Polymorphism: Static (Early) Binding, Dynamic (Late) Binding,Virtual Function, Pure Virtual Function.nm°BÝQ>g© VWm EaoO… nm°BÝQ>a {S>³boaoeZ, ³bmg VWm Am°ãOo³Q> Ho$ {bE nm°BÝQ>a.Eao… {S>³boaoeZ VWm B{Z{e¶bmBOoeZ, ³bmgog Ho$ Eao& nm°br‘m°{’©$Á‘… ñQ>o{Q>H$(Abu) ~mB§qS>J, S>m¶Zm{‘H$ (boQ>) ~mB§qS>J, dMw©Ab ’§$³eZ, ߶moa dMw©Ab’§$³eZ&

Suggest List of Programs for Practical

1. Write a program to find average of 3 numbers.VrZ g§»¶mAm| H$m Am¡gV kmV H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

2. Write a program to find biggest among 3 numbers.VrZ g§»¶mAm| ‘| g~go ~‹S>r g§»`m kmV H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

3. Write a menu driven program (switch case) to performarithmetic operators.AW©‘o{Q>H$ Am°naoQ>g© gånÝZ H$aZo Ho$ {bE EH$ ‘oZy {S>́dZ àmoJ«m‘ (pñdMHo$g) {b{IE&

215

215

216

Page 4: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/6

4. Write a program to check whether entered number isprime or not.à{dîQ> H$s J¶r g§»¶m àmB‘ h¡ ¶m Zht BgH$s Om±M H$aZo Ho$ {bE EH$àmoJ«m‘ {b{IE&

5. Write a program to check whether entered number iseven or odd.à{dîQ> H$s J¶r g§»¶m g‘ ¶m {df‘ h¡ BgH$s Om±M H$aZo Ho$ {bE EH$àmoJ«m‘ {b{IE&

6. Write a program for addition of two matrices.Xmo ‘¡{Q>́gog Ho$ ¶moJ Ho$ {bE àmoJ«m‘ {b{IE&

7. Write a program for multiplication of two matrices.Xmo ‘¡{Q>́gog Ho$ JwUm Ho$ {bE EH$ àmoJ«m‘ {b{IE&

8. Write a program to find transpose of a matrix.EH$ ‘¡{Q>́³g H$m Q>́m§gnmoO kmV H$aZo Ho$ {bE àmoJ«m‘ {b{IE&

9. Write a program to print:qàQ> H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE…** ** * ** * * *

10. Write a program to print:qàQ> H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE…12 23 3 3

11. Write a program to print:qàQ> H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE…12 34 5 6

12. Write a program to check whether entered string ispalindrom or not.à{dîQ> H$s J¶r pñQ>́J̈ n¡qbS>́mo‘ h¡ ¶m Zht BgH$s Om±M H$aZo Ho$ {bE EH$àmoJ«m‘ {b{IE&

218

219

220

221

223

224

225

226

227

Page 5: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/7

13. Write a program to print fibonacci series.{’$~moZogr gr[aO qàQ> H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

14. Write a program to find factorial of a given number.EH$ Xr J¶r g§»¶m H$m ’¡$³Q>mo[a¶b kmV H$aZo Ho$ {bE EH$ àmoJ«m‘{b{IE&

15. Write a program to demonstrate use of static datamember.ñQ>o{Q>H$ S>mQ>m ‘|~a H$m Cn¶moJ àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

16. Write a program to demonstrate use of a static memberfunction.ñQ>o{Q>H$ ‘§o~a ’§$³eZ H$m Cn¶moJ àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘{b{IE&

17. Write a program to create array of objects.Am°ãOo³Q²>g H$m Eao ~ZmZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

18. Write a program to demonstrate use of friend function.’o«§$S> ’§$³eZ H$m Cn¶moJ àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

19. Write a program to illustrate use of copy constructor.H$m°nr H§$ñQ>́³Q>a H$m Cn¶moJ àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

20. Write a program to demonstrate constructor overloading.H§$ñQ>́³Q>a AmodabmoqS>J àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

21. Write a program to illustrate use of destructor.{S>ñQ>́³Q>a H$m Cn¶moJ àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

22. Write a program to overload unary operator.¶yZoar Am°naoQ>a H$mo AmodabmoS> H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

23. Write a program to overload binary operator.~m¶Zar Am°naoQ>a H$mo AmodabmoS> H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

24. Write a program to demonstrate single inheritance.qgJb BZho[aQ>|g àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

25. Write a program to demonstrate multiple inheritance.‘pëQ>nb BZho[aQ>|g àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

228

228

229

230

231

232

233

234

236

237

238

240

241

Page 6: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/8

26. Write a program to demonstrate multilevel inheritance.‘pëQ>bodb BZho[aQ>|g àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

27. Write a program to demonstrate hierarchical inheritance.hmBam{H©$H$b BZho[aQ>|g àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

28. Write a program to demonstrate hybrid inheritance.hm¶{~«S> BZho[aQ>|g àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

29. Write a program to demonstrate the use of functionoverloading.’§$³eZ AmodabmoqS>J Ho$ Cn¶moJ àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘ {b{IE&

30. Write a program to demonstrate the use of inline memberfunction.BZbmBZ ‘|~a ’§$³eZ H$m Cn¶moJ àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘{b{IE&

31. Write a program to demonstrate the use of parameterizedconstructor.n¡am‘rQ>amBÁS> H§$ñQ>́³Q>a H$m Cn¶moJ àX{e©V H$aZo Ho$ {bE EH$ àmoJ«m‘{b{IE&

243

244

245

247

248

249

Page 7: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/9

ContentsUNIT 1 : Introduction to C++

Q.1. Give a brief introduction to C++ programming lan-guage.C++ àmoJ«mq‘J b¢½doO H$m EH$ g§{jßV n[aM¶ Xr{OE&

ORWrite a short note on C++ programming language.C++ àmoJ«m[‘§J b¢½doO na EH$ g§{jßV {Q>ßnUr {b{IE&

PROGRAMMING PARADIGMS / àmoJ«mq‘J n¡am{S>ågQ.2. Discuss the concept of programming paradigms.

àmoJ«mq‘J n¡am{S>åg H$s AdYmaUm H$s {ddoMZm H$s{OE&OR

What do you understand by programming paradigms?Write about various types of paradigm.àmoJ«mq‘J n¡am{S>åg go Amn ³¶m g‘PVo h¢? n¡am{S>_ Ho$ {d{^ÝZàH$mam| Ho$ ~mao ‘| {b{IE&

KEY CONCEPTS OF OBJECT-ORIENTED PROGRAMMINGAm°ãOo³Q> Amo[aEÝQ>oS> àmoJ«mq‘J H$s ‘w»¶ AdYmaUmE±

Q.3. Illuminate the key-concepts of Object-Oriented Pro-gramming.Am°ãOo³Q>-Amo[aEÝQ>oS> àmoJ«mq‘J H$s ‘w»¶ AdYmaUmAm| H$m dU©Z H$s{OE&

ORDiscuss various key concepts used in Object-OrientedProgramming.Am°ãOo³Q>-Amo[aEÝQ>oS> àmoJ«mq‘J ‘| Cn¶moJ H$s OmZo dmbr ‘w»¶AdYmaUmAm| na {dMma H$s{OE&

ADVANTAGES OF OOPs / OOPs Ho$ bm^Q.4. Discuss advantages of Object-Oriented Programming.

Am°ãOo³Q>-Amo[aEÝQ>oS àmoJ«mq‘J Ho$ bm^m| H$s {ddoMZm H$s{OE&OR

What are the various benefits of OOPs? Write aboutthem. / OOPs Ho$ {d{^ÝZ bm^ ³¶m h¢? CZHo$ ~mao ‘| {b{IE&

25

26

28

30

Page 8: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/10

INPUT AND OUTPUT IN C++ / C++ ‘| BZnwQ> VWm AmCQ>nwQ>Q.5. Explain the various pre-defined streams used as in-

put and output in C++.C++ ‘| BZnwQ> VWm AmCQ>nwQ Ho$ ê$n ‘| Cn¶moJ {H$¶o OmZo dmbo{d{^ÝZ àr-{S>’$mBÝS> ñQ>́råg H$m dU©Z H$s{OE&

ORBriefly discuss pre-defined streams of C++.C++ ‘| àr-{S>’$mBÝS> ñQ>́råg H$r g§{jßV {ddoMZm H$s{OE&

CONSOLE INPUT/OUTPUT / H$Ýgmob BZnwQ>/AmCQ>nwQ>Q.6. Discuss console input/output operations in detail.

H$Ýgmob BZnwQ>/ AmCQ>nwQ> Am°naoeÝg H$s {dñVma go ì¶m»¶m H$s{OE&OR

Write notes on following terms:1. Unformatted console I/O operations2. Formatted console I/O operations{ZåZ{b{IV nXm| na {Q>ßn[U¶m± {b{IE:1. AZ’$m°‘©oQ>oS> H$Ýgmob I/O Am°naoeÝg2. ’$m°‘©oQ>oS> H$Ýgmob I/O Am°naoeÝg

Review Questions Objective Questions

UNIT 2 : C++ Declarations

PARTS OF C++ PROGRAM / C++ àmoJ«m‘ Ho$ ̂ mJQ.7. Discuss various parts of C++ program.

C++ àmoJ«m‘ Ho$ {d{^ÝZ ^mJm| H$s {ddoMZm H$s{OE&OR

Explain various declarations of C++ program parts.C++ àmoJ«m‘ Ho$ ^mJm| H$s {d{^ÝZ {S>³boaoeÝg g‘PmB¶o&

TOKENS / Q>moH$ÝgQ.8. What does token mean in C++ programming

language? Explain in brief.C++ àmoJ«mq‘J b¢½doO ‘| Q>moH$Z H$m ³¶m Ame¶ h¡? g§jon _| g_PmBE&

32

3641

41

49

51

Page 9: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/11

KEYWORDS / H$sdS²>©gQ.9. What do you understand by keywords? Explain in

brief.H$sdS>© go Amn ³¶m g‘PVo h¢? g§{jßV ‘| dU©Z H$s{OE&

IDENTIFIERS / AmBS>opÝQ>’$m¶g©Q.10. What does identifier mean in C++ programming

language? Explain in short.C++ àmoJ«mq‘J b¢½doO ‘| AmBS>opÝQ>’$m¶a H$m ³¶m AW© h¡? g§{jßV ‘|dU©Z H$s{OE&

ORWrite a short note on identifier. What are the variousrules to name identifier?AmBS>opÝQ>’$m¶a na EH$ g§{jßV {Q>ßnUr {b{IE& AmBS>opÝQ>’$m¶a H$moZm‘ XoZo Ho$ {bE {d{^ÝZ {Z¶‘ ³¶m h¢?

DATA TYPES / S>mQ>m Q>mBßgQ.11. Illuminate various data types used in C++

programming language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo {d{^ÝZ S>mQ>mQ>mBßg H$m dU©Z H$s{OE&

ORWhat do data types mean in C++ programminglanguage? Classify the data types.C++ àmoJ«mq‘J b¢½doO ‘| S>mQ>m Q>mBßg H$m ³¶m Ame¶ h¡? S>mQ>mQ>mBßg H$m dJuH$aU H$s{OE&

CONSTANTS / H$m°ÝñQ>oÝQ²>gQ.12. Write a brief note on constants used in C++

programming language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo H$m°ÝñQ>oÝQ²>g na EH$g§{jßV {Q>ßnUr {b{IE&

ORWhat does constant mean in C++ programminglanguage? Explain in brief.C++ àmoJ«mq‘J b¢½doO ‘| H$m°ÝñQ>oÝQ²>g H$m ³¶m AW© h¡? g§jon ‘|g‘PmB¶o&

52

54

55

63

Page 10: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/12

OPERATORS / Am°naoQ>g©Q.13. What are the usage of operators in C++ programming

language? Explain.C++ àmoJ«mq‘J b¢½doO ‘| Am°naoeÝg H$s ³¶m Cn¶mo{JVm h¡? g‘PmB¶o&

ORDiscuss various types of operators used in C++.C++ ‘| Cn¶moJ {H$¶o OmZo dmbo Am°naoQ>g© Ho$ {d{^ÝZ àH$mam| H$s{ddoMZm H$s{OE&

PRECEDENCE OF OPERATORS / Am°naoQ>g© Ho$ {à{gS>§ogQ.14. Explain in brief precedence and associativity of

operators.Am°naoQ>g© Ho$ {à{gS>§og VWm Egmo{gE{Q>{dQ>r H$m dU©Z H$s{OE&

ORWrite about precedence of operators used in C++programming language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo Am°naoQ>g© Ho$ {à{gS>|gHo$ ~mao ‘| {b{IE&

REFERENCING AND DEREFERENCING OPERATORSao’$a|qgJ VWm {S>ao’$a|qgJ Am°naoQ>g©

Q.15. What is the purpose to use referencing anddereferencing operator ? Explain in short.ao’$a|qgJ VWm {S>ao’$a|qgJ Am°naoQ>a Cn¶moJ H$aZo H$m CÔoí¶ ³¶m h¡?g§{jßV ‘| dU©Z H$s{OE&

ORWrite a note on: Address operator, Indirection operator.EH$ {Q>ßnUr {b{IE: ES>́og Am°naoQ>a, BZS>m¶ao³eZ Am°naoQ>a&

SCOPE ACCESS OPERATOR / ñH$mon E³gog Am°naoQ>aQ.16. What is the purpose to use scope access operator in

C++ programming language?C++ àmoJ«mq‘J b¢½doO ‘| ñH$mon E³gog Am°naoQ>a Cn¶moJ H$aZo H$m³¶m CÔoí¶ h¡?

OREnumerate the use of scope resolution operator.ñH$mon [aOm°ë¶yeZ Am°naoQ>a Ho$ Cn¶moJ H$m dU©Z H$s{OE&

66

73

75

77

Page 11: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/13

CONTROL STRUCTURES / H§$Q>́mob ñQ>́³Mg©Q.17. Illuminate the control structures used in C++

programming language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo H§$Q>́mob ñQ>́³Mg© naàH$me S>m{bE&

ORWrite about following terms:{ZåZ{b{IV nXm| Ho$ ~mao ‘| {b{IE:(a) Decision making statements / {S>grOZ ‘oqH$J ñQ>oQ>‘|Q²>g(b) Loop statements / byn ñQ>oQ>‘|Q²>g(c) Jump statements / Ámån ñQ>oQ>‘|Q²>g

Review Questions Objective Questions

UNIT 3 : Functions

FUNCTION AND MAIN ( ) / ’§$³eZ Am¡a MAIN ( )

Q.18. Describe functions used in C++ programminglanguage. Also explain main( ).C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo ’§$³eÝg H$m dU©ZH$s{OE& main ( ) H$mo ^r g‘PmB¶o&

PARTS OF FUNCTION / ’§$³eZ Ho$ ̂ mJQ.19. Justify various parts of a function in brief.

EH$ ’§$³eZ Ho$ {d{^Þ ^mJm| H$m g§{jßV ñnï>rH$aU Xr{OE&

PASSING ARGUMENTS / Am°½¶y©‘|Q²>g nmg H$aZmQ.20. Enumerate the concept for passing arguments with

value, address and reference.d¡ë¶y, ES>́og VWm ao’$a|g Ho$ gmW Am°½¶y©‘|Q²>g nmg H$aZo H$s AdYmaUmH$m dU©Z H$s{OE&

ORWhat is meant by passing arguments to a function?Explain.EH$ ’§$³eZ H$mo Am°½¶y©‘|Q> nmg H$aZo H$m ³¶m Ame¶ h¡? g‘PmB¶o&

798989

97

100

101

Page 12: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/14

INLINE FUNCTIONS / BZbmBZ ’§$³eÝgQ.21. Bring out the concept of inline function.

BZbmBZ ’§$³eZ H$s AdYmaUm ~VmB¶o&OR

What does inline function mean in C++ programminglanguage? Explain with example.C++ àmoJ«mq‘J b¢½doO ‘| BZbmBZ ’§$³eZ H$m ³¶m AW© h¡? CXmhaUg{hV g‘PmB¶o&

FUNCTION OVERLOADING / ’§$³eZ AmodabmoqS>JQ.22. Justify the concept of function overloading.

’§$³eZ AmodabmoqS>J H$s AdYmaUm ñnï> H$s{OE&OR

What do you understand by function polymorphism?Explain.’§$³eZ nm°{b‘m°[’©$Á‘ go Amn ³¶m g‘PVo h¢? dU©Z H$s{OE&

PRINCIPLES OF FUNCTION OVERLOADING’§$³eZ AmodabmoqS>J Ho$ {gÕm§V

Q.23. Discuss various principles of function overloading.’§$³eZ AmodabmoqS>J Ho$ {d{^Þ {gÕm§Vm| H$s ì¶m»¶m H$s{OE&

ORWhat are the principles of function overloading in C++programming language? Explain.C++ àmoJ«mq‘J b¢½doO ‘| ’§$³eZ AmodabmoqS>J Ho$ {gÕm§V ³¶m h¢?g‘PmB¶o&PRECAUTIONS OF FUNCTION OVERLOADING

’§$³eZ AmodabmoqS>J H$s gmdYm{Z¶m±Q.24. Write down the precautions over function overloading.

’§$³eZ AmodabmoqS>J H$s gmdYm{Z¶m± {b{IE&

LIBRARY FUNCTIONS / bm¶~«oar ’§$³eÝgQ.25. Enumerate the library functions used in C++

programming language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo bm¶~«oar ’§$³eÝgH$m dU©Z H$s{OE&

105

107

108

111

Page 13: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/15

ORWhat functions are adopted in library of C++? Explainsome of them.C++ H$s bm¶~«oar ‘§o H$m¡Z-go ’§$³eÝg AnZm¶o J¶o h¢? CZ‘| go Hw$N>H$m dU©Z H$s{OE&

CLASSES AND OBJECTS / ³bmgog VWm Am°ãOo³Q²>gQ.26. What do you understand by classes and objects?

Explain the procedure to declare classes and objects.³bmgog VWm Am°ãOo³Q²>g go Amn ³¶m g‘PVo h¢? ³bmgog VWmAm°ãOo³Q²>g H$mo {S>³bo¶a H$aZo H$s à{H«$¶m g‘PmB¶o&

ACCESSING CLASS MEMBERS / ³bmg ‘oå~g© H$mo E³gog H$aZmQ.27. Bring out the procedure to access class members.

³bmg ‘oå~g© H$mo E³gog H$aZo H$s à{H«$¶m ~VmB¶o&OR

Write a note on following terms:{ZåZ{b{IV nXm| na EH$ {Q>ßnUr {b{IE…(a) Accessing data members / S>mQ>m ‘oå~g© H$mo E³gog H$aZm(b) Accessing member functions

‘oå~a ’§$³eÝg H$mo E³gog H$aZm

KEYWORDS / H$sdS²>©gQ.28. Justify the keywords-public, private and protected.

H$sdS²>©g-npãbH$, àm¶doQ> VWm àmoQ>o³Q>oS> H$mo ñnï> H$s{OE&OR

Enumerate various access specifiers used in a C++class.EH$ C++ ³bmg ‘| Cn¶moJ {H$¶o OmZo dmbo {d{^Þ E³gog ñno{g’$m¶g©H$m dU©Z H$s{OE&

DEFINING MEMBER FUNCTIONS‘oå~a ’§$³eÝg H$mo n[a^m{fV H$aZm

Q.29. Discuss overall procedure to define member functionsof the class.³bmg Ho$ ‘oå~a ’§$³eÝg H$mo n[a^m{fV H$aZo Ho$ {bE gånyU© à{H«$¶mH$s {ddoMZm H$s{OE&

112

117

118

120

Page 14: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/16

ORHow to define member functions inside the class andoutside the class? Justify.³bmg Ho$ AÝXa VWm ³bmg Ho$ ~mha ‘oå~a ’§$³eÝg H$mo H¡$go n[a^m{fVH$a|? ñnï> H$s{OE&

STATIC MEMBERS-VARIABLES AND FUNCTIONSñQ>o{Q>H$ ‘oå~g©-do[aE~ëg VWm ’§$³eÝg

Q.30. Bring out the working of static members of the class.³bmg Ho$ ñQ>o{Q>H$ ‘oå~g© H$s H$m ©̀àUmbr ~VmB¶o&

FRIEND FUNCTION / ’«|$S> ’§$³eZQ.31. Enumerate friend function used in C++ programming

language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo ’«|$S> ’§$³eZ H$mdU©Z H$s{OE&

ORWhat does friend function mean in C++ programminglanguage? Discuss.C++ àmoJ«mq‘J b¢½doO ‘| ’«|$S> ’§$³eZ H$m ³¶m AW© h¡? ì¶m»¶m H$s{OE&

FRIEND CLASSES / ’«|$S> ³bmgogQ.32. What is the use of friend class? Justify.

’«|$S> ³bmg H$m ³¶m Cn¶moJ h¡? ñnï> H$s{OE&OR

Illuminate the concept of friend class in C++programming language.C++ àmoJ«mq‘J b¢½doO ‘| ’«|$S> ³bmg H$s AdYmaUm na àH$me S>m{bE&

OVERLOADING MEMBER FUNCTIONS‘oå~a ’§$³eÝg H$s AmodabmoqS>J

Q.33. How to overload member functions in C++programming language? Discuss in short.C++ àmoJ«mq‘J b¢½doO ‘| ‘oå~a ’§$³eÝg H$mo AmodabmoS> H¡$go H$a|?g§{jßV ì¶m»¶m H$s{OE&

Review Questions Objective Questions

123

125

129

131

133135

134

Page 15: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/17

UNIT 4 : Constructors, Destructors and

InheritanceCONSTRUCTORS AND DESTRUCTORS

H$§ñQ>́³Q>g© VWm {S>ñQ>́³Q>g©Q.34. Write a brief note on constructor and destructor.

H§$ñQ>́³Q>a VWm {S>ñQ>́³Q>g© na EH$ g§{jßV {Q>ßnUr {b{IE&OR

What does constructor and destructor mean in C++programming language? Explain.C++ àmoJ«mq‘J b¢½doO ‘| H§$ñQ>́³Q>a VWm {S>ñQ>́³Q>a H$m ³¶m AW© h¡?g‘PmBE&

CHARACTERISTICS OF CONSTRUCTORS ANDDESTRUCTORS

H§$ñQ>́³Q>g© VWm {S>ñQ>́³Q>g© Ho$ JwUQ.35. Bring out various characteristics of constructors and

destructors.H§$ñQ>́³Q>g© VWm {S>ñQ>́³Q>g© Ho$ {d{^ÝZ JwU ~VmBE&

APPLICATIONS OF CONSTRUCTOR / H§$ñQ>́³Q>a Ho$ AZwà¶moJQ.36. Describe the applications of constructor.

H§$ñQ>́³Q>a Ho$ AZwà¶moJm| H$m dU©Z H$s{OE&OR

Write down a note on applications of constructor.H§$ñQ>́³Q>a Ho$ AZwà¶moJm| na EH$ {Q>ßnUr {b{IE&

CONSTRUCTORS WITH ARGUMENTSH§$ñQ>́³Q>g© Am½¶y©‘|Q²>g g{hV

Q.37. Justify the concept of constructors with arguments.H§$ñQ>́³Q>g© H$s AdYmaUm Am½¶y©‘|Q²>g g{hV ñnîQ> H$s{OE&

ORDiscuss the procedure to use constructors witharguments.H§$ñQ>́³Q>g© H$mo Am½¶y©‘|Q²>g g{hV Cn¶moJ H$aZo H$s à{H«$¶m H$s ì¶m»¶mH$s{OE&

143

145

148

149

Page 16: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/18

OVERLOADING CONSTRUCTORS / AmodabmoqS>J H$§ñQ́>³Q>g©Q.38. Enumerate overall process to overload constructors.

H$§ñQ>́³Q>g© H$mo AmodabmoS> H$aZo H$s g§nyU© à{H«$¶m g‘PmBE&OR

How can you overload the constructor? Explain.Amn H§$ñQ>́³Q>a H$mo H¡$go AmodabmoS> H$a gH$Vo h¢? g‘PmBE&

TYPES OF CONSTRUCTORS / H§$ñQ>́³Q>g© Ho$ àH$maQ.39. How many types of constructors are used in C++

programming language? Explain each.C++ àmoJ«q‘J b¢½doO ‘| {H$VZo àH$ma Ho$ H§$ñQ>́³Q>g© Cn¶moJ {H$¶oOmVo h¢? à˶oH$ H$m dU©Z H$s{OE&

ORDiscuss various types of constructors.H§$ñQ>́³Q>g© Ho$ {d{^ÝZ àH$mam| H$s ì¶m»¶m H$s{OE&

OPERATOR OVERLOADING / Am°naoQ>a AmodabmoqS>JQ.40. Bring out the concept of operator overloading. What

is the process to overload operators? Explain.Am°naoQ>a AmodabmoqS>J H$s AdYmaUm ~VmBE& Am°naoQ>g© AmodabmoS>H$aZo H$s à{H«$¶m ³¶m h¡? g‘PmBE&

ORDiscuss operator overloading concept. Also enlistwhich operators can be overloaded and which cannot.Am°naoQ>a AmodabmoqS>J AdYmaUm H$s ì¶m»¶m H$s{OE& gmW hr gyMrXr{OE {H$ H$m¡Z-go Am°naoQg© AmodabmoS> {H$¶o Om gH$Vo h¢ VWmH$m¡Zgo Zht&

OVERLOADING UNARY OPERATORAmodabmoqS>J ¶yyZoar Am°naoQ>a

Q.41. How the unary operator can be overloaded? Explainwith suitable example.¶yZoar Am°naoQ>a H$mo H¡$go AmodabmoS> {H$¶m Om gH$Vm h¡? Cn¶w³VCXmhaU g{hV g‘PmBE&

151

153

158

Page 17: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/19

ORDescribe to overload unary operator in C++programming language.C++ àmoJ«mq‘J b¢½doO ‘| ¶yyZoar Am°naoQ>a H$mo AmodabmoS> H$aZo H$m dU©ZH$s{OE&

OVERLOADING BINARY OPERATORAmodabmoqS>J ~m¶Zar Am°naoQ>a

Q.42. Illuminate to overload binary operator in C++programming language.C++ àmoJ«mq‘J b¢½doO ‘| ~m¶Zar Am°naoQ>a H$mo AmodabmoS> H$aZo H$m dU©ZH$s{OE&

ORWhat is binary operator overloading? Explain with anexample.~m¶Zar Am°naoQ>a AmodabmoqS>J ³¶m h¡? EH$ CXmhaU Ho$ gmWg‘PmBE&

INHERITANCE / BZho[aQ>|gQ.43. What do you mean by inheritance? Explain.

BZho[aQ>|g go AmnH$m ³¶m Ame¶ h¡? g‘PmB¶o&OR

Bring out a note on inheritance.BZho[aQ>|g na EH$ {Q>ßnUr {b{IE&

ACCESS SPECIFIERS / E³gog ñno{g’$m¶g©Q.44. Justify all the access specifiers with inheritance.

BZho[aQ>|g Ho$ gmW g^r E³gog ñno{g’$m¶g© H$m ñnîQ>rH$aU Xr{OE&

TYPES OF INHERITANCE / BZho[aQ>|g Ho$ àH$maQ.45. Classify the Inheritance.

BZho[aQ>|g H$m dJuH$aU H$s{OE&OR

Discuss various types of inheritance used in C++programming language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo BZho[aQ>|g Ho$ {d[^ÝZàH$mam| H$s {ddoMZm H$s{OE&

161

163

165

172

167

Page 18: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/20

VIRTUAL BASE CLASS / dMw©Ab ~og ³bmgQ.46. What is the importance of virtual base class in an

inheritance? Explain with suitable example.dMw©Ab ~og ³bmg H$m BZho[aQ>|g _| ³¶m ‘hËd h¡? Cn¶w³V CXmhaUg{hV g‘PmBE&

ORJustify the working of virtual base class used in aninheritance.BZho[aQ>|g ‘| Cn¶moJ H$s OmZo dmbr dMw©Ab ~og ³bmg H$s H$m¶©àUmbrH$m ñnîQ>rH$aU Xr{OE&

Review Questions Objective Questions

UNIT 5 : Pointers and Arrays

POINTER'S DECLARATION / nm°BÝQ>a H$m {S>³boaoeZQ.47. What do pointers mean in C++ programming lan-

guage? Explain the declaration of pointer.C++ àmoJ«m[‘§J b¢½doO ‘| nm°BÝQ>g© H$m ³¶m Ame¶ h¡? nm°BÝQ>a H$m{S>³boaoeZ g‘PmBE&

ORDiscuss pointer with its declaration in brief.nm°BÝQ>a H$s BgHo$ {S>³boaoeZ g{hV g§{jßV ì¶m»¶m H$s{OE&

POINTER TO CLASS / Šbmg Ho$ {bE nm°BÝQ>aQ.48. Explain pointer to class in C++.

C++ _| Šbmg Ho$ {bE nm°BÝQ>a H$m dU©Z H$s{OE&OR

What is the concept of pointer to class? Define.Šbmg Ho$ {bE nm°BÝQ>a H$s AdYmaUm Š`m h¡? n[a^m{fV H$s{OE&

POINTER TO OBJECT / Am°ãOoŠQ> Ho$ {bE nm°BÝQ>aQ.49. Enumerate the concept of pointer to object.

Am°ãOoŠQ> Ho$ {bE nm°BÝQ>a H$s AdYmaUm H$m dU©Z H$s{OE&OR

176179

180

189

190

Page 19: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/21

Justify the procedure to use pointer to object in C++programming language.C++ àmoJ«mq_J b¢½doO _| Am°ãOoŠQ> Ho$ {bE nm°BÝQ>a Cn`moJ H$aZo H$sà{H«$`m ñnîQ> H$s{OE&

ARRAY / EaoQ.50. What does array mean in C++ programming lan-

guage? Explain its declaration and initialization.C++ àmoJ«mq‘J b¢½doO ‘| Eao H$m ³¶m Ame¶ h¡? BgHo$ {S>³boaoeZVWm B{Z{e¶bmBOoeZ H$mo g‘PmB¶o&

ORBring out a note on array. Also discuss the declara-tion and initialization of array.Eao na EH$ {Q>ßnUr {b{IE& Eao Ho$ {S>³boaoeZ VWm B{Z{e¶bmBOoeZH$s ^r {ddoMZm H$s{OE&

ARRAYS OF CLASSES / ³bmgog Ho$ EaoQ.51. What do you understand by arrays of classes? Explain.

³bmgog Ho$ EaoO go Amn ³¶m g‘PVo h¢? g‘PmBE&OR

Enumerate the concept of arrays of classes used inC++ programming language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbr ³bmgog H$o EaoOH$s AdYmaUm g‘PmBE&

POLYMORPHISM / nm°[b‘m°{’©$Á‘Q.52. What do you mean by polymorphism? Write about

static binding and dynamic binding.nm°[b‘m°{’©$Á‘ go AmnH$m ³¶m Ame¶ h¡? ñQ>o{Q>H$ ~mB§qS>J VWmS>m¶Zm{‘H$ ~mB§qS>J Ho$ ~mao ‘| {b{IE&

ORExplain polymorphism. Also discuss various types ofpolymorphism.nm°[b‘m°{\©$Á‘ H$mo g‘PmB¶o& nm°br‘m°{’©$Á‘ Ho$ {d{^ÝZ àH$mam| H$s^r ì¶m»¶m H$s{OE&

192

193

196

198

Page 20: Object Oriented Programming Concepts Using C++

NPP

BRILLIANT'S/Object Oriented Programming ........ Using C++/22

VIRTUAL FUNCTION / dMw©Ab ’§$³eZQ.53. Justify the concept of virtual function. Write various

rules for a virtual function.dMw©Ab ’§$³eZ H$s AdYmaUm ñnîQ> H$s{OE& EH$ dMw©Ab ’§$³eZ Ho${d{^ÝZ {Z¶‘ {b{IE&

ORWhat does virtual function mean in run time polymor-phism? Explain.aZ Q>mB‘ nm°[b‘m°{\©$Á‘ ‘| dMw©Ab ’§$³eZ H$m ³¶m AW© h¡? g‘PmBE&

PURE VIRTUAL FUNCTION / ߶moa dMw©Ab ’§$³eZQ.54. How the concept of pure virtual function is associated

with run time polymorphism? Explain. / ߶moa dMw©Ab ’§$³eZH$s AdYmaUm aZ Q>mB‘ nm°br‘m°[’©$Á‘ go H¡$go g§~§{YV h¡? g‘PmBE&

ORGive an overview to pure virtual function used in C++programming language.C++ àmoJ«mq‘J b¢½doO ‘| Cn¶moJ {H$¶o OmZo dmbo ߶moa dMw©Ab ’§$³eZH$m EH$ AdbmoH$Z Xr{OE&

Review Questions Objective Questions

Suggest List of Programs for Practical

T-20 Questions

200

203

206

206

215

251