Test : Java_24
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 order of precedence (highest to lowest) of following operators?
1. &
2. ^
3. ?:
1 -> 2 -> 3 | 2 -> 1 -> 3 |
3 -> 2 -> 1 | 2 -> 3 -> 1 |
What is the process by which we can control what parts of a program can access the members of a class?
Recursion | Polymorphism |
Abstraction | Encapsulation |
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 |
Which of the following statements about abstract methods/classes in Java are true?
(A)An abstract class cannot be instantiated.
(B)Constructors cannot be abstract.
(C)All sub classes of an abstract class must override the abstract methods.
(D)Static methods may be declared abstract.
(A) & (B) | (B) & (C) |
(C) & (D) | (A) & (D) |
what will be the output of
int i=12;
System.out.println(++i);
11 | 12 |
13 | 14 |
What is the Message is displayed in the applet made by this program?
import java.awt.*; import java.applet.*; public class myapplet extends Applet { public void paint(Graphics g) { g.drawString("A Simple Applet", 20, 20); } }
A Simple Applet | A Simple Applet 20 20 |
Compilation Error | Runtime Error |
What is the output of this program?
class box { int width; int height; int length; int volume; void finalize() { volume = width*height*length; System.out.println(volume); } protected void volume() { volume = width*height*length; System.out.println(volume); } } class Output { public static void main(String args[]) { box obj = new box(); obj.volume(); } }
Runtime error | Compilation error |
150 | 200 |
Which of these class is used to make a thread?
String | System |
Thread | Runnable |
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
delete | new |
free | None of the mentioned |
What is the output of this program?
class exception_handling { public static void main(String args[]) { try { System.out.print("Hello" + " " + 1 / 0); } finally { System.out.print("World"); } } }
A | B |
Compilation Error | Runtime Error |
Finish Test
No comments: