Quiz
SDP3 images)
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 (47)
1What will be the output of the program?

- AOak
- BPine
- CTree
- DForest
- EOops
2Select how you would run your program to cause it to print: Arg is 2

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

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

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

- 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;}
613. Which statement is true?
- AAny statement that can throw an Exception must be enclosed in a try block
- BThe Error class is a RuntimeException.
- CAny statement that can throw an Error must be enclosed in a try block
- Dcatch(X x) can catch subclasses of X where X is a subclass of Exception.
7What will be the output of the program?
- Aone two three four
- Bfour three two one
- Cfour one three two
- Done two three four one
8What will be the output of the program?

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

- Abaz =
- Bbaz = blue
- Cbaz = null
- DRuntime Exception
- ECompilation Error
10 What will be the output of the program?

- 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
11The following block of code creates a Thread using a Runnable target:

- 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(){}}
12What will be the output of the program?<

- AAB
- BBC
- CBCD
- DABC
- EACD
13Which of these will create and start this thread?

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

- Afalse true
- Btrue true
- Ctrue false
- Dfalse false
- ERuntime error will occur
15What will be an output?

- A24
- B30
- C120
- D720
- ECompilation Error
16What will be an output?

- A1
- B0
- C5
- D15
- ECompilation Error
- FRuntime Error
17What will be an output?

- A1
- B0
- C12
- D78
- ECompilation error
- FRuntime error
18Deletion is faster in LinkedList than ArrayList
- ATrue
- BFalse
19What will be the output of the program?

- AGot the exception 10
- BGot the exception e
- CCompilation error
- DRuntime error
20 What will be the output of the program?

- AGot the Test Exception
- BInside finally block
- CGot the Test Exception
Inside finally block - DCompilation error
21What will be the output of the program?

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

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

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

- ACompilation error
- BRuntime error
- CArrayIndexOutOfBoundsException
- DErrorCode is printed
- EArray is printed
25What will be the output of the program

- ABase::show() called
- BDerived::show() called
- CCompilation error
- DRuntime error
26What will be the output of the program

- ADerived::show() called
- BBase::show() called
- CCompilation error
- DRuntime error
27 What will be the output of the program?

- ACompilation error
- BDerived
- CBase
- DRuntime error
28What will be the output of the program

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

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

- A0
- BCompilation error
- CRuntime error
- D20
31 What will be the output of the program?

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

- ABD
- BABDE
- CBCDE
- DBCD
- EBDE
- FABCE
- GABCD
- HABD
33What will be the output of the following code?

- Ahello caught finally after
- Bhello throwit caught finally after
- Chello throwit finally
- Dcompilation fails
- Ehello caught after
- Fcaught finally after
34 What will be the output of the program

- Afinally
- BCompilation fails
- Cexception finished
- Dfinally finished
- Efinally exception finished
- Ffinally exception
35What will be the output of the program?
- AACD
- BABCD
- CABD
- DBCD
- EBC
- FBD
- GCD
36 What will be the output of the program

- 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
37102. What will be the output of the program?

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

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

- A0
- Berror
- CCompilation fails
- DAn uncaught exception is thrown at runtime
- ENo output
- F/ by 0
40Given
Note: The keyword "instanceof" is use to check whether an object is of a particular type
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
41What will be the output?

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

- 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
43What is the output of the following code segment?

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

- A9 and 366
- B9 and 336
- C8 and 42
- D8 and 336
45 What is the output of the following code fragment?

- AError
- B2 times Hello
- C3 times Hello
- DNo output will be produced
46What will be the output of the program?<

- A0 1 2
- B0 1 2 1 2 2
- C2 1 0 1 0 0
- D2 1 2 0 1 2
- E2 1 2 1 0 2
47Which of the following implementation will you use if you were to insert elements at any position in the collection ??
- AVector
- BList
- CLinkedList
- DArrayList
Information
- Description
- Quiz on SDP3 images), created by Arman Karimov on 18/01/2017.
- Author
- Arman Karimov
- Language
- English
- Views
- 7
- Tags
- Rating
- No ratings yet Rate this quiz