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 of the following is incorrect statement about packages?
Interfaces specifies what class must do but not how it does. | Interfaces are specified public if they are to be accessed by any code in the program. |
All variables in interface are implicitly final and static. | All variables are static and methods are public if interface is defined pubic. |
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);
}
}
0 | 1 |
Runtime error owing to division by zero in if condition. | Unpredictable behavior of program. |
What is the output of this program?
class exception_handling {
public static void main(String args[]) {
try {
int i, sum;
sum = 10;
for (i = -1; i < 3 ;++i)
sum = (sum / i);
}
catch(ArithmeticException e) {
System.out.print("0");
}
System.out.print(sum);
}
}
0 | 05 |
50 | 55 |
Which of these class is related to all the exceptions that can be caught by using catch?
Error | Exception |
RuntimeExecption | All of the mentioned |
Which of these keywords are used to implement synchronization?
sunchronize | syn |
synch | synchronized |
Which of these is returned by greater than, <, and equal to, ==, operator?
Integers | Floating - point numbers |
Boolean | None of the mentioned |
What is the output of this program?
class output {
public static void main(String args[])
{
String s1 = "Hello i love java";
String s2 = new String(s1);
System.out.println((s1 == s2) + " " + s1.equals(s2));
}
}
true true | false false |
true false | false true |
What is the output of this program?
import java.util.*;
class hashtable {
public static void main(String args[]) {
Hashtable obj = new Hashtable();
obj.put("A", new Integer(3));
obj.put("B", new Integer(2));
obj.put("C", new Integer(8));
obj.remove(new String("A"));
System.out.print(obj);
}
}
{C=8, B=2} | [C=8, B=2] |
{A=3, C=8, B=2} | [A=3, C=8, B=2] |
What is synchronization in reference to a thread?
Its a process of handling situations when two or more threads need access to a shared resource. | Its a process by which many thread are able to access same shared resource simultaneously. |
Its a process by which a method is able to access many different threads simultaneously. | Its a method that allow to many threads to access any information the require. |
What is the output of this program?
class exception_handling {
public static void main(String args[]) {
try {
int a[] = {1, 2,3 , 4, 5};
for (int i = 0; i < 5; ++i)
System.out.print(a[i]);
int x = 1/0;
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.print("A");
}
catch(ArithmeticException e) {
System.out.print("B");
}
}
}
12345 | 12345A |
12345B | Compilation Error |
Finish Test
No comments :
Post a Comment