# [Free] 2018(Jan) Dumps4cert Testking Oracle 1z0-803 Dumps with VCE and PDF Download 111-120

Dumps4cert.com : Latest Dumps with PDF and VCE Files 2018 Jan Oracle Official New Released 1z0-803
100% Free Download! 100% Pass Guaranteed!
http://www.Dumps4cert.com/1z0-803.html

Java SE 7 Programmer I

#### Question No: 111

Given: What is the result?

1. The sum is 2

2. The sum is 14

3. The sum is 15

4. The loop executes infinite times

5. Compilation fails

Answer: E

#### Question No: 112

Given the code fragment: What is the result?

1. Valid

2. Not valid

3. Compilation fails

4. An IllegalArgumentException is thrown at run time

Answer: C Explanation:

In segment #39;if (valid)#39; valid must be of type boolean, but it is a string. This makes the compilation fail.

#### Question No: 113

Given the code fragment: What values ofx,y,zwill produce the following result? 1 2 3 4

1 2 3 4

1 2 3 4

1 2 3 4

A. X = 4, Y = 3, Z= 2 B. X = 3, Y = 2, Z = 3 C. X = 2, Y = 3, Z = 3 D. X = 4, Y = 2, Z = 3 E. X = 2, Y = 3, Z = 4

Answer: E Explanation:

Z is for the innermost loop. Should print 1 2 3 4. So Z must be 4.

Y is for the middle loop. Should print three lines of 1 2 3 4. So Ymust be set 3. X is for the outmost loop. Should print 2 lines of. So X should be 2.

#### Question No: 114

int [] array = {1,2,3,4,5}; for (int i: array) {

if ( i lt; 2) { keyword1;

}

System.out.println(i); if ( i == 3) { keyword2 ;

}}

What should keyword1 and keyword2 be respectively, in oreder to produce output 2345?

1. continue, break

2. break, break

3. break, continue

4. continue, continue

Answer: D

#### Question No: 115

Given the code fragment:

int [][] array2d = new int; System.out.println(quot;Loading the data.quot;); for ( int x = 0; x lt; array2d.length; x ) { for ( int y = 0; y lt; array2d.length; y ) { System.out.println(quot; x = quot; x); System.out.println(quot; y = quot; y);

// insert load statement here.

}

}

System.out.println(quot;Modify the data. quot;); for ( int x = 0; x lt; array2d.length; x ) { for ( int y = 0; y lt; array2d.length; y ) { System.out.println(quot; x = quot; x); System.out.println(quot; y = quot; 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#39;s x row and y column value to the sum of xand y

The modify statement should modify the array#39;s x row and y column value by multiplying it by 2

1. Load statement: array2d(x, y) = x y;

Modify statement: array2d(x, y) = array2d(x, y) * 2

2. Load statement: array2d[x y] = x y;

Modify statement:array2d[x y] = array2d[x y] * 2

3. Load statement: array2d[x, y] = x y;

Modify statement: array2d[x, y] = array2d[x, y] * 2

4. Load statement: array2d[x][y] = x y;

Modify statement: array2d[x][y] = array2d[x][y] * 2

5. Load statement: array2d[[x][y]]= x y;

Modify statement: array2d[[x][y]] = array2d[[x][y]] * 2

Answer: D

#### Question No: 116

Given:

abstract class A1 {

public abstract void m1();

public void m2() { System.out.println(quot;Greenquot;); }

}

abstract class A2 extends A1 { public abstract void m3();

public void m1() { System.out.println(quot;Cyanquot;); } public void m2() { System.out.println(quot;Bluequot;); }

}

public class A3 extends A2 {

public void m1() { System.out.println(quot;Yellowquot;); }

public void m2() { System.out.println(quot;Pinkquot;); } public void m3() { System.out.println(quot;Redquot;); } public static void main(String[] args) {

A2 tp = new A3(); tp.m1();

tp.m2();

tp.m3();

}

}

What is the result?

1. Yellow Pink

Red

2. Cyan Blue Red

3. Cyan Green Red

4. Compilation Fails

Answer: A

#### Question No: 117

Given:

public class TestLoop {

public static void main(String[] args) { int array[] = {0, 1, 2, 3, 4};

int key = 3;

for (int pos = 0; pos lt; array.length; pos) { if (array[pos] == key) {

break;

}

}

System.out.print(quot;Found quot; key quot;at quot; pos);

}

}

What is the result?

1. Found 3 at 2

2. Found 3 at 3

3. Compilation fails

4. An exception is thrown at runtime

Answer: C

Explanation: The following linedoes not compile: System.out.print(quot;Found quot; key quot;at quot; pos);

The variable pos is undefined at this line, as its scope is only valid in the for loop. Any variables created inside of a loop are LOCAL TO THE LOOP.

#### Question No: 118

Which two are valid declarations of a two-dimensional array?

1. int [] [] array2D;

2. int   array2D;

3. int array2D [];

4. int [] array2D [];

5. int [] [] array2D [];

Answer: A,D Explanation:

int[][] array2D; is the standard convention to declare a 2-dimensional integer array. int[] array2D[]; works as well, but it is not recommended.

#### Question No: 119

Given the code fragment: What is the result?

1. 2 2

2. 1 2

3. 3 2

4. 3 3

Answer: A Explanation: Variable b is set to 4.

Variableb is decreased to 3.

Variable b is decreased to 2 and then printed. Output: 2 Variable b is printed. Output: 2

#### Question No: 120

Given: Which line causes a compilation error?

1. line x1

2. linex2

3. line x3

4. line x4

Answer: B Explanation:

The variable x2 is used before it has been declared.