Java Paper1
-
Upload
kaushik-gowda -
Category
Documents
-
view
213 -
download
0
Transcript of Java Paper1
-
7/26/2019 Java Paper1
1/8
[1] Dynamic binding is associated with
Choice a Polymorphism
Choice b Inheritance
Choice c Both Option1 and Option2
Choice d Neither Option1 and Option2
[2] Which o the ollowing is NO! !r"e with respect to OOP
Choice a #pgrading systems is diic"lt
Choice b $"ltiple ob%ects co&e'ists witho"t any intererence
Choice c (ec"re Programs can be b"ilt
Choice d (otware de)elopment is made easy
[*] +PI stands or
Choice a +pplet
Program
Internet
Choice b +pplication
Pac,age
Inormation
Choice c +bstractProgrammin
g Interace
Choice d +pplication
Programmin
g Interace
[-] Which o the ollowing eat"re in C is NO! incl"ded in
.a)aChoice a Brea,
statement
Choice b Contin"e
statement
Choice c Pointer type
Choice d Primiti)e
data types
-
7/26/2019 Java Paper1
2/8
[/] Which o the ollowing is essential part o a .a)a Program
Choice a Pac,et statement
Choice b Import statement
Choice cClass deinitions
Choice d $ain method class
[0] What is the right method o speciying the main method in .a)a
Choic
e a
pri)ate main (tring args[]
Choic
e b
p"blic static int main(tring args[]
Choice c
p"blic static )oid main (tring args[]
Choic
e d
p"blic )oid static main (tring args[]
[3]
What will be the o"tp"t o the ollowing code4 i e'ec"ted
with command line arg"ments as ollows
%a)a cmdline .a)a is wonder"l
class cmdline
5p"blic static )oid main(tring args[]
5
orint i617i8args9length7i::
5
(ystem9o"t9printargs[i]7
ii;6args9length
(ystem9o"t9print<
-
7/26/2019 Java Paper1
3/8
[>] Which o the ollowing it NO! a )alid character constant
Choice a ?'@
Choice b ?1@
Choice c &/&1/:227
Choice a /
Choice b 0>
Choice c
1-0
Choice d 1*-
-
7/26/2019 Java Paper1
4/8
[13] Which of the following statements do not fall in selection statement category
Choice aif statement
Choice bswitch statement
Choice cconditional operator statement
Choice dfor construct statement
[1-] What will be the o"tp"t o the ollowing code segment
n6/7
r6nE*7
i r 66
(ystem9o"t9println
-
7/26/2019 Java Paper1
5/8
=
Choi
ce a
F is greater than y
' is greater than y
Choi
ce b
y is greater than F
' is greater than y
Choi
ce c
' is greater than y
' is greater than F
Choi
ce d
' is greater than y
F is greater than y
[10]Which o the ollowing looping constr"cts body4 will e'ec"te at least once e)en i
the condition is alse9
Choice a or
Choice b do
Choice c while
Choice d none o the abo)e9
[13]
What will be the o"tp"t o the ollowing code segment
int r627
whilerG
5
r6r&17
irGcontin"e7
(ystem9o"t9printHr is H:r7
=
Choice a r is 1
Choice b r is
Choice c r is 2
Choice d r is 2 r is 1
[1>] ow is it possible to ma,e it comp"lsory that a method is redeined in a s"bclass
Choice a By ma,ing a class pri)ate
Choice b By ma,ing a class abstract
Choice c By ma,ing the class inal
Choice d By ma,ing the class )irt"al
[1] What is )alid or abstract classes and abstract methodsChoice a We cannot "se abstract classes to
instantiate ob%ects9
Choice b abstract methods o an abstract class
-
7/26/2019 Java Paper1
6/8
m"st be deined in its s"bclass9
Choice c Constr"cters cannot be declared
abstract
Choice d +ll o the abo)e
[2] !he concept o inheritance is implemented in .a)a by
Choice a creating more than one class
Choice b e'tending two or more classes
Choice c e'tending one class and implementing
one or more interaces
Choice d importing classes rom pac,ages
[21] Which o the ollowing (tring methods is "sed to gi)e the nth character o the
string
Choice a s"bstring
Choice b replace
Choice c char+tn
Choice d inde'O n
[22] Which o the ollowing are similar to the (tatic inal constants
Choice a +nnotations
Choice b Jectors
Choice c Kn"merated types
Choice d Ob%ect types
[2*] What can interaces containL
Choice a $ethods
Choice b Jariables
Choice c classes
Choice d Both 1 M 2
-
7/26/2019 Java Paper1
7/8
[2-] In the Interace deinition what is !#K or method declaration
Choice a ist o methods declaration is only done
Choice b $ethod declaration as well as body
Choice c Only one $ethod declaration can be done
Choice d Only one $ethods body is allowed
[2/] !o create a pac,age what is the irst statement incl"dedL
Choice a import %a)a9aw:97
Choice b pac,age
Choice c p"blic
Choice d class
[20] What does the ollowing import statement act"ally mean import %a)a9awt97
Choice
a
import awt class rom the %a)a pac,age
Choice
b
Import all )ariables rom awt class
Choice
c
Import all the classes rom the awt pac,age contained in the %a)a
pac,age
Choice
d
Import all the classes rom the %a)a pac,age
[23]In $"ltithreaded programming4 what is to be done to ret"rn the threads to r"nnable state
rom sleep mode
Choice
a
calling method notiy
Choice
b
calling method res"me
Choice
c
calling method start
Choice
d
nothing b"t4 let the speciied time be elapsed
[2>] !he class K'ception is a s"bclass o which class
Choice a Ob%ect
Choice b !hrowable
-
7/26/2019 Java Paper1
8/8
Choice c !hread
Choice d !hrow
[2]In .a)a4 which K'ception type is ca"sed by general IO ail"res s"ch as "nable to read
rom a ile
Choice a In)alid+ccessK'ception
Choice b Inp"tO"tp"tK'ception
Choice c In)alidQileK'ception
Choice d IOK'ception
[*] Which e'ception may be thrown i the gi)en code is e'ec"ted gi)ing 2 integer r"ntime
arg"ments
class sample5
p"blic static )oid main(tring args[]
5
try
5
int a6Integer9parseIntargs[]7
int b6Integer9parseIntargs[1]7
int c 6 a : b7
(ystem9o"t9printlnH("m is H:c7
=
catch+rithmeticK'ception ae 5 (ystem9o"t9printlnH+rithmetic K'ception H:ae9get$essage7 =
catchN"mberQormatK'ception ne
5 (ystem9o"t9printlnHN"mber Qormat K'ception H:ne9get$essage7 =
catchK'ception e
5 (ystem9o"t9printlnHK'ception H:e7 =
=
=
Choi
ce a
+rithmeticK'ception
Choice b
N"mberQormatK'ception
Choi
ce c
K'ception
Choi
ce d
None o the abo)e