Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
11 views
OOP Prelim Paper Solution
OOP Prelim Paper Solution
Uploaded by
artkatta468
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save OOP Prelim Paper Solution For Later
Download
Save
Save OOP Prelim Paper Solution For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
11 views
OOP Prelim Paper Solution
OOP Prelim Paper Solution
Uploaded by
artkatta468
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save OOP Prelim Paper Solution For Later
Carousel Previous
Carousel Next
Save
Save OOP Prelim Paper Solution For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 27
Search
Fullscreen
Harsh Tushar Shinde . ) Rene: St oo? between. commie Tal4ymor Prism. = _ aoe Com@ile dime RoNMorPHIs Pr an time Polrimer hms cy om to be invottd, “The Function _15 The funch invoked 1S _Wnown at the Come Aime - @) as is _al$So known as_ “easily binding | over >%ding_ _[byadyag and 4 is a_Gompile | ove a ¥ding 18 Hime Dely mor Phism where + sad Dynamre late brad adtag and Static brading. _ on bp oveloading Lime Polymerphicer wher Ahan one. T mote than one _methed is | mom Lhaving the Same mame ba | 15 having the Sams. Dumber ot Ver the “He oF Fh with the _diFfemn* numbe> | name. z Tok Pomamesers oy th Pe _meten LL of Parameters. _ Parameter and the 3a? | oe Parameters (@, Tr achieved is__achveved bY ans LL evertoading — | ovexleading ( ©) a+ Aron _|_ @xec aon know os Z ©] zr is tess Fleme as | Te marnly an thing exec {ants atk Compile time isoPp ———_— ee a a Put Mio Nelg and 4cfine How de you _declar= a Fan in cde Expioin with bel? of “Pesan chon ~ een ach hen “has no _defent on 4 Sade Function frown as funt_vindetat function Pare Wrtual fanetron Cam toe. defined et “ dlintual void display example | ttinclude
uSing NamesPate SH) % class Bas: 4 Padir Nirtaa| vlofd Bese Show C)= by Class derived i Tube Base & Pape ¢ Vord Show Q £ — Cout<< “Derived class is derved Pom base closs.”
Show OF arb OF aUSing name sface Stdo_ Class aumbe? & forvate * int nd Tubire § Humber _Cint X26) @ neap &F Noid ofevats? +2 0 zg net 3 Noid overate” --9 © n--? } Mlotd display 2 Cou se “Number 1” <<
" int mam O % pumber num C5)" coat <<" inital Number." 5 hum. display ¢ +nam? cout 8" Ete da" nan. di'spay C);inthral_rymber +S = ur Couk
class Mumber 4 Pivak | Int n?’ Public ¢ Number Cint x=0) 2 NCx) 3er Cn- othe adi pees Pree pure 80S SE b | Norg_aismay O_& | cout <& 12 | $ o) ink main © Number nar | Clo) Mamber nur 2 C59) nar tl: dismay O%7 num &_disMet o4 Number Sam = nam t tran Cout <4 Sumy Sap + disMay O2 Number difFexnce. = Nam \-mPom t Gus Ss “DFE cIN Cel Y aiTFernce + dismlay Oe een _9' ® oytftak 3 to s samt 1S di Fromage = Ffaa af easing at e_Gmmend neem toe tte Bass —Comman vie eanente Tena etter Proete of mein fun oe | ewan s agumente_ L >t a. ~ =| ay C4e Possidic arguments — argument am “given rete Command line ling _oe-gument th. Sut\ decorate te =| command Wne [name of Prograry in =| to use o& _G@ommand ao finst understand we mu of mat | Comprand line imrculiecsses Fane o argument 15 wunning ae =| exanal If FE include
behrad its Cure Poston tellg © This TuncHon 1s _uSed to gek the Capen > To sitton oF get _Pofnte>. =| Santer? int teN'g 7 _ eg. int vy = obj-4eg C) © unite a Progra? using C++ fle infuse and outPyr class __eyith _oPen Gea cd, Pus CD: closed methods 40> _enYng atadrng _-focm _ and _ wetng te ag Fes Use pend made wire OPening th Fr Evk fy _qinti Oges - To inciude ge sazeam pp #_inctude _% tos tocam? eee uStng mame sPace S4d > + a — — aaa Int mato tf ee oe Wfstotamy inpusrric 5 —| InMasric. open Cinta axk, Std 2 ios: tn) ee . a ee | ii_C! inpus File: is open cy) _£ ; Ceor
ening guitas file Renda; retpn 1, + ae ‘ outpurtile ¥2" Helio 3 maa File Pub Cy ye 24 endl; qutTutkile «Pus Ci). a ee es ee outfutfile - elose. qa aetn 0 2 ine A ee| afford Mode bry __used_ and _e%Plarh Lys* or i jf file open c)_funclon_ 1 while _ofening__o i Pen_O Five _¢8Sentval_mede _btts used _in oven Fanch'o? = Std tt fos i: tn Cintut mode) usage 2 Std i: Wfstorar Inktle C™ rapub. xd", Std ti fos tt ta); =| Defout For Std: iFsiocors = oPen a file for Yeading Std i toss: out Coutpat Pode) Usag i S4d i: of streapy OutFiic Cloutpys .$x4" | Std ct fos aut) Default for Std ofstocam ofens a File for writing Std ir ios "oY Cappend made) ofens a fre for affending Curis at end) USage : Stdi: ofsaecan, ouwFile C"log-tus", Sidisios spout] [ Std i: jos !: ap): | Preserves extsdtng Content Std: los + binary CBIMaey mode) ofens a Fre th binary mode [asec 7 p 7 SS$ Sid 2: fstream file C* image. 379" r Stdit fas ttin l Std 0: ios ct binary) >“| Recessavy for non text WWies Ceg . images e xccutasics ) ©) tai: fos: Avance C Buncak Mede) -) Truncate exvstieng fe Conten? | usage) Std it ofstecam _ ourfuite C'output tet", sd gtd fos 2: deunc) > tos::ous] =| defo for Std!: of stocam 3B Define a class Person that has three adiorbute; viz name Jendey and age. wrrte a ctt Program that wots an object te a File and 2tads an obyect fsom File S include < fstocan> # include < Yos4toram ) F_inciude < Stang) i USiNg Name sPace ae t Class Person £ | Siting name> i int age: ——j—_———ntiisge) ae Not oS ee “sid _vbite To Frtes € ofsiveam J _owtFiie) 5 OutFile << pare
>? gendexj inFile = tgno% C: | inFile >? age 7 2 - inFile + ignox 0; poe ye aa. Nord _drsplay Of couse “Name x< mame « enddy | Cout <<" Gender.” << gende> <4 end) in Cout ¢< “age.” *% age 44 enddi | ii} . i ink main Of i Person Hyman? { Vauman -name = x4t2"/ \ Maman «gender = 7 \ Human -age Boi | I ofstocary _owtFtle_C" Human-dat"); j = | Mammon. wort ToFric CoutFiic) outFile - close ¢1; | Persory ead Haman | 1 re ce “ “ I ifstocam inFile C" Muman - dat") YeadWuman + Feqd From File CinFitc)> inFile - close €)> Cout
plat 1 = : a Exs = What iS Fstocapy feascam ae ots 49ca py witty « oe hep of example? Poovide ane| Fstocap CFile_s4zcam)_ T's is dered oo ides PI) amg TH Fstecary is gq cet class that Fle inpas output oPer a trons. eading and writing bo Files — Ol Vissocam Cinput file _slecam) - =| itetream ea CHE class that Cantor ts | fe inpge oferations.. I allows reading —_—— from Files i . . = tistocany is derived from _iS*2eam oshich Prowrdes inpuk_— functtond ly member Functrons @ oPen 0: often a Wie, @®__closecy: Close _a Wie @_vread O' Reads data from a Fil - | example ifstecam — infudFrle C'intat- 4x4"); tf Cinpuk File -is ~ofenc)) 4 Stoing Woe 7 getline CintysFile | ne); Cout
ois}aeam CoutPa' File s+ocam) -orstecam iS a ctr Closs that cypPort Fle output ofevatvons . i+ allows warrting +e Weee mn L y i \ oO Sh7CaMy -ahYeh Pourtides bo Par Doinles to Steertr otstocam owt PUrErle C" otPat -t") if Coutiasfrle - 1s — ofen cr) £ - ontiyt File <<“Helto , worid i") owdpab Bile = close OF + " los See] = + \S4%eary Ost?capy oo i + Yost?cary ifS tecarr otstcarny Fstocarr Hierarch of Stotam Classes @5_a)ll Discuss excattos handitay Mechanism iy Crh wrth Santa< = Excep troy han ditng 1S. Q_ Mcchanrsmy nN ce Ee to shondle yuntrme _err0%S oF eC xceptronal St4uatrvon 5 wy a Progeam.Keywords 3 Any Catch T+ tnvoiwes dnyece and throw The by block contains statement +hat resul in _ercepHona! Con ditron 5 may when an exceptronal rs condrhioy occu 5. throw achemen te * i thrown using The Catch block Is FesPon sible for handing ond tahrng apirofrtat the dhrown x ceptor achons. =| The _Purfose _ af _exceptror handitng \S_ +e de tech and report _exceptronal Srtuatvon [Lm a Program =| Exceppon handing _ helps _imPreve _Code SeParatin readabiinty and maintarn bility by loge ory ocgula cod erxx9 > han ditng Sintar ary t ML Code % catch CexcepHon —H9e Ver) & I Handle excePHon oF +yPe | thak maz theo ay ExCeTHA $b catch Cexcephon — +e 2 €2) & Il] Handle _excepHon of ayve 2 e catch C--) € TL Handle any athe> excepton + work a Program +o handle © xcepHon _YStng class ANP __EXcePHTOH + include. Xfos+cam) HF include _X Std exceP4? ySsi ng Namespace S*dzHt custo excepHon class Class rnyexcep tion i Pape > es Purr Cons* u 1 ekeePh hax * what © - Cons’ +hrow 0 xcquen "| Something went wean od ink ined) ¢ divide Cinta it _Cyz=o) £ Throw My ExceP Hon O 4 x weturn a bi ¥ Int main o & doy it Int result = divide Cloro); Xk Yesult 24 ends cout <<" Resarti” Featch Ccons myExceptions 4) & 4% - What ©) ends Corr << “Error” R Teturn 0% + wh Saftadie emonsdoate Functton kml ate Cod i cx Te Jerferrm idenweal oferatron fe each anPe of data compact funchror template oac_used Puss mo thay once 9 and Convenin the upen* +0 w fanchron tmpiak Iso.You generally usc emp leries When Sot Wand. +9 de Same Set of _aferations On Many diFFexnd date ayer = Santa & sepia
15 grea 5. | + int main O t Cond 4%" Exapme of function erp lecte Coutie” WN integer Comperision 4 TA gk
$ 4 Me olp: ings le, Second :20 Frvgk 314, Secong 2 2-3){ iS ag soya overloading funcion template with | Ce J = |__Suitable Code in “ch? ol TH Femiak fanchon Can be overloaded ——-[ a is Pussible Using ue optron thal temilak ——T sguncHon or OrdMaw — function - ——s| Fan c bron OVO loading is_ used Sitmilorly as functor acm Dlactes dul q\lows you bs [Use diFEem Ssunta de Copsey out _oPergtrons Tf For diFReamyt Wes =| ExamMe Code 4 include
4 aceon ath; + doyle sum Cdouble 9 , double 3) q t weHNN 45) i Hinclude
s: outpa s+ itevrator s opt used +0 rte the Contents in Herators example +e include < toS42cam) qe tnciude 4 Vecto™) using pamesPacc S+dj int mana t Nn cocate a_Necto™ Nechow Xin}? numbers = £12,5,4,5 2-7 I declax an ¥ Skater lerdae emt) i) Heater vateNN Teeverse the Vector using iterator fox G+ = numbers begin Oy ik} 7 nambews. endo, bere) & NPodrPy _ slalues_ USiNg fyerqto% begin ik} =pumk. end QO; + it) & fow Ci} = nums. Cop te t Fiy*® oq. N doubk Values Coutxe enddt IN Dysplay__medifred Values for Cit = Numbers begin j ft b= numbes-end Oy +et+) 4 Cont << ie 4x" "5 Zz Cou t Kenda y acta 0" What 1S Algor ths on _algerthm in STLe Enis+ and explarn amy _algozthm fp detail In Slandord temPlat. Werary , an algo? thn, \s fanct’on thal Derforms gq Sect Fre opera Hon on data structures Such a5 Con barn ers - Algor'thms an _desrgned to work wth Narrows ther data Structures makingener and atusabdl et wst of STL Algomthme Hon = Matahn alg ortHom f - find O 2 Search for an elermen + of an_element = Coant O Count occur ces check __*& two ange cPe equal = equal 9 * Search for _a_ Sub - ange ~ Search © mutating BPlg o?ttbm = Copy OE Copy element From one ang + ansthe> move ©? move element um __9n ong, +0 anothe™ drans tem O Apply a Tanchos +0 eacr element’ = _emove o) Remove elements _SaWSFying & Can dro, Sot ting Al Ng om "hy 5. oy+ Sor a ange Moge OQ : Merge two Sorted anges mn) element) 3 Find the on‘ Smatiest element. binary Scorch Oi Search fey an __elemen} S+ad 2 Sov4c) {Ss Sor4¥ ng algortthm thal Xe a%-ange Sahs ty Parameters s ie elements th @ Pange +6 cfficd order Frse. Beginarng. oF ange| las} | End of he Fange _ —— | Comp 2 Comperrsion _ fanctiar = eT - al Example | - _ _ th include algor Hh) _ __ ~~ | 4h inclade 2% Vector? | 7 inctude 2 fostocam _ i Using NamesPace _S*d 4 Ff Int maincy £ TF Vector
-| BR map th cee 5 date Stouctim that Stors elemen} tn key -Valuc Pairs -| xe its ay agsacrat ve Contamney , Mranrng {Lassa crates each element wrth _unrgue Key Mays am implemen ted as bYnaxy search for _eFFreten + _insextron | de 'e4> jrees _ GMowing ion and Search aPera +1075. = Examric — = +e mnclide__< fostaean? — +e _include < ma?) < sting) — re Include i US as oer] |H Tne mary 2) 4% ~ tt erg te a. | map_
+ elements | Phones ook [John] = 12345 2 Lo Vhonedsook UC" pirce"J = 389 012) [ Phonebook ["Bod"] = 345 638i t | iL_ Display ele men, i Cout xe "Phone Book : "<4 end for C canst autre 2 Pair 2 Phonebook) § Cout
cl Standard template Niboary is newlt adacnfancWon are frovided by. pranipaha ke pany ddd IL siractures eS - | te cons as pany _ih Crating hyg__ -} T+ hens and Sof dwar STL has hace main @ Can tarners © Therators 9 Algorithms _Comfonen +5 Q)_Gnteiners ai they rt losses are holders which 15 i Capable +o Store CallechHox ot objec} -| They at_—used te manage —Gaitec Hon of |__ objects -|| the do av the sho age —omanagementr oo I objec they _are._ hating thy the Con toinees -{| het Brovide ftoatys + acess Jemens : of Con taine> @||_ Treator | = ~ | Ther or used 40 access elementS ofthe Con Lainors a Tirade iS imfertent concep iahre’ ades generalrty IN STU Progeammyng 4 ~ | theater Cay be oF githunt Pes I QO _InPar iterators | @ owt iterators : © Forward iyoatos oy eee | © _Bidrectrona! Heater : i Q@__Randem access iterateCavectyon oF S4ePs Bigooithms acts on _Contoimers They eet used to Pertormy othe oPeration 9 Con dainey objec! famous algorithm oe Searching Tee inv tralizaton etc L iS otha 13 __Neetoy & Enivst and exPlarh amy 5 Fan con of Vector by usrng a_ ot Thoqram = Dk IS Sequence Can davYney used 40 9ePoesen j Gozay whch Can Changs _SrZe aj) gnky dit Ferne is that thers Size Cay de changed - The am more Mite __ ay | Functton avatlable fh Nectoe et begin C) = Ge te beginning ae em 1 G8 Ge) ee cs Otc) eee 2 iL. Sze 0) = __Se+ Size a j i. | maxsrec) = Get max Size : | —_ Caracity O) = Storage Calacity \ > = S ; 4 emity 0) empty Vector - ! back OV = Get Jast element ; Push -backo = Adds les" element ab end mser+ O = used +5 insert Element SxamPle os _ include < tosteam) # include
) ees usyng _Namesvace Std)Nechov
You might also like
Opp's Assignment2
PDF
No ratings yet
Opp's Assignment2
12 pages
OOPS Notes ? - Removed
PDF
No ratings yet
OOPS Notes ? - Removed
20 pages
Imgtopdf 2909221401056
PDF
No ratings yet
Imgtopdf 2909221401056
39 pages
Oops Notes Curated by Sameer Raza
PDF
No ratings yet
Oops Notes Curated by Sameer Raza
21 pages
OOPS Handwritten Notes
PDF
No ratings yet
OOPS Handwritten Notes
20 pages
Computer Programing Lab PDF
PDF
No ratings yet
Computer Programing Lab PDF
105 pages
CPP Notes - 03
PDF
No ratings yet
CPP Notes - 03
30 pages
Adobe Scan 19 Oct 2024
PDF
No ratings yet
Adobe Scan 19 Oct 2024
20 pages
Oop
PDF
No ratings yet
Oop
20 pages
OOP Endsem Notes by DK ?
PDF
No ratings yet
OOP Endsem Notes by DK ?
27 pages
Oops Assignment
PDF
No ratings yet
Oops Assignment
11 pages
CPP Notes - 01
PDF
No ratings yet
CPP Notes - 01
30 pages
Endsem Paper 3
PDF
No ratings yet
Endsem Paper 3
45 pages
Java 6
PDF
No ratings yet
Java 6
32 pages
Bca 3
PDF
No ratings yet
Bca 3
35 pages
C++ Notes FULL - Compressed
PDF
No ratings yet
C++ Notes FULL - Compressed
176 pages
Oops - Assignment4 (Piyush Nayak)
PDF
No ratings yet
Oops - Assignment4 (Piyush Nayak)
12 pages
OOP Assignment 5 and 6
PDF
No ratings yet
OOP Assignment 5 and 6
12 pages
Chapter No-02. Functions and Constructors.
PDF
No ratings yet
Chapter No-02. Functions and Constructors.
27 pages
8th August Classwork
PDF
No ratings yet
8th August Classwork
3 pages
Oops Assignment 2 Vinay Kumar PDF
PDF
No ratings yet
Oops Assignment 2 Vinay Kumar PDF
10 pages
CPP Notes - 02
PDF
No ratings yet
CPP Notes - 02
30 pages
Oops 01
PDF
No ratings yet
Oops 01
16 pages
Oops 02
PDF
No ratings yet
Oops 02
25 pages
OOP Notes
PDF
No ratings yet
OOP Notes
24 pages
Virtual Function
PDF
100% (1)
Virtual Function
23 pages
Bhavya 28th January 2023 Notes
PDF
No ratings yet
Bhavya 28th January 2023 Notes
13 pages
C++ Part1
PDF
No ratings yet
C++ Part1
16 pages
CS201 Handwritten Short Notes (VUAnswer - Com) Handwritten
PDF
No ratings yet
CS201 Handwritten Short Notes (VUAnswer - Com) Handwritten
13 pages
C++ (Unit-3) No Operator Overloading
PDF
No ratings yet
C++ (Unit-3) No Operator Overloading
21 pages
OOPS
PDF
No ratings yet
OOPS
53 pages
Byts Week - 4
PDF
No ratings yet
Byts Week - 4
18 pages
OOP Practical
PDF
No ratings yet
OOP Practical
30 pages
UNIT-1_PSTC
PDF
No ratings yet
UNIT-1_PSTC
25 pages
Opps End Sem Imp Solution
PDF
No ratings yet
Opps End Sem Imp Solution
12 pages
Oops Assignment 1
PDF
No ratings yet
Oops Assignment 1
6 pages
Oodp Unit 1
PDF
No ratings yet
Oodp Unit 1
38 pages
Computer Notes (Complete)
PDF
No ratings yet
Computer Notes (Complete)
128 pages
OOSD
PDF
No ratings yet
OOSD
20 pages
C++ Hand Written Notes
PDF
No ratings yet
C++ Hand Written Notes
15 pages
OPP Assignment 1
PDF
No ratings yet
OPP Assignment 1
19 pages
12th CS - 1 Practical
PDF
No ratings yet
12th CS - 1 Practical
50 pages
C193243 Cse-1221 PDF
PDF
No ratings yet
C193243 Cse-1221 PDF
28 pages
OOP Ques
PDF
No ratings yet
OOP Ques
10 pages
C++ Assignment
PDF
No ratings yet
C++ Assignment
34 pages
Java Handwritten
PDF
No ratings yet
Java Handwritten
18 pages
C-Programming ShortNotes
PDF
No ratings yet
C-Programming ShortNotes
7 pages
Model X1 Six-Shooter Common Settling Pond Layout Drawings 120207
PDF
No ratings yet
Model X1 Six-Shooter Common Settling Pond Layout Drawings 120207
4 pages
PCPF ?
PDF
No ratings yet
PCPF ?
35 pages
Oops Using C++ Unit 1-4
PDF
No ratings yet
Oops Using C++ Unit 1-4
187 pages
Exercises C++
PDF
No ratings yet
Exercises C++
37 pages
OOPs Notes in C++ by Arpit Singh
PDF
100% (1)
OOPs Notes in C++ by Arpit Singh
20 pages
Oops Assignment 2
PDF
No ratings yet
Oops Assignment 2
11 pages
8tohc Void Main (Shingi Aas) : Corvso Le
PDF
No ratings yet
8tohc Void Main (Shingi Aas) : Corvso Le
14 pages
BCSL 032
PDF
No ratings yet
BCSL 032
16 pages
Oop Practical Manual
PDF
100% (1)
Oop Practical Manual
34 pages
APznzaYLsRd8Svkd4QP9GWRBjHWl6JF3tP-DIYCGU7pFD1X6qtAsz7ZX2kQOnid64S7jS975QD-L3XYk3YHaX6yh1fleocZkfr_LBd4bz90MlkJYyWn0n6Pl0YDIRgXKoH-xTdDz_mOXiqy_w72yPfSqcur8RAReuxRPEWSd059J9EaSwx0aY9hUllNjWsY5MwrUpt0qybtFmjwI-kbNsr
PDF
No ratings yet
APznzaYLsRd8Svkd4QP9GWRBjHWl6JF3tP-DIYCGU7pFD1X6qtAsz7ZX2kQOnid64S7jS975QD-L3XYk3YHaX6yh1fleocZkfr_LBd4bz90MlkJYyWn0n6Pl0YDIRgXKoH-xTdDz_mOXiqy_w72yPfSqcur8RAReuxRPEWSd059J9EaSwx0aY9hUllNjWsY5MwrUpt0qybtFmjwI-kbNsr
4 pages
Teach Yourself CNC
PDF
0% (1)
Teach Yourself CNC
605 pages
C++ Assignment
PDF
No ratings yet
C++ Assignment
121 pages