[Free] Download New Updated (October 2016) Oracle 1Z0-808 Real Exam 131-140

Ensurepass

QUESTION 131

Given:

 

interface Pet { }

 

class Dog implements Pet { }

 

public class Beagle extends Dog{ }

 

Which three are valid?

 

A.

Pet a = new Dog();

B.

Pet b = new Pet();

C.

Dog f = new Pet();

D.

Dog d = new Beagle();

E.

Pet e = new Beagle();

F.

Beagle c = new Dog();

 

Correct Answer: ADE

Explanation:

Incorrect:

Not B, not C: Pet is abstact, cannot be instantiated. Not F: incompatible type. Required Beagle, found Dog.

 

 

QUESTION 132

Consider following method

 

clip_image002

 

Which statement is true?

 

A.

This method is invalid.

B.

This method can be used only in an interface.

C.

This method can return anything.

D.

This method can be used only in an interface or an abstract class.

E.

None of above.

 

Correct Answer: B

Explanation:

Given method is declared as default method so we can use it only inside an interface. Hence option B is correct and option D is incorrect. Option A is incorrect as it is valid method. Option C is incorrect as return type is void, which means we can’t return anything.

 

 

 

 

 

 

 

 

QUESTION 133

Given:

 

public class SuperTest {

 

public static void main(String[] args) {

 

statement1

 

statement2

 

statement3

 

}

 

}

 

class Shape {

 

public Shape() {

 

System.out.println(“Shape: constructor”);

 

}

 

public void foo() {

 

System.out.println(“Shape: foo”);

 

}

 

}

 

class Square extends Shape {

 

public Square() {

 

super();

 

}

 

public Square(String label) {

 

System.out.println(“Square: constructor”);

 

}

 

public void foo() {

 

super.foo();

 

}

 

public void foo(String label) {

 

System.out.println(“Square: foo”);

}

 

}

 

}

 

}

 

What should statement1, statement2, and statement3, be respectively, in order to produce the result?

 

Shape: constructor

 

Square: foo

 

Shape: foo

 

A.

Square square = new Square (“bar”);

square.foo (“bar”);

square.foo();

B.

Square square = new Square (“bar”);

square.foo (“bar”);

square.foo (“bar”);

C.

Square square = new Square ();

square.foo ();

square.foo(bar);

D.

Square square = new Square ();

square.foo ();

square.foo(“bar”);

E.

Square square = new Square ();

square.foo ();

square.foo ();

F.

Square square = new Square();

square.foo(“bar”);

square.foo();

 

Correct Answer: F

 

 

QUESTION 134

Given the code fragment:

 

clip_image004

 

What is the result if the integer aVar is 9?

 

A.

Hello World!

B.

Hello Universe!

C.

Hello World!

D.

Compilation fails.

 

Correct Answer: A

 

 

QUESTION 135

Which two statements are true for a two-dimensional array?

 

A.

It is implemented as an array of the specified element type.

B.

Using a row by column convention, each row of a two-dimensional array must be of the same size.

C.

At declaration time, the number of elements of the array in each dimension must be specified.

D.

All methods of the class Object may be invoked on the two-dimensional array.

 

Correct Answer: AD

 

 

QUESTION 136

Given:

 

clip_image006

 

What
is the result?

 

A.

true true

B.

true false

C.

false true

D.

false false

E.

Compilation fails

 

Correct Answer: E

 

 

 

 

 

 

 

 

 

QUESTION 137

Given:

 

clip_image007

 

Which code fragment, when inserted at line 9, enables the code to print true?

 

A.

String str2 = str1;

B.

String str2 = new string (str1);

C.

String str2 = sb1.toString();

D.

String str2 = “Duke”;

 

Correct Answer: B

 

 

QUESTION 138

Given the code fragment:

 

clip_image009

 

Which code fragment prints blue, cyan, ?

 

clip_image010

 

A.

Option A

B.

Option B

C.

Option C

D.

Option D

 

Correct Answer: A

 

 

QUESTION 139

Given:

 

clip_image012

 

What is the result?

 

A.

Area is 6.0

B.

Area is 3.0

C.

Compilation fails at line n1

D.

Compilation fails at line n2.

 

Correct Answer: D

 

 

QUESTION 140

Given:

 

public class ColorTest {

 

public static void main(String[] args) {

 

String[] colors = {“red”, “blue”,”green”,”yellow”,”maroon”,”cyan”};

 

int count = 0;

 

for (String c : colors) {

 

if (count >= 4) {

 

break;

}

 

else {

 

continue;

 

}

 

if (c.length() >= 4) {

 

colors[count] = c.substring(0,3);

 

}

 

count++;

 

}

 

System.out.println(colors[count]);

 

}

 

}

 

What is the result?

 

A.

Yellow

B.

Maroon

C.

Compilation fails

D.

A StringIndexOutOfBoundsException is thrown at runtime.

 

Correct Answer: C

Explanation:

The line, if (c.length() >= 4) {, is never reached. This causes a compilation error.

Note: The continue statement skips the current iteration of a for, while , or do-while loop. An unlabeled break statement terminates the innermost switch, for, while, or do- while statement, but a labeled break terminates an outer statement.

 

Free VCE & PDF File for Oracle 1Z0-808 Real Exam

Instant Access to Free VCE Files: CompTIA | VMware | SAP …
Instant Access to Free PDF Files: CompTIA | VMware | SAP …

This entry was posted in 1Z0-808 Actual Test (October 2016) and tagged , , , , , , , . Bookmark the permalink.