Time remaining
:
:
Test Status
CORETEST4
Ques 1 :
Which operator is used to perform bitwise inversion in Java. Select the one correct answer.
(A) ~
(B) !
(C) &
(D) ^
Ques 2 :
Is this True or False. In Java a final class must be sub-classed before it can be used.
(A) True
(B) False
Ques 3 :
Using up to four characters, write the Java representation of integer literal 3 in hexadecimal.
(A) 0x03, 0X03, 0X3
(B) 0x04, 0X04, 0X4
(C) 0x05, 0X05, 0X5
(D) none of these
Ques 4 :
Which of the following are true. Select the one correct answers.
(A) && operator is used for short-circuited logical AND.
(B) ~ operator is the bit-wise XOR operator.
(C) operator is used to perform bitwise OR and also short-circuited logical OR.
(D) The unsigned right shift operator in Java is >>.
Ques 5 :
After the following code fragment, what is the value in fname?
String str;
int fname;
str = "Foolish boy.";
fname = str.indexOf("fool");
(A) 0
(B) 2
(C) -1
(D) 4
Ques 6 :
How many bytes are used to represent the primitive data type int in Java. Select the one correct answer.
(A) 2
(B) 4
(C) 8
(D) 1
Ques 7 :
Select the one correct answer. The smallest number that can be represented using short primitive type in Java is -
(A) -127
(B) -128
(C) 0
(D) -32768
Ques 8 :
Is this true or false. Map interface is derived from the Collection interface.
(A) True
(B) False
Ques 9 :
What is the result of compiling and running the following class. Select the one correct answer.
class Test
{
public void methodA(int i)
{
System.out.println(i);
}
public int methodA(int i)
{
System.out.println(i+1);
return i+1;
}
public static void main(String args[])
{
Test X = new Test();
X.methodA(5);
}
}
Select the one correct answer.
(A) The program compiles and runs printing 5.
(B) The program compiles and runs printing 6.
(C) The program gives runtime exception because it does not find the method Test.methodA(int)
(D) The program give compilation error because methodA is defined twice in class Test.
Ques 10 :
What gets printed when the following program is compiled and run. Select the one correct answer.
public class test {
public static void main(String args[]) {
byte x = 3;
x = (byte)~x;
System.out.println(x);
}
}
(A) 0
(B) 3
(C) -4
(D) none of these
Ques 11 :
Which of the following are true. Select the three correct answers.
a.
A static method may be invoked before even a single instance of the class is constructed.
b.
A static method cannot access non-static methods of the class.
c.
Abstract modifier can appear before a class or a method but not before a variable.
d.
final modifier can appear before a class or a variable but not before a method.
E.
Synchronized modifier may appear before a method or a variable but not before a class.
(A) a,b,c
(B) a,b
(C) b,c,d
(D) all of above
Ques 12 :
Name the access modifier which when used with a method, makes it available to all the classes in the same package and to all the subclasses of the class.
(A) public
(B) protected
(C) private
(D) default
Ques 13 :
What is the value of "number" after the following code fragment execution?
int number = 0;
int number2 = 12
while (number < number2)
{
number = number + 1;
}
(A) 5
(B) 12
(C) 13
(D) 21
Ques 14 :
What is the legal range of values for a variable declared as a byte. Select the one correct answer.
(A) 0 to 255
(B) 0 to 256
(C) -128 to 127
(D) -127 to 128
Ques 15 :
Given the following declarations, which of the assignments given in the options below would compile. Select the two correct answers.
int i = 5;
boolean t = true;
float f = 2.3F;
double d = 2.3;
a.
t = (boolean) i;
b.
f = d;
c.
d = i;
d.
i = 5;
e.
f = 2.8;
(A) a,b
(B) b,c
(C) c,d
(D) a,d
Ques 16 :
What gets displayed on the screen when the following program is compiled and run. Select the one correct answer.
public class test {
public static void main(String args[]) {
int x,y;
x = 3 & 5;
y = 3 | 5;
System.out.println(x + " " + y);
}
}
(A) 7 1
(B) 3 7
(C) 1 7
(D) 1 3
Ques 17 :
Name the access modifier which when used with a method, makes it available to all the classes in the same package and to all the subclasses of the class.
(A) public
(B) private
(C) protected
(D) default
Ques 18 :
Given the following code snippet;
int salaries[];
int index = 0;
salaries = new int salaries[4];
while (index < 4)
{
salaries[index] = 10000;
index++;
}
What is the value of salaries [3]?
(A) 40000
(B) 50000
(C) 15000
(D) 10000
Ques 19 :
The width in bits of double primitive type in Java is --. Select the one correct answer.
(A) The width of double is platform dependent
(B) 64
(C) 128
(D) 8
Ques 20 :
What gets printed when the following program is compiled and run. Select the one correct answer.
public class incr {
public static void main(String args[]) {
int i , j;
i = j = 3;
int n = 2 * ++i;
int m = 2 * j++;
System.out.println(i + " " + j + " " + n + " " + m);
}
}
(A) 4 4 8 6
(B) 4 4 8 8
(C) 4 4 6 6
(D) 4 3 8 6
Submit Answer
Don't Refresh the Page !! ...