Test : Java_21
This test contains 10 questions based on Java.
Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers.
Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers.
Select Test Type
You Get +1 for each correct answer and -0.25 for each incorrect answer
Time Left - minutes :seconds
Which keyword can be used to prevent a class from being subclassed
init | equals |
final | clone |
What is the output of this program?
import java.util.*; class Array { public static void main(String args[]) { int array[] = new int [5]; for (int i = 5; i > 0; i--) array[5-i] = i; Arrays.fill(array, 1, 4, 8); for (int i = 0; i < 5 ; i++) System.out.print(array[i]); } }
12885 | 12845 |
58881 | 54881 |
When does Exceptions in Java arises in code sequence?
Run Time | Compilation Time |
Can Occur Any Time | None of the mentioned |
What is the output of this program?
class newthread implements Runnable { Thread t; newthread() { t = new Thread(this,"New Thread"); t.start(); } public void run() { t.setPriority(Thread.MAX_PRIORITY); System.out.println(t); } } class multithreaded_programing { public static void main(String args[]) { new newthread(); } }
Thread[New Thread,0,main] | Thread[New Thread,1,main] |
Thread[New Thread,5,main] | Thread[New Thread,10,main] |
Which function is used to perform some action when the object is to be destroyed?
finalize() | delete() |
main() | None of the mentioned |
Which of these class is related to all the exceptions that cannot be caught?
Error | Exception |
RuntimeExecption | All of the mentioned |
Which of these methods sets every element of a List to a specified object?
set() | fill() |
Complete() | add() |
Which keyword is used by method to refer to the object that invoked it?
import | catch |
abstract | this |
Which of these lines will give an error
line 1. int a=1,b=2;
line 2. float c=2.0;
line 3. System.out.println((a==c)+""+(c==b));
line 1 | line 2 |
line 2 & line 3 | line 3 |
What is the output of this program?
class exception_handling { public static void main(String args[]) { try { System.out.print("Hello" + " " + 1 / 0); } catch(ArithmeticException e) { System.out.print("World"); } } }
Hello | World |
HelloWorld | Hello World |
Finish Test
No comments: