java_2011_92 paper8

Upload: kaushik-gowda

Post on 02-Mar-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/26/2019 java_2011_92 paper8

    1/11

    [30] Which exception may be thrown if the given code is executed giving 2integer runtime argumentsclass 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] #n 1ava the tas of handling the run4time errors and continueexecuting the remaining progam is nown as

    /hoice

    a

    hitting

    /hoiceb

    throwing

    /hoicec

    catching

    /hoice

    d

    exception handling

  • 7/26/2019 java_2011_92 paper8

    2/11

    [25] #n 1ava when a run4time error occurs which of the following mayhappen

    /hoicea

    compiles successfully

    /hoiceb

    produces wrong output

    /hoice

    c

    abnormal termination

    /hoiced

    *ll of the above

    [26] #n ,ultithreaded programming which method is used to tae the

    thread to premature dead state

    /hoicea

    pre(!

    /hoiceb

    dead(!

    /hoice

    c

    stop(!

    /hoiced

    pause(!

    [27] What classes does the 1ava system pacage 8ava$util contain

    /hoicea

    /lasses for primitive typestrings,ath functions 9hreads and+xceptions

    /hoiceb

    /lasses such as :ectors hash tables random numbers date etc

    /hoicec

    /lasses for #nput;

  • 7/26/2019 java_2011_92 paper8

    3/11

    /hoicea

    /lasses for primitive typestrings,ath functions 9hreads and+xceptions

    /hoiceb

    /lasses such as :ectors hash tables random numbers date etc

    /hoice

    c

    /lasses for #nput;] 9he following statements create what type of inheritance if class ? andclass / are ?ase classes

    class * extends ? extends /{@@@@@

    )

    /hoice aingle #nheritance

    /hoice b,ultilevel #nheritance

    /hoice c,ultiple #nheritance

    /hoice dAierarchical #nheritance

    [23] 1ava does not support ,ultiple #nheritance$ What is an alternative

    approach provided to implement this

    /hoice aBacages

    /hoice b#nterfaces

    /hoice c/ollections

    /hoice dWrapper classes

    [22] Which of the following is -

  • 7/26/2019 java_2011_92 paper8

    4/11

    /hoicea

    value

  • 7/26/2019 java_2011_92 paper8

    5/11

    /hoiceb

    9hey can be called by giving its name by another methodof the same class where created$

    /hoicec

    9hey can be called by giving its name by another methodof any class$

    /hoice

    d

    9hey can be called using classname followed by dot then

    the methodname

    [&5] What is -

  • 7/26/2019 java_2011_92 paper8

    6/11

    /hoice afor

    /hoice bdo

    /hoice cwhile

    /hoice d none of the above$

    [&=] /onsider the following program code$ state the output from itclass ifif{

    public static void main(tring args[]!{int x"3 y"&C"=%

    if(xHy!{if (CF"y!{ystem$out$println(Gy is greater than CI!%

    )else

    {ystem$out$println(GC is greater than yI!%

    )ystem$out$println(Gx is greater than yI!%

    )else{if(yHC!

    {ystem$out$println(Gy is greater than CI!%))

    ))

    /hoice a C is greater than yx is greater than y

    /hoice by is greater than Cx is greater than y

    /hoice cx is greater than yx is greater than C

    /hoice d

    x is greater than y

    C is greater than y

    [&>] What will be the output of the following code segmentint ab%

  • 7/26/2019 java_2011_92 paper8

    7/11

    a"2%b"=%if(aH2!

    if(bH2!{

    ystem$out$print(Gb is I'b!%)

    elseystem$out$print(Ga is I'a!%

    /hoice aa is 2

    /hoice bb is =

    /hoice ca is 2 followed by b is =

    /hoice d-o output

    [&3] Which of the following is -

  • 7/26/2019 java_2011_92 paper8

    8/11

    [&&] What is the value of the expression ,ath$pow(>3!

    /hoice a&2

    /hoice b6

    /hoice c&7

    /hoice d7>

    [&0] What is the value of the expression ,ath$round(&$=76!

    /hoicea

    &

    /hoiceb

    2

    /hoice

    c

    &$7

    /hoiced

    &$76

    [] Which of the following is -

  • 7/26/2019 java_2011_92 paper8

    9/11

    /hoicea

    /haracter

    /hoiceb

    /lasses

    /hoice

    c

    *rrays

    /hoiced

    #nterface

    [6] What will be the output of the following code if executed withcommand line arguments as follows

    8ava cmdline 1ava is wonderfulclass cmdline{public static void main(tring args[]!

    {for(int i"&%iFargs$length%i''!{ystem$out$print(args[i]!%

    if(iN"args$length!ystem$out$print(G G!%)ystem$out$println(!%

    ))

    /hoice a 1ava

    /hoice b1ava is

    /hoice cis wonderful

    /hoice dcmdline 1ava is wonderful

    [7] What should be the source filename of a 1ava file

    /hoice

    a

    *ny name

    /hoiceb

    name matching any class name present in source file

  • 7/26/2019 java_2011_92 paper8

    10/11

    /hoicec

    name matching the first class name in the source file

    /hoiced

    name of the class containing the main method

    [=] Which of the following is essential part of a 1ava Brogram

    /hoice aBacet statement

    /hoice b#mport statement

    /hoice c/lass definitions

    /hoice d,ain method class

    [>] What is Aot1ava

    /hoice

    a

    #t is first program written in 1ava and is web browser

    /hoice

    b

    #t is applet to run a browser

    /hoicec

    #t is networ application to run applets

    /hoiced

    #t is program that can edit applets

    [3] 1ava is +xtensible Oanguage What tatement best explains this feature

    /hoicea

    1ava application need not wait for the application to finishone tas before beginning another

    /hoiceb

    1ava is capable of dynamically lining in E class librariesmethods and ob8ects

    /hoicec

    1ava supports functions written in other languages such as/ and /''

    /hoice

    d

    1ava uses less amount of memory in environment

  • 7/26/2019 java_2011_92 paper8

    11/11

    [2] What are user define data types and behave lie built4in types of a

    programming language$

    /hoicea