Test : Java_6
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
Given the class definitions
System.out.print(b.display() + " "); System.out.print(d.display() + " "); System.out.print(bd.display() + " "); System.out.println();will display:
| Base Derived Derived | Base Base Derived |
| Base Derived Base | Derived Derived Derived |
Which of the following keywords are used to control access to a class member?
(A) default
(B) abstract
(C) protected
(D) interface
(E) public
| (C) & (E) | (A), (C) & (E) |
| (B), (C) & (E) | All of these |
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
| delete | free |
| new | None of the mentioned |
What is the output of this program?
class string_demo {
public static void main(String args[])
{
String obj = "I" + "like" + "Java";
System.out.println(obj);
}
}| l | like |
| likajava | llikejava |
Which of these keyword must be used to inherit a class?
| super | this |
| extent | extends |
An interface can only contain abstract methods. True or False?
| True | False |
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 defines a legal abstract class?
(A)class Vehicle {
abstract void display(); }
(B)abstract class Vehicle {
abstract void display(); }
(C)abstract Vehicle {
abstract void display(); }
(D)class abstract Vehicle {
abstract void display(); }
System.out.println("Car"); }}
|
|
|
|
What is the output of this program?
class newthread implements Runnable {
Thread t;
newthread() {
t = new Thread(this,"My Thread");
t.start();
}
public void run() {
System.out.println(t.getName());
}
}
class multithreaded_programing {
public static void main(String args[]) {
new newthread();
}
}| My Thread | Thread[My Thread,5,main] |
| Compilation Error | Runtime Error |
Which of these methods can convert an object into a List?
| SetList() | ConvertList() |
| singletonList() | CopyList() |
Finish Test
No comments: