Sie sind auf Seite 1von 4

MAILAM ENGINEERING COLLEGE

(Approved by AICTE, New Delhi, Affiliated to Anna University Chennai


& Accredited by National Board of Accreditation (NBA New Delhi
Mailam, Villupuram - 604 304
DEPARTMENT OF COMPUTER APPLICATIONS
O!ECT ORIENTED PROGRAMMING " MC#$$%
&VIVA 'UESTIONS (IT) ANS(ERS*
+, (-a. i/ .-0 0102i./ 32 33p4
The principal of data hidin! helps the pro!ra""er to b#ild sec#re pro!ra"s$
Thro#!h inheritance, we can eli"inate red#ndant code and e%tend the #se of
e%istin! classes$
&b'ect oriented syste" can be easily #p!raded fro" s"all to lar!e syste"$
(oftware co"ple%ion can be easily "ana!ed$
$, (-a. i/ Appli5a.i31 32 33p4
)eal ti"e syste"s$
(i"#lation and "odellin!$
&b'ect &riented Database$
AI and e%pert syste"s$
CAD*CA+ syste"$
Newral Networ,s and parallel pro!ra""in!

3, D02i10 Cla//0/4
A class is a User defined data type$ It is way to bind data and f#nctions
to!ether $It encaps#lates data and f#nctions into a sin!le Unit$ &nce a class has been
defined, we can create any n#"ber of ob'ects belon!in! to that class$
4, D02i10 Da.a A6/.ra5.i314
Abstraction refers to the act of refers endin! essential feat#res witho#t
incl#din! the bac,!ro#nd details or e%planations$ The classes #se the concept of data
abstraction they are ,nown as Abstract Data Types (ADT$
7, D02i10 E15ap/ula.i318
The wrappin! #p of data and f#nctions into a sin!le Unit is ,nown as
encaps#lation$ The data is not accessible to the o#tside world, and only those
f#nctions which are wrapped in the class can access it$ These f#nctions provide the
interface between the ob'ect-s data and the pro!ra"$ This ins#lation of the data fro"
direct access by the pro!ra"s is called data hidin! (or infor"ation hidin!$
6, D02i10 I1-0ri.a1504
Inheritance is the process by which ob'ects of one class ac.#ire the properties
of ob'ects of another class$ In oop the Concept of inheritance provides the idea of
re#sability$ This "eans that we can add additional feat#res to an e%istin! class
witho#t "odifyin! it$ This is possible by derivin! a new class will have the Co"bined
feat#res of both the class$
%, D02i10 P3l9m3rp-i/m4
/oly"orphis", a 0ree, ter", "eans the ability to ta,e "ore than one for"$
An operation "ay e%hibit different behaviors in different instance$ This behavior
Prepared By
Mrs. V.Rekha., MCA., M.Phil., (Ph.D)
1
depends #pon the types of data and n#"ber of ar!#"ent #sed in the operation$ It
has two types$
:, (-a. i/ Op0ra.3r O;0rl3a<i1=4
The process of "a,in! are operator to e%hibit different behaviors in different
instances is 1nown as operator overloadin!$
#, (-a. i/ Fu15.i31 O;0rl3a<i1=4
The process of "a,in! an operation to e%hibit different behavior in different
instances is ,nown as 2#nction &verloadin!
+0, )3> .3 D02i1i1= m0m60r 2u15.i314
+e"ber f#nctions can de fined in two pl#s$
In side clans definition$
&#tside clans definition$
++, Ou./i<0 <02i1i.i318
+e"ber f#nctions that are declared inside of the clans con be defined
separately o#tside of the class$
+$, (-a. i/ m0a1. 69 E1um0ra.0<4
An en#"erated type also called en#"eration or en#", or factor in the )
pro!ra""in! lan!#a!e, and a cate!orical variable in statistics, is a data type
consistin! of a set of na"ed val#es called ele"ents, "e"bers or en#"erators of the
type$
The en#"erator na"es are #s#ally identifiers that behave as constants in the
lan!#a!e$ A variable that has been declared as havin! an en#"erated type can be
assi!ned any of the en#"erators as a val#e$
+3, D02i10 S.a.i5 m0m60r/4
A data "e"ber of a class can be .#alified as static the properties of a static$ The
properties of static "e"ber variables are si"ilar to a 3c- static variable$
It is initiali4ed to 4ero when the first ob'ect of its class is created, no other
initiali4e is per"itted$
&nly one copy of the "e"ber is created for the entries class and it is shared
by all the ob'ects of that class, no "atter how "any ob'ects re created$
+4, (-a. i/ /53p0 32 .-0 ;aria6l04
A scope is a re!ion of the pro!ra" and broadly spea,in! there are three
places where variables can be declared5
Inside a f#nction or a bloc, which is called local variables,
In the definition of f#nction para"eters which is called for"al para"eters$
&#tside of all f#nctions which is called !lobal variables$
+7, (-a. i/ L35al Varia6l0/4
6ariables that are declared inside a f#nction or bloc, are local variables$ They
can be #sed only by state"ents that are inside that f#nction or bloc, of code$ 7ocal
variables are not ,nown to f#nctions o#tside their own$
+6, (-a. i/ Gl36al Varia6l0/4
Prepared By
Mrs. V.Rekha., MCA., M.Phil., (Ph.D)
2
0lobal variables are defined o#tside of all the f#nctions, #s#ally on top of the
pro!ra"$ The !lobal variables will hold their val#e thro#!ho#t the lifeti"e of yo#r
pro!ra"$ A !lobal variable can be accessed by any f#nction$ That is, a !lobal variable
is available for #se thro#!ho#t yo#r entire pro!ra" after its declaration$
+%, (-a. i/ S.3ra=0 Cla//4
A stora!e class defines the scope (visibility and life ti"e of variables and*or
f#nctions within a C88 /ro!ra"$ These specifiers precede the type that they "odify$
There are followin! stora!e classes which can be #sed in a C88 /ro!ra"
a#to
re!ister
static
e%tern
"#table
+:, (-a. i/ au.3 S.3ra=0 Cla//4
The au.3 stora!e class is the defa#lt stora!e class for all local variables$
9
int "o#nt:
a#to int "onth:
;
The e%a"ple above defines two variables with the sa"e stora!e class: a#to
can only be #sed within f#nctions, i$e$ local variables$
+#, (-a. i/ r0=i/.0r S.3ra=0 Cla//4
The re!ister stora!e class is #sed to define local variables that sho#ld be
stored in a re!ister instead of )A+$ This "eans that the variable has a "a%i"#"
si4e e.#al to the re!ister si4e and can<t have the #nary <&< operator applied to it$
9
re!ister int "iles:
;
The re!ister sho#ld only be #sed for variables that re.#ire .#ic, access s#ch as
co#nters$ It sho#ld also be noted that definin! <re!ister< !oes not "ean that the
variable will be stored in a re!ister$ It "eans that it +I0=T be stored in a re!ister
dependin! on hardware and i"ple"entation restrictions$
$0, (-a. i/ /.a.i5 S.3ra=0 Cla//4
The /.a.i5 stora!e class instr#cts the co"piler to ,eep a local variable in
e%istence d#rin! the lifeti"e of the pro!ra" instead of creatin! and destroyin! it
each ti"e it co"es into and !oes o#t of scope$ Therefore, "a,in! local variables
static allows the" to "aintain their val#es between f#nction calls$
$+, (-a. i/ 0?.0r1 S.3ra=0 Cla//4
The 0?.0r1 stora!e class is #sed to !ive a reference of a !lobal variable that
is visible to A77 the pro!ra" files$ >hen yo# #se <e%tern< the variable cannot be
initiali4ed as all it does is point the variable na"e at a stora!e location that has been
previo#sly defined$ The e%tern "odifier is "ost co""only #sed when there are two
or "ore files sharin! the sa"e !lobal variables$
$$, (-a. i/ mu.a6l0 S.3ra=0 Cla//4
The "#table specified applies only to class ob'ects, which are disc#ssed later
in this t#torial$ It allows a "e"ber of an ob'ect to override costless$ That is, a
"#table "e"ber can be "odified by a const "e"ber f#nction$
Prepared By
Mrs. V.Rekha., MCA., M.Phil., (Ph.D)
3
STAFF IN-C)ARGE )OD PRINCIPAL
Prepared By
Mrs. V.Rekha., MCA., M.Phil., (Ph.D)
4

Das könnte Ihnen auch gefallen