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
What is the output of this program?
class newthread extends Thread {
Thread t;
newthread() {
t1 = new Thread(this,"Thread_1");
t2 = new Thread(this,"Thread_2");
t1.start();
t2.start();
}
public void run() {
t2.setPriority(Thread.MAX_PRIORITY);
System.out.print(t1.equals(t2));
}
}
class multithreaded_programing {
public static void main(String args[]) {
new newthread();
}
}
true | false |
truefalse | falsefalse |
Which of these classes is not part of Java?s collection framework?
Maps | Array |
Stack | Queue |
Which of these statement is correct?
true and false are numeric values 1 and 0. | true and false are numeric values 0 and 1. |
true is any non zero value and false is 0. | true and false are non numeric values. |
When does a finally block get executed ?
When an exception is thrown in a try block | When the method in which finally block is present is about to return. |
When an unhandled exception is thrown in a try block. | After execution has left a try catch block, no matter exception occurs or not. |
What is the output of this program?
import java.util.*;
class vector {
public static void main(String args[]) {
Vector obj = new Vector(4,2);
obj.addElement(new Integer(3));
obj.addElement(new Integer(2));
obj.addElement(new Integer(5));
obj.removeAll(obj);
System.out.println(obj.isEmpty());
}
}
0 | 1 |
True | False |
Consider the following code
int number[] = new int[5];After execution of this statement, which of the following are true? (A) number[0] is undefined (B) number[5] is undefined (C) number[4] is null (D) number[2] is 0 (E) number.length() is 5
(B), (D) & (E) | (A) & (E) |
(C) & (E) | (E) |
What is the output of this program?
class main_class {
public static void main(String args[])
{
int x = 9;
if (x == 9) {
int x = 8;
System.out.println(x);
}
}
}
9 | 8 |
Compilation error | Runtime error |
Which of these interface declares core method that all collections will have?
set | EventListner |
Comparator | Collection |
What is the output of this program?
class newthread implements Runnable {
Thread t;
newthread() {
t1 = new Thread(this,"Thread_1");
t2 = new Thread(this,"Thread_2");
t1.start();
t2.start();
}
public void run() {
t2.setPriority(Thread.MAX_PRIORITY);
System.out.print(t1.equals(t2));
}
}
class multithreaded_programing {
public static void main(String args[]) {
new newthread();
}
}
true | false |
truefalse | falsefalse |
What is the output of this program?
class Output {
public static void main(String args[])
{
int x , y = 1;
x = 10;
if (x != 10 && x / 0 == 0)
System.out.println(y);
else
System.out.println(++y);
}
}
1 | 2 |
Runtime error owing to division by zero in if condition. | Unpredictable behavior of program. |
Finish Test
Comments
Post a Comment