Quiz
SDP-3
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (43)
1What will be the output of the program?<br>

- APine
- BOak
- CTree
- DForest
- EOops
2Select how you would run your program to cause it to print: Arg is 2 <br>

- Ajava Myfile 2 2 2
- Bjava Myfile 1 2 2 3 4
- Cjava Myfile 1 3 2 2
- Djava Myfile 1 2 2 2
- Ejava Myfile 0 1 2 3
3What is the prototype of the default constructor?<br>

- ATest()
- BTest
- Cpublic Test()
- Dpublic Test(void)
- ETest(void)
4What is the widest valid returnType for methodA in line 3?<br>

- Aint
- Blong
- Cbyte
- Ddouble
- Evoid
5Which is valid in a class that extends class A?<br>

- Apublic int method1(int a, int b) {return 0; }
- Bprivate int method1(int a, int b) {return 0; }
- Cprotected static int method1(int a, int b) {return 0; }
- Dpublic long method1(int a, int b) {return 0; }
- Epublic static int method1(int a, int b) {return 0; }
6What will be the output of the program?<br>

- Aone two three four
- Bone two three four one
- Cfour three two one
- Dfour one three two
7What will be the output of the program?<br>

- AAC
- BACD
- CBD
- DABCD
- EABD
8What will be the output of the program after the running program in such way :/> java Test red green blue?<br>

- Abaz =
- Bbaz = blue
- Cbaz = null
- DRuntime Exception
- ECompilation Error
9What will be the output of the program? <br>

- AIt will print the numbers from 0 to 19 sequentially
- BIt will print the numbers from 1 to 20 sequentially
- CIt will print the numbers from 0 to 19 but the order is not determined
- DIt will print the numbers from 1 to 20 but the order is not determined
- EIt will print the numbers from 0 to 9 two times, but the order is not determined
10The following block of code creates a Thread using a Runnable target: <br>
Which of the following classes can be used to create the target, so that the preceding code compiles correctly?
- Apublic class MyRunnable extends Runnable{public void run(){}}
- Bpublic class MyRunnable extends Object{public void run(){}}
- Cpublic class MyRunnable implements Runnable{public void run(){}}
- Dpublic class MyRunnable implements Runnable{void run(){}}
- Epublic class MyRunnable implements Thread{void run(){}}
11What will be the output of the program?<br>

- AAB
- BBC
- CBCD
- DABC
- EACD
12Which of these will create and start this thread? <br>

- Anew Runnable(MyRunnable).start();
- Bnew Thread(MyRunnable).run();
- Cnew Thread(new MyRunnable()).start();
- Dnew MyRunnable().start();
- Enew Runnable(MyRunnable).run();
13What will be an output? <br>

- Atrue true
- Btrue false
- Cfalse true
- Dfalse false
- ERuntime error will occur
14What will be an output? <br>

- A24
- B30
- C120
- D720
- ECompilation Error
15What will be an output? <br>

- A1
- B0
- C5
- D15
- ECompilation Error
- FRuntime Error
16What will be an output? <br>

- A1
- B0
- C12
- D78
- ECompilation error
- FRuntime error
17What will be the output of the program? <br>

- AGot the exception 10
- BGot the exception e
- CCompilation error
- DRuntime error
18What will be the output of the program? <br>

- AGot the Test Exception
- BInside finally block
- CGot the Test Exception <br>
Inside finally block - DCompilation error
19What will be the output of the program? <br>

- ACompilation error
- BCompiles and runs fine
- CCompiles fine but throws ArithmeticException at runtime
20What will be the output of the program? <br>

- ACaught base class exception
- BCaught derived class exception
- CCaught base class exception <br> Caught derived class exception
- DCompilation error because derived is not throwable
- ECompilation error because base class exception is caught before derived class
21What will be the output of the program? <br>

- ACompilation error
- BDivide by zero error
- Cinside the finally block
- Da = 0
- Ea=0 <br> Divide by zero block <br> inside the finally block
22What will be the output of the program?<br>

- ACompilation error
- BRuntime error
- CArrayIndexOutOfBoundsException
- DErrorCode is printed
- EArray is printed
23What will be the output of the program? <br>

- ADerived::show() called
- BBase::show() called
- CCompilation error
- DRuntime error
24What will be the output of the program? <br>

- ADerived::show() called
- BBase::show() called
- CCompilation error
- DRuntime error
25What will be the output of the program? <br>

- ABase
- BDerived
- CCompilation error
- DRuntime error
26What will be the output of the program? <br>

- ACompilation error in super.super.Print()
- BGrandparent’s print <br> Child’s Print()
- CGrandparent’s print <br> Parent’s Print <br> Child’s Print()
- DRuntime error
27What will be the output of the program? <br>

- AComplex number is (10.0 + 15.0i)
- BCompilation error
- CRuntime error
- DComplex number is Complex@8e2fb5 (where 8e2fb5 is hash code of c)
28What will be the output of the program? <br>

- A20
- B0
- CCompilation error
- DRuntime error
29What will be the output of the program? <br>

- As1 == s2 is: true
- Bs1 == s2 is: false
- Ctrue
- Dfalse
- Ecompilation error
- Fruntime exception
30What will be the output of the following program? <br>

- ABD
- BABDE
- CBCDE
- DBCD
- EBDE
- FABCE
- GABCD
- HABD
31What will be the output of the following code? <br>

- Ahello caught finally after
- Bhello throwit finally
- Chello throwit caught finally after
- Dcompilation fails
- Ehello caught after
- Fcaught finally after
32What will be the output of the program? <br>

- Afinally
- BCompilation fails
- Cexception finished
- Dfinally finished
- Efinally exception finished
- Ffinally exception
33What will be the output of the program? <br>

- AABCD
- BACD
- CABD
- DBCD
- EBC
- FBD
- GCD
34What will be the output of the program? <br>

- AHello world
- BHello world Finally executing
- CFinally executing
- DNothing. The program will not compile because no exceptions are specified
- ENothing. The program will not compile because no catch clauses are specified
35What will be the output of the program? <br>

- AEx0 caught
- BException caught
- CCompilation fails on line 2
- DCompilation fails on line 9
- ECompilation fails on line 11
36What line of code should replace the missing statement to make this program compile? <br>

- Aimport java.io.*;
- Bimport java.io.PrintWriter
- Cinclude java.io.*;
- Dno statement required
37What will be the output of the program?<br>

- A0
- Berror
- CCompilation fails
- DAn uncaught exception is thrown at runtime
- ENo output
- F/ by 0
38Given <br> <b> Note: The keyword "instanceof" is use to check whether an object is of a particular type</b><br>What is the result?

- AWill produce output as false
- BCompilation fails due to error at line 3
- CCompilation fails due to error at line 4
- DLength of this array is 3
- EWill produce output a true
39What will be the output? <br>

- AGot the Test Exception<br> Inside finally block
- BInside finally block
- CGot the Test Exception
- DCompilation fails
40What will be the output? <br>

- ACaught base class exception
- BCaught derived class exception
- CCompiler error because derived is not throwable
- DCompiler error because base class exception is caught before derived class
41What is the output of the following code segment? <br>

- AA
- BB
- CC
- DD or lower
42What are the values of I and product after this code is executed? <br>

- A9 and 366
- B9 and 336
- C8 and 42
- D8 and 336
43What is the output of the following code fragment? <br>

- AError
- B2 times Hello
- C3 times Hello
- DNo output will be produced
Information
- Description
- Quiz on SDP-3, created by Aibat Karashev on 17/01/2017.
- Author
- Aibat Karashev
- Language
- English
- Views
- 433
- Rating
- No ratings yet Rate this quiz