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 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 |
Compilation Error | Runtime Error |
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 |
Which of these method of class String is used to compare two String objects for their equality?
equals() | Equals() |
isequal() | Isequal() |
Which of these handles the exception when no catch is used?
Default handler | throw handler |
finally | Java run time system |
Which of the following is a method having same name as that of its class?
finalize | delete |
constructor | class |
What is Collection in Java?
A group of objects | A group of classes |
A group of interfaces | None of the mentioned |
Which of these statements are incorrect?
Equal to operator has least precedence. | Brackets () have highest precedence. |
Division operator, /, has higher precedence than multiplication operator. | Addition operator, +, and subtraction operator have equal precedence |
Which of these method of String class is used to obtain character at specified index?
char() | Charat() |
charat() | charAt() |
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 ternary_operator {
public static void main(String args[])
{
int x = 3;
int y = ~ x;
int z;
z = x > y ? x : y;
System.out.print(z);
}
}
0 | 1 |
3 | -4 |
Finish Test
Comments
Post a Comment