Java Mock 3

download Java Mock 3

of 9

Transcript of Java Mock 3

  • 7/26/2019 Java Mock 3

    1/9

    [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

    ]

    #n 1ava when a compiletime error occurs then which file is -45 created

    /hoice a source

    /hoice b $6ava

    /hoice c $class

    /hoice d $exe

    [27

    ]#n 1ava which +xception type is caused by an attempt to access a nonexistent file

    /hoice a .ile-ot.ound+xception

    /hoice b #4+xception

    /hoice c #nvalid.ile+xception

    /hoice d #4+xception

    [28 #n ,ultithreaded programming which method is used to return the threads to runnable

  • 7/26/2019 Java Mock 3

    2/9

    ] state from the wait state

    /hoice a notify(!

    /hoice b resume(!

    /hoice c start(!

    /hoice d runnable(!

    [29

    ]

    What is valid statement to import only the class color from the awt pac:age contained in

    the 6ava pac:age

    /hoice a awt$6ava$;%

    /hoice b awt$6ava$color%

    /hoice c 6ava$awt$color%

    /hoice d 6ava$awt$;%

    [27

    /hoice d &2

    [&2] What is the value of ans if the code of statements are executed

    int i " >2'>7

    /hoice d &2

    [&0] What is the value of ,ath$rint(&$!

    /hoi 2

  • 7/26/2019 Java Mock 3

    8/9

    ce a

    /hoi

    ce b

    &

    /hoi

    ce c

    3

    /hoi

    ce d

    &$

    [] Which of the following it -45 a valid character constant

    /hoice a JxI

    /hoice b J&I

    /hoice c GaH

    /hoice d J%I

    [] Which of the following it -45 a valid character constant

    /hoice a JxI

    /hoice b J&I

    /hoice c GaH

    /hoice d J%I

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

    6ava cmdline 1ava is wonderful

    class cmdline

    {

    public static void main(tring args[]!

    {

    for(int i"&%iFargs$length%i''!

    {

    ystem$out$print(args[i]!%

    if(iM"args$length!

    ystem$out$print(G G!%)

    ystem$out$println(!%

    )

    )

    /hoice a 1ava

    /hoice b 1ava is

    /hoice c is wonderful

    /hoice d cmdline 1ava is wonderful

  • 7/26/2019 Java Mock 3

    9/9

    [9] Which of the following type of Nrograms can be developed in

    1ava

    /hoice a tandalone applications

    /hoice b Web applets

    /hoice c ?oth 4ption&and 4ption 2

    /hoice d -either 4ption&and 4ption 2

    [] 1ava is Oobust What statement explain this feature

    /hoice a 1ava programs can be easily moved from one computer

    system to another

    /hoice b 1ava systems verify memory access and virus

    /hoice c 1ava can be used to create applications on the networ:s

    /hoice d #t provides many safeguards to ensure reliable code

    [3] Which of the following is -45 one of the web browsers

    /hoice a /old6ava

    /hoice b -etscape -avigator

    /hoice c #nternet +xplorer

    /hoice d Aot6ava

    [2] Pynamic binding is associated with

    /hoice a Nolymorphism

    /hoice b #nheritance

    /hoice c ?oth 4ption& and 4ption2

    /hoice d -either 4ption& and 4ption2

    Ans: 4.d