Time remaining
:
:
Test Status
CORETEST3
Ques 1 :
Which of these statements are legal. Select the three correct answers.
a.
int arr[][] = new int[5][5];
b.
int []arr[] = new int[5][5];
c.
int[][] arr = new int[5][5];
d.
int[] arr = new int[5][];
e.
int[] arr = new int[][5];
(A) a, b
(B) a, b, c
(C) a, b, c, d
(D) a, b, c, d, e
Ques 2 :
What is returned when the method substring(2, 4) is invoked on the string "example"? Include the answer in quotes as the result is of type String.
(A) "xa"
(B) "am"
(C) "xm"
(D) "xamp"
Ques 3 :
A class can have many methods with the same name as long as the number of parameters or type of parameters is different. This OOP concept is known as
(A) Method Invocating
(B) Method Overriding
(C) Method Labeling
(D) Method Overloading
Ques 4 :
Which of these are Java keywords. Select the five correct answers
a.
TRUE
b.
volatile
c.
transient
d.
native
e.
interface
f.
then
g.
new
(A) b, d, f, g
(B) a, b, d, g
(C) b, c, d, e, g
(D) d, e, f, g
Ques 5 :
What gets printed when the following program is compiled and run? Select the one correct answer.
class xyz {
public static void main(String args[]) {
int i,j,k;
for (i = 0; i < 3; i++) {
for(j=1; j < 4; j++) {
for(k=2; k<5; k++) {
if((i == j) && (j==k))
System.out.println(i);
}
}
}
}
}
(A) 0
(B) 1
(C) 2
(D) 3
Ques 6 :
What is the name of collection interface used to maintain non-unique elements in order.
(A) Set
(B) List
(C) Map
(D) SortedSet
Ques 7 :
Which of the following statement is true about the assert statement. Select the one correct answer.
(A) If a Java class contains assert statements, then it must be compiled with -1.4 option.
(B) When a program having assertions is run, -assertion option must be specified, otherwise the assertions get ignored.
(C) A possible syntax of assert statement is assert logical_expression If logical_expression evaluates to true, the program generates an AssertionError.
(D) The program terminates on its first AssertionError.
Ques 8 :
Which of the following is correct? Select the two correct answers.
a.
The native keyword indicates that the method is implemented in another
language like C/C++.
b.
The only statements that can appear before an import statement in a
Java file are comments.
c.
The method definitions inside interfaces are public and abstract. They
cannot be private or protected.
d.
A class constructor may have public or protected keyword before them,
nothing else.
(A) a, b
(B) a, c
(C) b, c
(D) c, d
Ques 9 :
Which of the following is considered as a blue print that defines the variables and methods common to all of its objects of a specific kind?
(A) Object
(B) Class
(C) Method
(D) Real data types
Ques 10 :
Using up to four characters, write the Java representation of octal literal 6.
(A) 06
(B) 006
(C) 0006
(D) all of above
Ques 11 :
Using up to four characters what is the Java representation of the number 23 in hex?
(A) 0x17
(B) 0x18
(C) 0x19
(D) 0x20
Ques 12 :
What is the name of collection interface used to maintain unique elements.
(A) List
(B) Set
(C) Map
(D) All of above
Ques 13 :
Which of the following are valid constructors within a class Test. Select the two correct answers.
a.
test() { }
b.
Test() { }
c.
void Test() { }
d.
private final Test() { }
e.
abstract Test() { }
f.
Test(Test t) { }
g.
Test(void) { }
(A) b, d
(B) c, f
(C) b, c
(D) b, f
Ques 14 :
What gets printed on the standard output when the class below is compiled and executed. Select the one correct answer.
public class ShortCkt {
public static void main(String args[]) {
int i = 0;
boolean t = true;
boolean f = false, b;
b = (t | ((i++) == 0));
b = (f | ((i+=2) > 0));
System.out.println(i);
}
}
(A) 0
(B) 1
(C) 2
(D) 3
Ques 15 :
Is this True or False. In Java an abstract class cannot be sub-classed.
(A) True
(B) False
Ques 16 :
What is the result of evaluating the expression 14 ^ 23. Select the one correct answer.
(A) 23
(B) 24
(C) 25
(D) 26
Ques 17 :
What are the two parts of a value of type double?
(A) Length, Denominator
(B) Significant Digits, Exponent
(C) Mode, Numerator
(D) Length, Numerator
Ques 18 :
What is the minimum value of char type. Select the one correct answer.
(A) 0
(B) -215
(C) -28
(D) -215 - 1
Ques 19 :
What gets printed when the following program is compiled and run? Select the one correct answer.
class test
{
static boolean check;
public static void main(String args[])
{
int i;
if(check == true)
i=1;
else
i=2;
if(i=2) i=i+2;
else i = i + 4;
System.out.println(i);
}
}
(A) 3
(B) 4
(C) 5
(D) The program does not compile because of the statement if(i=2)
Ques 20 :
What is the name of collection interface used to maintain mappings of keys to values.
(A) List
(B) Set
(C) SortedSet
(D) Map
Submit Answer
Don't Refresh the Page !! ...