Java Language Fundamental

Answer all questions carefully. After submission, you will see a detailed result and answer review.

Question 1
Which is a valid keyword in java?
Question 2
When is the object created with new keyword?
Question 3
Which will legally declare, construct, and initialize an array?
Question 4
Which is the valid declarations within an interface definition?
Question 5
Can one block of except statements handle multiple exceptions?
Question 6
In the given program, how many lines of output will be produced? <pre class="prettyprint"><xmp> public class Test { public static void main(String [] args) { int [] [] [] x = new int [3] [] []; int i, j; x[0] = new int[4][]; x[1] = new int[2][]; x[2] = new int[5][]; for (i = 0; i < x.length; i++) { for (j = 0; j < x[i].length; j++) { x[i][j] = new int [i + j + 1]; System.out.println("size = " + x[i][j].length); } } } } </xmp></pre>
Question 7
What will be the output of the program? <pre class="prettyprint"> <xmp> public class X { public static void main(String [] args) { String names [] = new String[5]; for (int x=0; x < args.length; x++) names[x] = args[x]; System.out.println(names[2]); } } </xmp></pre> <p>and the command line invocation is</p> <p>
Question 8
Which one of the following will declare an array and initialize it with five numbers?
Question 9
Which one is a valid declaration of a boolean?
Question 10
Which four options describe the correct default values for array elements of the types indicated? <ol class="java-ol-1234"> <li>int -> 0</li> <li>String -> "null"</li> <li>Dog -> null</li> <li>char -> '\u0000'</li> <li>float -> 0.0f</li> <li>boolean -> true</li> </ol>