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 statements are incorrect?
public members of class can be accessed by any code in the program. | private members of class can only be accessed by other members of the class. |
protected members of a class can be inherited by a sub class, and become private members of the sub class. | private members of class can be inherited by a sub class, and become protected members in sub class. |
What is the output of this program?
interface calculate {
void cal(int item);
}
class display implements calculate {
int x;
void cal(int item) {
x = item * item;
}
}
class interfaces {
public static void main(String args[]) {
display arr = new display;
arr.x = 0;
arr.cal(2);
System.out.print(arr.x);
}
}
0 | 2 |
4 | 6 |
What is the output of this program?
class A {
public int i;
public int j;
A() {
i = 1;
j = 2;
}
}
class B extends A {
int a;
B() {
super(ob);
}
}
class super_use {
public static void main(String args[])
{
B obj = new B();
System.out.println(obj.i + " " + obj.j)
}
}
1 2 | 2 1 |
Runtime Error | Compilation Error |
Which of the following package stores all the standard java classes?
lang | java |
util | java.packages |
Which function of pre defined class Thread is used to check weather current thread being checked is still running?
Join() | isAlive() |
isRunning() | Alive() |
class Base { int x = 10; }The output is:
class Derived extends Base
{ int x = 20; }
Base b = new Base();
Derived d = new Derived ( );
Base bd = new Derived();
The statement
System.out.println(b.x + " " + d.x + " " + bd.x);
10 20 10 | 10 20 20 |
20 10 20 | 20 20 10 |
What is the output of this program?
interface calculate {
void cal(int item);
}
class displayA implements calculate {
int x;
void cal(int item) {
x = item * item;
}
}
class displayB implements calculate {
int x;
void cal(int item) {
x = item / item;
}
}
class interfaces {
public static void main(String args[]) {
displayA arr1 = new displayA;
displayB arr2 = new displayB;
arr1.x = 0;
arr2.x = 0;
arr1.cal(2);
arr2.cal(2);
System.out.print(arr1.x + " " + arr2.x);
}
}
0 0 | 2 2 |
4 1 | 1 4 |
What is the output of this program?
abstract class A {
int i;
abstarct void display();
}
class B extends A {
int j;
void display() {
System.out.println(j);
}
}
class Abstract_demo {
public static void main(String args[])
{
B obj = new B();
obj.j=1;
obj.display();
}
}
0 | 1 |
2 | 3 |
Which function is used to perform some action when the object is to be destroyed?
delete() | finalize() |
main() | None of the mentioned |
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.length());
}
}
9 | 10 |
11 | 12 |
Finish Test
Comments
Post a Comment