JavaCore Test 9

Which of these statements are legal.
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];


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 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

Which of these are Java keywords.
a. TRUE
b. volatile
c. transient
d. native
e. interface
f. then
g. new


What gets printed when the following program is compiled and run?

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);

}

}

}

}

}

What is the name of collection interface used to maintain non-unique elements in order.

Which of the following statement is true about the assert statement.

Which of the following is correct?
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.


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?

Using up to four characters, write the Java representation of octal literal 6.

Using up to four characters what is the Java representation of the number 23 in hex?

What is the name of collection interface used to maintain unique elements.

Which of the following are valid constructors within a class Test.
a. test() { }
b. Test() { }
c. void Test() { }
d. private final Test() { }
e. abstract Test() { }
f. Test(Test t) { }
g. Test(void) { }


What gets printed on the standard output when the class below is compiled and executed.

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);
}
}

Is this True or False. In Java an abstract class cannot be sub-classed.

What is the result of evaluating the expression 14 ^ 23.

What are the two parts of a value of type double?

What is the minimum value of char type.

What gets printed when the following program is compiled and run?

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);
}
}

What is the name of collection interface used to maintain mappings of keys to values.

Schreibe einen Kommentar