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 methods belong to the String class? 1. length() 2. compareTo() 3. equals() 4. substring()
Length(), & compareTo() | Equals() |
All of these | None of these |
What is the length of the application box made by this program?
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet {
Graphic g;
g.drawString("A Simple Applet", 20, 20);
}
20 | Default value |
Compilation Error | Runtime Error |
What is the output of this program?
class string_class {
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.charAt(3));
}
}
I | L |
K | E |
Objects of a super class cannot always be assigned to a subclass reference. This can only happen if they are in
Interference | Abstract Class |
Inheritance | None of the above |
What is the name of the thread in output of this program?
class multithreaded_programing {
public static void main(String args[]) {
Thread t = Thread.currentThread();
System.out.println(t.getPriority());
}
}
0 | 1 |
4 | 5 |
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);
System.out.print(i);
}
}
catch(ArithmeticException e) {
System.out.print("0");
}
}
}
-1 | -101 |
-10 | 0 |
When we implement the Runnable interface, we must define the method
start() | run() |
main() | init() |
What is the output of this program?
class equality {
int x;
int y;
boolean isequal() {
return(x == y);
}
}
class Output {
public static void main(String args[])
{
equality obj = new equality();
obj.x = 5;
obj.y = 5;
System.out.println(obj.isequal); }
}
true | false |
0 | 1 |
What is the output of this program?
import java.util.*;
class Maps {
public static void main(String args[]) {
TreeMap obj = new TreeMap();
obj.put("A", new Integer(1));
obj.put("B", new Integer(2));
obj.put("C", new Integer(3));
System.out.println(obj.entrySet());
}
}
[A=1, B=2, C=3] | [1, 2, 3] |
[A, B, C] | {A=1, B=2, C=3} |
what will be the output int a=0x0055; System.out.println(a);
5 | 55 |
85 | none of these |
Finish Test
No comments :
Post a Comment