Beruflich Dokumente
Kultur Dokumente
Computer Applications
SURA'I.
.Wnat is a class?
1
I A i a s s is a collection of objects with s&~e attributes mcr
,I
operations
- -I
F c ~ e f i n eencapsulation
( Wrapping of data and methods in a single unit is called
1I
encapsulation/
43.Write syntax of creating an object?
Classname object name= new classname();
Eg., icse obj =new icse( );
4.Define module
I
A module is a small program in itself which cm-be tested
I
i
and it can do a specified task.
5.Define an attribute
An attribute is a type of information that a java class
consists. An attribute determines the qualities of the oc.iects I
I
Sdonging to a particdar class.
6.What do you mean by behrrviour of a class
Behavipur can be used to change the attributes of an
objects?
object.Behaviom of a class if objects is implemented using
methods.ail objects can communicate with each other using /
methods.
7.Whgt -are the JDK zpols? -_ _.
. Ja~a-javainterpreter; javac- java compik; javah-it prodticks i
/
header fiiesjdb-java debugger.
I
S.What is the reason of syntax enors in a
Violation of any rule of a programming language causes
program?
] syntax errors.
--,
,$'. Give some situations when syntax error can
I i. wrong use of statement(if-else,for lcop erc.)
!
ii. missing of semi-colon iii.missing of braces
iv. wrong use of punctuation.
.I
is the difference between print( ) and
curcent positioi:
~ h e ~ r i(n) tsends d a b to the n~onl:orat
1
prist'rr~(j ine:hods?give examples.
\ and does nor index to the next line. The prinilno
1
Method terminates tk.e text to--the nex: line autornzticz!;y
-- 1I * . w
I 1 .%'rite four feature of java language.
Java is a plat!orm-independent, it is portzble. ~t is hlgr~y
reliable, ~tis an object oliented language -. ,I
i 12.Vv1itefcur libraries of Java (JDK 1.3).
Jata.iangjava.appletjava.io ,java.aw.
I
u
-wo;menting? /
Comlocnts explnin the purpose of the prosam ard usiiah!~:
!.
/C
used innpai-iicular progranl.
Q
-1 x/-'1~~har is debugging?
The piogamming errors a;e called bugs end the r c m o . . a l d
.
these errors is called debugging. 3ng.- icay occLr dut. to
i
t r
incorrect coding, faults in-design,
cur kz: s m r s
- _ - - _ . . - I - - . - -4
LE='cn
----. . . b-J . ~ l J .
--. , .
?.'ick.;cn ;f =y g:re-r,~.ricd;I :c; rr7.,r.-z. ~ I Y S z i ~" ~ r7
~ .I
r
1 16. Mi'nat do kau mean by runtime errors?
The errors which occurs during the p r v p a i 12:
,,",LC frorr
II
the syntax errors is called runtime errors. Tiles13errf"-s occ.~: I
i
during the program run.eg., dividing a nu.r?;ber ay zeic, z.,
S,-J=Q)
indices out of bounds,range errors.
1- m b ? ; ; (is jc,u mean by logical errors?
When the program doe:; nor produce the cijrr~cto ~ i p ueve
t . ,
if there is no syntax or run time errors.These errors are. m2de
1
1
1
s$
2 -=
F=!S
-------up
?<-.:;.%%
4-3
.,,LLL-".
..L.A
.eusF
pg"s:
k Q- ssb
cr;.go
J?%Z
LA
1.
I
'
Ir--"- - c - -
II l d Liellne a constztr.
--
bT'vJbat is a variable?
1
I
;&I* ::g .
Real cc,ns%mtsare the riambers cor:taiSn;ng S~~?ii;il:!
1 123.34.
/ A variable is a quantity which vancs dur:ng [Lie cxzc~rior.;f
1 a p r o p m , A variable is a memory locr.:icn wC~er:: fri.2
i~"om~srion
is stored.
Boolean, P:reak,defa~lt, swie~h,irn~cfi,:si
I
--
!
i
t,r-.fLlrl~4- ...:--I
IL: .,-- Akri.ci!:
::.j36::~:->1:~?
try.
-r
->
25. Define a.
aope:ator
Lib,y,rtiu;
-a
_ _ _ I _ _ . _ _ _ _
Z,-0cL3
-- -- -- - 1
I
by reai constants?
.b
-i.-
~ O W
mean
=zzi
.,--
~1
!-&!Y~:;/.LL?~?";;~
.
i
~ ~ ~ :~pii.>i
~ ~ < ' ~ _:
,
ITCON COMPUTERS
Ph. 09377805091
u.
_._
.. .__-_
'
de.72+vp
, tr.
%j:$.ff$tr
ITCON COMPUTERS
IA
+ ,- , * ,I .% operators
a.
m
p
\ operators?
34. What is the use% comma operator?
dP
2.gO
+
'E'
Q .z
W E
I
1
I
logical operator !
-0f ~ O $ S C ~
0~3,~2tot
I!
11
c-,,x,l.
-..Jlllr.-,,c
,
LLYO
e:
A--T
-,LL.-_
. _-
. - -
1
1
-.
d .
--.
.
v;
I
>
The set of repetitive statements within aioop is called body
of the loop.
1'
1
Mile
1. The statement is not executed when condition is not
satisfied.
2. The condition is tested before execution
3. The loop terminates if the condition becomes false
A constrilctor is a special member function that is
automatically called when an instance(object) of a class is
declared
A constructor is called when an object of the class is created.
A default constructor is a special member function that
initializes the objects.
, It is called default constructor because it declares no
1
I
J ~?&ih"-
OI
ITCON
COMPU-1
tK3
110-115 ~ i iiohf
y Chqping Centres
--
functions
52. What is a parameterized constructor
9
1
I
Variables referring
- to the obiect are references. Aily chmge
I
called side effect.
Allocating space for a new object. The new operator in jma7\
instantiates a class by allocating memory for a new object. -. i
-.What is nesting of a class?
A class can also be declared in another class. This is called
nesting of class.
63. What is function overloading?
Functions can be created with the same name but different
arguments
/parameters is called function overloading. -- -.
64. Define a slring. How can you obtain the
String is a series of characters. Strings are constant and :C~.ii
length of a string.
values cannot be changed after they are created but string
I
objects can be shared.length( ) is used to find the length.
65.Name the function which changes the case of a toLo..verCase( )
I
-.i
----
--
Q,
q)=
Jzoe
1-
-4
t
Visible to all classes
1
Visible only within the class,not by inheritors, not by other 1
classes in the package.
II
Visible to classes outside the package that inherit the class, 1
I
also to all classes in the package
i
llection of finite number of objects, data
.'
-in
A=
L . . ~ = C D
(CJ c n w o
.,v,E,
.,
q
, ,
c t
$
. z-zt:!--;
~t;;,.
1
80. What are the objectives of using arrays?
I
73 2
5.%O
O5.
s --,
hl
m
s
6 ..c
.E- ~z n= sa~
re;
O * O
~ 2a , *~ - g
.
i
'$?Pfi
3zzm
+-.pg
L
.
.
90. What is a local variable?
9 1. '??hat is a global variable?
92.What are jump statements(unconditiona1
branch statements)?
93. What is the use of the return statement ?
. What is a scope?
---- /'.
Zero
The array whose elements are specified by single subscript
is called SDA. Array having two dimensions is called
DDA.
1.Arrays are used to group storage locations. 2.The
elements which are numerous are declared in a brief marmer
using subscripts, 3 .elements are stored in cofitiguous
locations.
It can be initialized after its declaratior,. Eg., int
6
arr[5]={12,8,20,16,3);
Sorting is a technique in which the array elements are
arranged in a particular order either in ascending or
descending order.
Each and every element of the array is compared one by
one with the given item to be searched. [Refer your
textbook.]
The binary search is an efficient techiq.de to search the
given element in minimum possible comparisons. The
desired element may be present in the first half or the
second half of the may.But elements should be in sorted
order.
Thc smallest element is searched and placed in first
position. after that the smallest element of rest of element is
searched and kept in the 2ndposition and so on.
The first two aajokirrg elements of the array are compared 1
and if found out of order, these elcxent are exchanged
.finaily the elements are manged in ascending or
descending order.
-I
Abstraction, Encapsulation, Inheritance, polymorphisrri
This includes any character belonging to the character setof 1
1 i e i ~ aA
. variable. qiaicih is declared as a char type Secomes a
character
----variable. T1Gs type assumes a size of 2 bytes.
( This iz used to test a particular conditior, during the
exec1 tio on of the program, It takes two values as constants. ,
that i.:true or false. It uses only one bit of storage in the
memory.
aria& declared inside a method or block.
Class variable which is available to the entlre class.
Return, break and continue.
It is used to return
The program area inside which variable can be accessed, is
cdled variable's scope
If a loop does not contain any statement in its loop-body ,it
There is no statements in the body of the loop. It is used to
L
I
ITCON GoWUTERS
1trj-naqi,iight. S ~ W PCentre;
~~B
SWt.
ICSE
V
THEORY +ART 1
I .What is JAVA?
I
i) JAVA is both a programming l a n h e and a platform.
ii) Java can be used to write or create variaus types of computer application3.
iii) Java is also a platform for application development.
4.What L a translator?
Basically computers can understand only the machine language (0's and 1' 3). Therefore, the
programs written should be converted into machine code. For this, the tmm!ator's soiWme is
developed to convert the languages into machine code. There are 3 types of translator software
available.
i) Assemhher: T i s translator is used to convert the program written in assembly level l m p g e
into machine level language.
ii) Compiler : This is used to convert the high level lmg-nge into machine .eve1language. It
translates a complete program into object code before it is executed. A coml~iledprogram wil rr;r
faster than an intepreted program. Eg., COBOL,FORTRAN ,ADA, ALGOL,SNOBOL z?c.
FA)
pnz""-'c.-r r.:--. 9:..-a -.4 ,. ,,A '.q&
'
'12-.re! ! a n g q e into x:ac?ke !.)i'_;l~l$~.an
GC;U LV UVAA\
interpreter checks for errors statement by statement, convats the statement :nto rnackine code
execute the statement. Eg., GWBASIC, PILOT etc.
L-rluLVI
-;..
Y.L
Ph. 09377805091
-!
SbFlkl.
Ph. 09377805091
6.What are the chaaactrleristics of JAVA
i) Write snee ran amlaere (WOW)- The Java programs need to be written just once, which
can be run on differentplatform without making changes in the java progml. only thejava
interpreter is changed depending upon the platform.
ii) Light weight code - W~thjava, big and useful applicationscan also be created with very light
code. No huge coding is required.
iii) Security-Java offers many security features to make its program safe md :=cure.
\
iv) Bdt-in Graphics- Java offers many built-in graphics features md routines which can be used
to make java application more visual.
V)
vi) Sakpposgs MmPBime&a-Java is ideally snited for integration of video, audio, animation and
gaphics in Internet environment.
,-.,
vii) Platform Lndependent- java is essentially platfop independent. Change of plafform does not
&ect the original Java Program/application.
- .
3. What is BBue.T?
i) It is an ewiroment specially designed for teaching at an introductory levc~l.
ii) It was designed and implemented by the Blud team at lbaonash University, Mmblbome,
9. When yoa compile a pmgram written h the Java programming hngatage, the compiles
coxaverts the human readable source Tile into pplrrtfomm independmt code that a .WM can
landemtandl What is this plspl-8orrxn independent code called?
h w e r : Byte code.
10. How can yon say that j a w is both a psugramnning language and a pl~atfom?
Lilce any other pogrmming imguage, We can muse java to write or create v vious types of
computer application. 2% word platform generally is med to refer to some csmb'mation of
Bardware and system software. The java platform is a new softwm platform designed to deliver
and run highly interactivetdynamic and secure applications on networked computer systems.
I I. How is or&hary~ompihtionprocess is StifFerent from jstva compilation?
ordinary compilation ,the source code i s converted to a machine code, ilvhich i s dependent upon
the nutchine or a the platform This resultant machine code is called native emcutable erode?.
Contrary to ordinary compilers, the Java compiler does not produce native e?:ecutable code for a
particular machine. Instead it produces a specid f o m t d l e d Byte code. Tke Java Byte codia
looks a lot like machine language, but unlike machine language Java byte code is e W l y the same
on every platform.
The Java programs need tb be written just once, which canbe run on different platforms without
making changes in thr.Java program. Only the Java Interpreter is changed depending upon the
platform. This characteristic is known as Write Once Run Anywhere.
14. What js an initial class?
A Java p&gram can contain aany classes. But one class in a Java program can contain the main
. .
-. -
--
,A.
Java Development kit provides a number of tools which are essential to develop run$ run Java
programs. The took are:
java
:Java Interpreter. It runs applets and applications.
18vac
:Java co~npiler.It translates Java source codes to byte-code !iles ,so &at Che
interpreter couid read them.
Javadoc
: It creates HTML formats documents from Jcrva source code fibs.
Javah
:It produces header files.
Javap
: it is java diassembler. It encodes byte codes to p r o g m file;;.
Jdb
: Java debugger. Yt firids errors and removes them from the pvgrm.
Ph. 09377605091
. ..
i110-1
~15,cCity~iirhtk~ h'o ~~~ i'Centre,
0%$:~$~~
ncj
SURAT.
Ph. Q9377805091
i) C h m t e r set is a set of valid charactersthat a language can recognize. ~richaaacder set represents
any letter, digit or my other sign.
ii) Java uses the h i c o d e character set. W,naisode is two-byte character ccde set that has
characters representing almost all characters in almost all human alphabets and writing systems
around the world includeing English, Arabic, Chinese and many more.
iii) The first 128 characters in the Univcode character set are indentical to the common ASCII
character set. The second 128 characters are identical to the upper ????
2. PVh,
T O ~ N SThe
- smallest individual u d t in a programs is h o r n as a TOKEN.
Java has the followringtokens- keywords, Identifiers, LitenL, Pmataa~:omand Ope~abss.
ii) Tdeantfiaem - Identifiers are fundamental building blocks of a program and are used an Ga%=
general terminology for the names given to dierent parts of ihe program Ti.
variables ,objects,
dasses, PultpsGons, arrays etc.
zs
Y
*J
:c
a3
66
>
EL .s
'OD%
C C .
-sub-m
0
-4
,=
cn
-40
"x-c;Lg
.
e
a
....>::.-*-
, , ~ --r Ztcrds (cftzzi rekrred to as constants) are data hem that zre Exec3 data values. ; ~ . . r a
allows several kinds of Literals.
a) hteger Literals
b) floating literals
c) Boolecaa literals d) character literal
e) string literals
f ) null Literal.
A s
L~-,$
c
.=3r --.so"
305
aa
a) Bntntkges Literals: are whole numbers without any fractional part. An integer constant must have
- sign. A
number with no sign is asstuned to be positive. Commas cannot appear it1 an integer constant.
There are 3 types of integer Iliterds - decimal, octal and hexadecima1 Btcmb.
at least one digit and must not contain any dlecimat point. It may contain 3 i k + or
. . ITCON CxMhPUTERS
110-1I 5, o i ijg6
~ ishogph~Centrel
c) Boolean Literals: It is used to test a particular condition during the e cecution of the prosam.
It takes two values as constants viz. true Or fake. It is denoted by the tern1 Boolean and uses only
I
one'bit of storage in the memory.
I
/
d) ~ h a k c t e Literals:
r
A character literal in javd m ~contain
i
one character and must be enclosed
in single quotation marks. Java allows you to have c d n non-graphic ch,&ers in character
co&ts.%J~n-~ra~hicalcharacters =&those characters $?t c&nG be typed directly from
keyboard. Eg., backspace, mix,"
carriage r e w e t c . These cliiiracters-canI: ii represehfi by using
escape sequences. An escape sequence is represented by a black slash 0) jblIowed by one or more
characters. E.g, \a - Audible bell, \b Backspace, - carriage return etc.
6
0
a3
25
==Jw
a-s.
dEit
> CS)
& ."
w
g
c c
.-
C z ?3
? ~m
cs; <a
c3.
Z$%h*
o w
g Ci-D=k
Lt'3
3 M - C $ )
~3 F.ZLs g
0
ZF80,
9
W
ii) Reference dab @pisare cop1shct& fram primitive data types. Thr:se ;ere dasses, mays
and interface.
ITCON COMPUTERS
Nurture Leilrning ~ v t ~. l d .
$Ir;i.
Log%
d.Jj'6.YC1.i
I L?&.a
Points to remember:
i) All numeric types in Java can store negative as well as positive number,;.
B
ii) By default, Java assumes the hctional numbers to be of double dab type unless specified. To
explicitly specify their type ,use m B e s F and D.
iii) Use suffixes I, L,Uong) f, F7(float)d, D(doub1e) to explicitly specify data type of a data value.
short b=a;
Zn which case the return valne determines the initidition This type i r called dynamic
initid izafmn.
6 CPEUTORS EN JAVA
The operations are represented by crperators and the objects of the open tions(s) are ~sfczed
fr, *c
Operands. Izva bas a rich set o f o p m t ~ rcomprises
s
of arithmetic, reHa~oaa4,logical.
52 /. ;.3.--> -v-.~ g d i ~ " 5 (--,
~ k *~ :, - , !, % j
h r i h e t i c operators are binary operator. b'ws it act upon two operands e.g,
r...~r
C=
a +b
a) Unary akiibhetis operatom: - operators that act on one operand are ~eferredto as unary
operators.
i) rm.rrary+ :the operator unary '3-' precedes an op=mnd.
Egl., if a=S +a means 5 E@., if a=O +a means 0 Eg3., if a= -4 +a means -4.
ITCON COMPUTERS
3,o.n5, QQ ugm showins centre*
SURATi
Increment operator apd decrement operators
The prefix increment or demment operators follow changetP1c:m-mede.i.e., they first
change the value of tbeir opemd, then use the new value in evaluation the expressio~~.
Eg., refer your class work
.
* The postfig or decrement operators follow use-then-cha&ge rul: i.e., they fir?i use the
value of their operaud i? evaluation the expression and then chalge the operand's value.
e.g, refer your c h s wofk
I
The increment operator,++and decrement operator - are ohmy o~emtoni.a.,they
operate upon single o e a n d . And the po& incremenffdecremmtoperators I$ve higher
precedence over prefur increment' decrement operators.
I
65) Relational operators: ( k ,<= ,> ,>=, = = ,!=)
I
I
It refers to the relationships1thatvalues can have with one anothet.
Jamprovides six reltional operators for comparing numbers and chiracters. But d e y do not
work with stting.If the comparison is true tlie relational expression n:sults into the value 1 and
if it is false to 0.Avoid equal* comparisons on floating -point a umbers.- -.*.*" .L "
.
0 - - .
1 ( - This logical operator evaluates to true value if either of the two expressions is me.
Eg., if (clas = = 9 1 1 clas = = 11)
System.out.prinP("you can participate in ZPranatics); ,
else
System.out.print("you cannot paeziciwte in Dramatics);
Eg. if( ! (56>90)) result into 1 indicating true as the given er pression being 56 as
greater then 90 is false.
7. Java shodtiP;d operators: Java offers special short-lmdsthat simplify the coding of a certain
i-ype of &?;sigimm:
5bi&n?f:~t.
Egl. x = 10; equivalent to
x=x-10;
Eg2 x * = 3; eqlivaleni to
x= x*3;
Eg3. x 1 = 2; equivalent to
x d ;
Eg4. x % = z; equivalentto
x=x?40z;
Eg2., ==(@st
9.OPEPLQTOIPS:
:t
1i
! 6
Cd:)
=a
E
+a w
c
-i a
<.-.J.
Y"
0-
C3
.-a
ITCON COMPUTERS
110-1.15, city tigh<Si~ljogpingcentre,
SURAT.
"r"
I
When constants and variables of different types are mixed in an expression, tiey me converted
to the m e type. The process of mnverting one predefined type into mt~tber called W E ,
COTVIERSON. r hmt are two forms of type conversion.
$
I
;iai.'
.g:
hA.
i'J
fio&
;6;&de
double L J J
A,,
.+
Wl
I
12. Explain the R E W S statements of JAVA.
i) /*
ii) /!
iii) I**
*I
*/
13. %%atare Assignment operators: These operators aTe used to assign t l ~ evalue of an expression
to a variable. The following are the assignment operators in Java.
Operator
operation
fomnt
Meaning
--Assignment
2-1 0
10 assigned to
The variable a
+=
add to the variable
a+=5
a=a+5
- -subtract fiom variable
a- =5
a=a-5
*=
Multiply to variable
a*=5
a=a* 5
/=
divide into
a/ =5
a=a/5
a%=5
a=a%5
%=
Modulus of
- ,
-.
<<
>>
Bitwise OR
Bitwise XOR
left shift
right shift
Bitwise compliment etc.
ITCON COMPUTERS
110.115, city ,Light
Shopping Centre,
I
SURAT.
cfL>
The data types that are based on fundamental or PrimitivLdata types ,a:known as
C ( P ~ O 8DATA
I ~ TYPES. All reference data types can be referred tc; as composite data
types. Since these data types are created by users, these are also known as USER-DEF'BmD
DATA TYPES.
17,Types of errom:
rules.
ij Syntax errors: Every language has fixed grammatical rules and are call-d
violation of any grarmmatical rules causes s9tax errors. If the ~rogramlninglanguage is not
band,led properly, syntax errors frequently occur. Syntax errors are also called as
compilation errors. ,
I
E:
.O
8
.,,=-rc-32
0-. ."a.
c
("3
- .- l/s;F;.
c = a
I,s;
IX
L.
Q)
$*,=
2 %- 8
% L n cCC, , L
-3-B
J,
- .
:2
4-
,..;
zgg
0
FJnjr;k*pc:
h-es~rring
\-jwt,,
I-td.
lTCON COMPUTERS
Pia. c93T7$(j$fi21
BRY PART E
l
1. Define the tenn Object Oriented Programming.
OOP stands for Object Oriented Programming. The programming languages Ctl- ssnd Java
follow the 0 0 F concepts. The limitations of the procedure oriented programming (POP)
~ ~ g ehave
s given
,
place to the dwelopment of the OO?. The different OO? languages are
C*, Java, small^, Sizaula, Eiffel etc.
2. How does an Object differ fiom a class?
Object: An object is an identifiable entity with some characteristic and behavior.
Eg., refer your Xerox copy notes.
Chss: A class is a group of object that s h e common properties and relationships.
3.%a," the various conbcpe of Object Oriented Programming.
3211: basic concepts of OOP are:
i) Abstraction
ii)Encapsulation
iii) Inheribam
iv) Polymorphism
b u :
-.
iii) Hwheritomee- is the by which objects of one class acquire &e p p r i e s of objects of mothex
class. This further provides an irnpommt extension to the idea of reusani1ity.e.. a part.ia~Je:
prapmmex can make use of an misting class and without my fiarher ~nodificatiori~,
add
additional f e m e s and capabiliths to it, by deriving a new class from tk.e existing one, though
irlhe~tan*.
iv] ira@m:ngb&m is the :ap,ciw $9bllow ~);tjw.t~
~E.--~TA;i.Tw-~+
hf3~:'?:
Cti
- +----.
J M L ~ C xtmai intdaw. It is the ability jbr a messrage or data to be proaased in mme urn axle
rhrt..~ v +
fom.
4. Name any fom advannntages of OOPS.
i) Elimination of redundant coding system and usage of existing classet through inheritance.
ii) Program can be developcc! by sharing existing moddes.
iii) Secrarity of data values from other segments of the program through data hiding.
iy) Possibility of co-existence of multip1e instances of an object without any interfereme.
5 . CL4S8%S
OBJECTS:
a) A java prop;rm consists of objects and object is referred ta as an instance o f the dass.
b) W 3 . e ~a class is ddmed, m m.emory space is allotted to it. This is becaw a class is simply a
blue print or logical placeholder containing objects and methods. Memory space is allocated when
objects ofa class type are mated.
c) To declare variables that are members of a class, the declarations must be within the class body,
but rtot witbin the body of a fimctionlm&od. Variables declared within the body of a method are
focd to &at method,
..
8. Define an attribute.
I
An attribute is a type of information that a java class consists. An atrriitute &tennines the
qualitie,wf,theobjects belonging to a particular class.
'
iii) Protected visibility means the derived class can access private public members of the base
class protected. In protected inheritance, the foIIowing rules should la followed.
a) Protected members of the base class are protected in the derived r :lass.
b) Public members of the base class are protected in She derived elacs.
C) Private members of the base class remains private. They are visible only in the base class.
Ph. 0937780509'1
fir\-,.
. i i
C~N@UTERS
v
nur,aKklid;rt$
iLe&r;-li~g
Pv;. $%d,
i9 0-1 15, Gily!igi~lShop:lng Centre,
Gitl;iiyhk L x d , S ~ r a r .
PI!. -
'
i~i
'"))5O"'"
r 43 i
~J~JLJ.
.-.
~ t u x l x";
1
11
Here a and lia are acctual parametem. x and y are formal parameters.
2. Why FTJNCTXONS?
i)
to allow us to cope with complex problems.
ii) to hide low-level dztails that otherwise obscure and confuse.
In &war, an primitive types art: passed by vdae and alg xeferemce typc:s (objects, arrays) are
passed by rekemse.
FUNCTQNS: A pwe h s t i o n is one that takes objects or prinli'rives as arguments but
does not modify the objects. The return value of a pure function is either a primitive ar a new
i\
F u i l d ~ ioverloadiig
l
is the methods for calling several Pma$oms bgre f he sams name. These
functions are different by the number of arguments arid the .data types of the agumcnts passed to
these fihnctions.
Eg., float area (float radius) N 1 atgumat with float data type
float area(float length, float breadth) // 2 arguments with 2 float data types.
float aregfloat side1$oat side2,float side3) // 3 arguments with 3 Roat data types.
+:'
Shopping Cz.!??"?,
$ha Q93778G5C4";
r'
ITCON COMPUTERS
SURAT.
7. What is a @ON$TWUCTOlt?
is called fCQNsTRUcrQF
il A member h c t i o n with the same name 2151 its
initialize the objects of that class type with a legal kitidvalue.
ii) Constructors have no return type, not even void
iii) Constructors get executed amtommoticd'ywhenever an object is cre3eed for the cl85:ss.
J.- UGtOn;
iv) default constnnstora :A constructor with no parametem is called s default conp*
V)~wametarizedsonstrmstors: constmct~)rs
which have arguments tiefined in t1:eir panthesis
&e called parameterized constructors.
8. What is an ARRAY?
i) An array is a collection of variables of the same data type that are re Ferenced by a common
l-&Ae.
ii) Array consists of contiguous memory locations. Tke lowest address r:oneqmnds to the Tist
clemefltand the highest address to the last ebmeui.
iii) T k element numbers in [ I we called subscripts or indisee. AJI m
s y must be defied before it
can be used to store information.
Iv)
Thc data t j p e of m y elements is known as the bm,type of the m i y .
V) two types of m y s : single or one dimension array and double or two dimension may.
v) Tne subscripts other than 0 to n-1 far inn m y having n elements art: called out-af-bounds
sublbscrige~.
9. what is $ORX'ING
?
Sorting of an array is the technique of arranging the array elements in a spc%ed order. i.e. either
13
-___2__._I