kamal java paper6
Post on 02-Mar-2018
227 Views
Preview:
TRANSCRIPT
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 1/11
This is to Certify that Mr./Ms. KAMALKISHOR DASHRATHLAL PRAJAPATI of the
Study Center Atharva Institute of Inforation Te!hno"o#y havin# PR$ $%&'&&&%()* has
a++eared for the e,aination he"d on '' Jun %&'%at Ma"ad- for the Course 0JA1A0.His/her ar2s are as fo""os3
Theory Mar2s 3 )& out of 4&Pra!ti!a"/Assi#nent Mar2s 3 '4 out of %&
Tota" Mar2s 3 *4 out of '&&
5rade 3 Distin!tion
6(&7 8hi!h e,!e+tion ay 9e thron if the #iven !ode is e,e!uted #ivin# % inte#er
runtie ar#uents!"ass sa+"e
:
+u9"i! stati! void ain-Strin# ar#s67
:try
: int a;Inte#er.+arseInt-ar#s6&7<
int 9;Inte#er.+arseInt-ar#s6'7<
int ! ; a = 9<Syste.out.+rint"n-0Su is 0=!<
>
!at!h-Aritheti!?,!e+tion ae
: Syste.out.+rint"n-0Aritheti! ?,!e+tion 0=ae.#etMessa#e-< > !at!h-$u9er@orat?,!e+tion ne
: Syste.out.+rint"n-0$u9er @orat ?,!e+tion 0=ne.#etMessa#e-< > !at!h-?,!e+tion e : Syste.out.+rint"n-0?,!e+tion 0=e< >
>
>
Choi!e a
Aritheti!?,!e+tion
Choi!e 9
$u9er@orat?,!e+tion
Choi!e !
?,!e+tionChoi!e d
None of the above
6%7 In JavaB hen a runtie error o!!urs hi!h of the fo""oin# ay ha++en
Choi!e a
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 2/11
!o+i"es su!!essfu""y
Choi!e 9
+rodu!es ron# out+ut
Choi!e !
a9nora" terination Choi!e d
All of the above
6%47 In JavaB hi!h ?,!e+tion ty+e is !aused 9y an atte+t to a!!ess a none,istent fi"e
Choi!e a
FileNotFoundException
Choi!e 9
IO?,!e+tion
Choi!e !
Inva"id@i"e?,!e+tion
Choi!e d
IO?,!e+tion
6%*7 In Mu"tithreaded +ro#rain#B hi!h ethod is used to transfer !ontro" to anotherthread of eua" +riority 9efore its turn !oes
Choi!e a
yield()
Choi!e 9
resue- Choi!e !
ait-
Choi!e d
notify-
6%)7 To !reate a +a!2a#e hat is the first stateent in!"udedE
Choi!e a
i+ort Fava.a=.G<
Choi!e 9
package
Choi!e !
+u9"i!
Choi!e d
C"ass
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 3/11
6%7 8hi!h of the fo""oin# ste+ is inva"id for !reatin# a +a!2a#e
Choi!e a
De!"are the +a!2a#e in 9e#innin# of the fi"e
Choi!e 9
Define the !"asses to 9e +ut in the +a!2a#e de!"are it +u9"i!Choi!e !
Create the "istin# as Fava in the Su9dire!tory 9y +a!2a#e enu
Choi!e d
Execute this java file
6%7 The fo""oin# stateents !reate hat ty+e of inheritan!e if !"ass and !"ass C are
ase !"asses
!"ass A e,tends e,tends C:
>
Choi!e a
Sin#"e Inheritan!e
Choi!e 9
Mu"ti"eve" Inheritan!e
Choi!e !
Multiple Inheritance
Choi!e d
Hierar!hi!a" Inheritan!e
6%(7 8hat 2eyord is used to inherit an interfa!e
Choi!e a
extends
Choi!e 9
i+"eents
Choi!e !
inherits
Choi!e dContains
6%%7 8hi!h Strin# ethod is used to !o+are % strin#s !onsiderin# any !ase
Choi!e a
eua"s
Choi!e 9
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 4/11
eua"to
Choi!e !
eualsIgnore!ase
Choi!e d
eua"s!ase-
6%'7 8hi!h of the fo""oin# is +ossi9"e usin# 1e!tor !"ass
Choi!e a
It is used to store o9Fe!ts
Choi!e 9
It !an store o9Fe!ts that ay vary in sie
Choi!e !
It is +ossi9"e to add de"ete
Choi!e d
All of "hree
6%&7 In ethod de!"aration stateentsB hi!h of the fo""oin# is o+tiona"
Choi!e a
Method nae
Choi!e 9
Return ty+eB Paraeter "ist and 9ody of ethod
Choi!e !
#ara$eter list
Choi!e dody of the ethod
6'7 8hi!h of the fo""oin# for of Inheritan!e one dervied !"ass is derived fro aderived !"ass.
Choi!e a
Sin#"e Inheritan!e
Choi!e 9
Multilevel Inheritance
Choi!e !
Hierar!hi!a" Inheritan!e
Choi!e d
Mu"ti+"e Inheritan!e
6'47 An e,+ression usin# o+erators and NN used to !o9ine to or ore re"ationa"
stateent is !a""ed
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 5/11
Choi!e a
!o9ined e,+ression
Choi!e 9
relational expression
Choi!e !"o#i!a" e,+ression
Choi!e d
9oo"ean e,+ression
6'*7 Identify "ine nu9ers here "o#i!a" errors o!!ur in the fo""oin# !ode so that
fa!toria" of is !a"!u"ated.' !"ass fa!toria"
% :
( +u9"i! stati! void ain-Strin# ar#s67 :
int n;&Bfa!t;&<
) for-int n;&<n;'<n* fa!t;fa!tG'<
4 Syste.out.+rint"n-@a!toria" of is Q=fa!t<
>
'& >
Choi!e a
"ines B)
Choi!e 9
"ines )
Choi!e !"ines *
Choi!e d
lines %&'&
6')7 8hi!h of the fo""oin# +ortion s+e!ified in the for "oo+ is !o+u"sary
Choi!e a
initia"iation
Choi!e 9
test condition
Choi!e !
in!reent
Choi!e d
A"" of the a9ove
6'7 Consider the fo""oin# +ro#ra !ode. state the out+ut fro it!"ass ifif
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 7/11
Syste.out.+rint"n-oneQ<
e"se
if -r ;; %Syste.out.+rint"n-toQ<
e"se
Syste.out.+rint"n-threeQ<Choi!e a
ero
Choi!e 9
one
Choi!e !
t*o
Choi!e d
Three
6'(7 8hi!h of the fo""oin# is True ith res+e!t to 9ran!hin# stateents if sit!h
Choi!e a
every if state$ent can be *ritten using s*itch
Choi!e 9
every sit!h stateent ust have a defau"t !ase
Choi!e !
every !ase ust end ith a 9rea2 stateent
Choi!e d
every !ase "a9e" fo""os ith a-3 !o"on
6'%7 (. 8hat is the resu"t if the !ode of stateents are e,e!uted
int resu"t ; -%G-4G-='&G%<
Choi!e a
4
Choi!e 9
+,
Choi!e !
'
Choi!e d&
6''7 8hat is the va"ue of the e,+ression a9NN9a if a is % and 9 is '
Choi!e a
'
Choi!e 9
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 8/11
%
Choi!e !
&
Choi!e d
"-.E
6'&7 8hat is the va"ue of the e,+ression Math.f"oor-'.)*
Choi!e a
'.)
Choi!e 9
'
Choi!e !
%
Choi!e d
/0%
67 8hi!h of the fo""oin# is $OT one of the !"assifi!ation of Java varia9"es
Choi!e a
Instan!e varia9"es
Choi!e 9
block variables
Choi!e !
!"ass varia9"es
Choi!e d"o!a" varia9"es
647 8hi!h of the fo""oin# is a +riitive Data ty+e in Java
Choi!e a
!haracter
Choi!e 9
C"asses
Choi!e !
Arrays Choi!e d
Interfa!e
6*7 8hat i"" 9e the out+ut of the fo""oin# !odeB if e,e!uted ith !oand "inear#uents as fo""os
Fava !d"ine Java is onderfu"
!"ass !d"ine
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 9/11
:
+u9"i! stati! void ain-Strin# ar#s67
:for-int i;'<iar#s."en#th<i==
:
Syste.out.+rint-ar#s6i7<if-i;ar#s."en#th
Syste.out.+rint- <
>Syste.out.+rint"n-<
>
>
Choi!e a
Java
Choi!e 9
Java isChoi!e !
is onderfu"
Choi!e d
c$dline 1ava is *onderful
6)7 8hi!h of the fo""oin# is a Java 2eyord
Choi!e a
2tring
Choi!e 9
su+er
Choi!e !
Mod
Choi!e d
?,!e+tion
67 8hi!h of the fo""oin# is $OT a Java 2eyord
Choi!e a
thros
Choi!e 9try
Choi!e !
hi"e
Choi!e d
Exception
7/26/2019 Kamal Java Paper6
http://slidepdf.com/reader/full/kamal-java-paper6 10/11
67 8hi!h of the fo""oin# feature of C== is $OT su++orted 9y Java and is therefore
i+"eented usin# interfa!es
Choi!e a
$ested C"asses
Choi!e 9
Inner C"asses
Choi!e !
Po"yor+his
Choi!e d
Multiple Inheritance
6(7 Java is P"atforinde+endentB 8hat stateent e,+"ain this feature
Choi!e a
1ava progra$s can be easily $oved fro$ one co$puter syste$ to another
Choi!e 9
Java systes verify eory a!!ess and virus
Choi!e !
Java !an 9e used to !reate a++"i!ations on the netor2s
Choi!e d
It +rovides any safe#uards to ensure re"ia9"e !ode
6%7 In OOP a++roa!h +ro#ras are divided into
Choi!e a
3bjects Choi!e 9
Methods
Choi!e !
@un!tions
Choi!e d
Pro!edures
6'7 OOP treats hat as a !riti!a" e"eent in +ro#ra deve"o+ent and does not a""o it to
f"o free"y around the syste.
Choi!e a
Pro!edures
Choi!e 9
A!tion
Choi!e !
4ata
top related