An unchecked exception occurs in a method dosomething() Should other code be added in the dosomething() method for it to compile and execute? A. The Exception must be caught B. The Exception must be declared to be thrown. C. The Exception must be caug
|
Hits: 5402
|
Given the code fragment: Int [] [] array = {{0}, {0, 1}, {0, 2, 4}, {0, 3, 6, 9}, {0, 4, 8, 12, 16}}; Systemout.printIn(array [4] [1]); System.out.printIn (array) [1] [4]); What is the result? A. 4 Null B. Null 4 C. An IllegalArgumentException is thrown a
|
Hits: 3093
|
Given the code fragment: System.out.printIn("Result: " + 2 + 3 + 5); System.out.printIn("Result: " + 2 + 3 * 5); What is the result?
|
Hits: 4688
|
Given the code fragment: String h1 = "Bob"; String h2 = new String ("Bob"); What is the best way to test that the values of h1 and h2 are the same?
|
Hits: 2967
|
Which two are valid declarations of a two-dimensional array?
|
Hits: 3979
|
Given the code fragment: System.out.printIn ("Result: " +3+5); System.out.printIn ("Result: " + (3+5)); What is the result?
|
Hits: 2335
|
A method doSomething () that has no exception handling code is modified to trail a method that throws a checked exception. Which two modifications, made independently, will allow the program to compile?
|
Hits: 6661
|
Which two may precede the word ‘class’ in a class declaration? A. local B. public C. static D. volatile E. synchronized Answer: B,C Explanation: B: A class can be declared as public or private. C: You can declare two kinds of classes: top-level classes an
|
Hits: 8713
|
Which three are bad practices? A. Checking for ArrayIndexoutofBoundsException when iterating through an array to determine when all elements have been visited B. Checking for Error and. If necessary, restarting the program to ensure that users are unaware
|
Hits: 3271
|
Given: class X {} class Y { Y ( ) { } } class Z { Z (int i ) { } } Which class has a default constructor? A. X only B. Y only C. Z only D. X and Y E. Y and Z F. X and Z G. X, Y and Z Answer: A Explanation:
|
Hits: 5546
|