Q1. Given:
What is the result?
A. 1 1 1
B. 1 2 3
C. 2 3 4
D. Compilation fails
E. The loop executes infinite times
Answer: D
Q2. Given:
What is the result?
A. The sum is 2
B. The sum is 14
C. The sum is 15
D. The loop executes infinite times
E. Compilation fails
Answer: D
Q3. Given:
What is the result?
A. true true
B. true false
C. false true
D. false false
E. Compilation fails
Answer: E
Q4. Given the code fragment:
A. Found Red
Found Default
B. Found Teal
C. Found Red
Found Blue
Found Teal
D. Found Red
Found Blue
Found Teal
Found Default
E. Found Default
Answer: B
Q5. Given the code fragment:
int [][] array2d = new int[2][3];
System.out.println("Loading the data.");
for ( int x = 0; x < array2d.length; x++) {
for ( int y = 0; y < array2d[0].length; y++) {
System.out.println(" x = " + x);
System.out.println(" y = " + y);
// insert load statement here.
}
}
System.out.println("Modify the data. ");
for ( int x = 0; x < array2d.length; x++) {
for ( int y = 0; y < array2d[0].length; y++) {
System.out.println(" x = " + x);
System.out.println(" y = " + y);
// insert modify statement here.
}
}
Which pair of load and modify statement should be inserted in the code? The load
statement should set the array's x row and y column value to the sum of x and y
The modify statement should modify the array's x row and y column value by multiplying it by 2
A. Load statement: array2d(x,y) = x + y;
Modify statement: array2d(x,y) = array2d(x,y) * 2
B. Load statement: array2d[x y] = x + y;
Modify statement: array2d[x y] = array2d[x y] * 2
C. Load statement: array2d[x,y] = x + y;
Modify statement: array2d[x,y] = array2d[x,y] * 2
Oracle 1z0-803 : Practice Test
D. Load statement: array2d[x][y] = x + y;
Modify statement: array2d[x][y] = array2d[x][y] * 2
E. Load statement: array2d[[x][y]] = x + y;
Modify statement: array2d[[x][y]] = array2d[[x][y]] * 2
Answer: D
Q6. Given a code fragment:
A. They match They real match
B. They really match
C. They match
D. Nothing is printed to the screen
Answer: B
Q7. Which two are valid instantiations and initializations of a multi dimensional array?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Answer: BD
Q8. Give:
What value should replace kk in line x to cause jj = 5 to be output?
A. -1
B. 1
C. 5
D. 8
E. 11
Answer: E
Q9. Given:
public class ScopeTest {
int j, int k;
public static void main(String[] args) {
ew ScopeTest().doStuff(); }
void doStuff() {
nt x = 5;
oStuff2();
System.out.println("x");
}
void doStuff2() {
nt y = 7;
ystem.out.println("y");
or (int z = 0; z < 5; z++) {
ystem.out.println("z");
ystem.out.println("y");
}
which two items are fields?
A. j
B. k
C. x
D. y
E. z
Answer: AB
Q10. What is the result if the integer aVar is 9?
A. 10 Hello world!
B. 10 Hello universe!
C. 9 Hello world!
D. Compilation fails.
Answer: C
Q11. Given:
What is the result?
A. 2 1
B. 2 1 0
C. null
D. an infinite loop
E. compilation fails
Answer: E
Q12. You are writing a method that is declared not to return a value. Which two are permitted in
the method body?
A. omission of the return statement
B. return null;
C. return void;
D. return;
Answer: AD
Q13. 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
Q14. Which two are Java Exception classes?
A. SercurityException
B. DuplicatePathException
C. IllegalArgumentException
D. TooManyArgumentsException
Answer: AC
Q15. Given:
What is the result?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C
Q16. Which declaration initializes a boolean variable?
A. boolean h = 1;
B. boolean k = 0;
C. boolean m = null;
D. boolean j = (1 < 5);
Answer: D