java june 2012 76 marks paper4
TRANSCRIPT
-
7/26/2019 Java June 2012 76 Marks Paper4
1/11
[30] Which exception may be thrown if the given code is executed giving 2 integer
runtime arguments
class sample{
public static void main(tring args[]!
{try
{
int a"#nteger$parse#nt(args[0]!% int b"#nteger$parse#nt(args[&]!%
int c " a ' b%
ystem$out$println(um is 'c!%
) catch(*rithmetic+xception ae!
{ ystem$out$println(*rithmetic +xception 'ae$get,essage(!!% )
catch(-umber.ormat+xception ne!
{ ystem$out$println(-umber .ormat +xception 'ne$get,essage(!!% ) catch(+xception e!
{ ystem$out$println(+xception 'e!% ))
)
/hoice a
*rithmetic+xception
/hoice b
-umber.ormat+xception
/hoice c
+xception
/hoice d
-one of the above
[2] #n1 ava +xception handling code what could be done in the finally bloc
/hoice a
#t is used to write initiali4ation code
/hoice b
#t can be used to perform house5eeping operations
/hoice c#t can be used to catch all exceptions
/hoice d
#t can be used to ignore all exceptions
[26] #n ava1 what is a condition that is caused by a run5time error in the program
/hoice a
-
7/26/2019 Java June 2012 76 Marks Paper4
2/11
validity
/hoice b
exception
/hoice c
error/hoice d
action
[27] #n ,ultithreaded programming1 the process of assigning time to thread is nown as
/hoice a
timing
/hoice b
processing
/hoice c
time5slicing
/hoice d
*ssigning
[28] Which of the following step is invalid for creating a pacage
/hoice a
9eclare the pacage in beginning of the file
/hoice b
9efine the classes to be put in the pacage : declare it public
/hoice c
/reate the listing as ;ava in the ubdirectory by pacage menu
/hoice d
+xecute this ;ava file
[2ectors1 hash tables1 random numbers1 date etc
/hoice c
/lasses for #nput?@utput support
/hoice d
/lasses for implementing graphical user interface
-
7/26/2019 Java June 2012 76 Marks Paper4
3/11
[2A] =he following statements create what type of inheritance if class B and class / are
Base classes
class * extends B extends /{
CC
CCC)
/hoice a
ingle #nheritance
/hoice b
,ultilevel #nheritance
/hoice c
,ultiple #nheritance
/hoice d
Dierarchical #nheritan
[23] What form of #nheritance is not supported by ava
/hoice a
ingle
/hoice b
,ultilevel
/hoice c
,ultiple
/hoice d
Dierarchical
[22] Which of the following is -@= a method of string class
/hoice a
value@f
/hoice b
append
/hoice c
/har*t
/hoice d
index@f
[2&] What statement would better explain what are wrapper classes
/hoice a
Wrapper classes convert primitive datatypes into ob;ect types
-
7/26/2019 Java June 2012 76 Marks Paper4
4/11
/hoice b
Wrapper classes convert ob;ects to primitive data types
/hoice c
Wrapper classes are used to store list of ob;ects that may vary in si4e
/hoice dWrapper classes are used to convert any class type into array type ob;ect
[20] When a method with same return type and a method with same name
and arguments is defined in uper class as well as subclass$ #f the
method in the subclass is invoed instead of the super class method1what is this concept nown as
/hoice
a
#nheritance
/hoiceb
,ethod @verriding
/hoice
c
,ethod @verloading
/hoice
d
.inal ,ethod
[&] Which of the following visibility modifiers allows widest visibility and is accesible
everywhere/hoice a
private
/hoice b
Erotected
/hoice c
Eublic
/hoice d
.riendly
[&6] What is valid for abstract classes and abstract methods
/hoice a
We cannot use abstract classes to instantiate ob;ects$
/hoice b
abstract methods of an abstract class must be defined in its subclass$
/hoice c
-
7/26/2019 Java June 2012 76 Marks Paper4
5/11
/onstructers cannot be declared abstract
/hoice d
*ll of the above
[&7] What will be the output of the following code segment
int r"20%while(rF0!
{
r"r5&0%
if(rF0!continue%
ystem$out$print(r is 'r!%
)
/hoice a
r is &0
/hoice br is 0
/hoice c
r is 20
/hoice d
r is 20 r is &0
[&8] Which of the following looping constructs body1 will execute at least once even if
the condition is false$
/hoice a
for/hoice b
do
/hoice c
while
/hoice d
none of the above$
[&
-
7/26/2019 Java June 2012 76 Marks Paper4
6/11
ystem$out$println(Hy is greater than 4I!%
)
else{
ystem$out$println(H4 is greater than yI!%
)ystem$out$println(Hx is greater than yI!%
)
else{
if(yF4!
{
ystem$out$println(Hy is greater than 4I!%)
)
)
)/hoice a
4 is greater than yx is greater than y
/hoice b
y is greater than 4
x is greater than y
/hoice c
x is greater than y
x is greater than 4
/hoice d
x is greater than y
4 is greater than y
[&A] What will be the output of the following code segment
int a1b%
a"2%b"
-
7/26/2019 Java June 2012 76 Marks Paper4
7/11
/hoice b
b is