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

Ensurepass

QUESTION 101

Given:

 

public class TestField {

 

int x;

 

int y;

 

public void doStuff(int x, int y) {

 

this.x = x;

 

y =this.y;

 

}

 

public void display() {

 

System.out.print(x + ” ” + y + ” : “);

 

}

 

public static void main(String[] args) {

 

TestField m1 = new TestField();

 

m1.x = 100;

 

m1.y = 200;

 

TestField m2 = new TestField();

 

m2.doStuff(m1.x, m1.y);

 

m1.display();

 

m2.display();

 

}

 

}

 

What is the result?

 

A.

100 200 : 100 200

B.

100 0 : 100 0 :

C.

100 200 : 100 0 :

D.

100 0 : 100 200 :

 

Correct Answer: C

 

 

QUESTION 102

Given:

 

public class App {

 

// Insert code here

 

System.out.print(“Welcome to the world of Java”);

 

}

 

}

 

Which two code fragments, when inserted independently at line // Insert code here, enable the program to execute and print the welcome message on the screen?

 

A.

static public void main (String [] args) {

B.

static void main (String [] args) {

C.

public static void Main (String [] args) {

D.

public static void main (String [] args) {

E.

public void main (String [] args) {

 

Correct Answer: AD

Explanation:

Incorrect:

Not B: No main class found.

Not C: Main method not found

not E: Main method is not static.

 

 

QUESTION 103

Given the code fragment:

 

public class Test {

 

public static void main(String[] args) {

 

boolean isChecked = false;

 

int arry[] = {1,3,5,7,8,9};

 

int index = arry.length;

 

while ( <code1> ) {

 

if (arry[index-1] % 2 ==0) {

 

isChecked = true;

 

}

 

<code2>

}

 

System.out.print(arry(index]+”, “+isChecked));

 

}

 

}

 

Which set of changes enable the code to print 1, true?

 

A.

Replacing <code1> with index > 0 and replacing <code2> with index–;

B.

Replacing <code1> with index > 0 and replacing <code2> with –index;

C.

Replacing <code1> with index > 5 and replacing <code2> with –index ;

D.

Replacing <code1> with index and replacing <code2> with –index ;

 

Correct Answer: A

Explanation:

Note: Code in B (code2 is –index;). also works fine.

 

 

QUESTION 104

Which of the following can fill in the blank in this code to make it compile?

 

clip_image002

 

A.

abstract

B.

final

C.

private

D.

default

E.

int

 

Correct Answer: C

Explanation:

From Java SE 8, we can use static and/or default methods in interfaces, but they should be non abstract methods. SO in this case using default in blank is completely legal. Hence option C is correct.

Option A is incorrect as given method is not abstract, so can’t use abstract there. Options B and E are incorrect as we can’t have non abstract method interface if they are not default or static.

httpsy/docs.oracle.com/javase/tutorial/iava/landl/defaultmethods.html

 

 

QUESTION 105

Given the code fragment:

 

clip_image004

 

What is the result?

 

A.

100

B.

101

C.

102

D.

103

E.

Compilation fails

 

Correct Answer: E

 

 

QUESTION 106

Given:

 

clip_image006

 

Which constructor initializes the variable x3?

 

A.

Only the default constructor of class X

B.

Only the no-argument constructor of class Y

C.

Only the no-argument constructor of class Z

D.

Only the default constructor of object class

 

Correct Answer: C

 

 

QUESTION 107

Given:

 

clip_image008

 

What is the result?

 

A.

Good Day!

Good Luck!

B.

Good Day!

Good Day!

C.

Good Luck!

Good Day!

D.

Good Luck!

Good Luck!

E.

Compilation fails

 

Correct Answer: E

 

 

QUESTION 108

Given the code fragment?

 

public class Test {

 

public static void main(String[] args) {

 

Test t = new Test();

 

int[] arr = new int[10];

 

arr = t.subArray(arr,0,2);

 

}

 

// insert code here

 

}

 

Which method can be inserted at line // insert code here to enable the code to compile?

 

A.

public int[] subArray(int[] src, int start, int end) { return src;

}

B.

public int subArray(int src, int start, int end) { return src;

}

C.

public int[] subArray(int src, int start, int end) { return src;

}

D.

public int subArray(int[] src, int start, int end) { return src;

}

 

Correct Answer: A

 

 

QUESTION 109

Given:

 

clip_image010

 

How many MarkList instances are created in memory at runtime?

 

A.

1

B.

2

C.

3

D.

4

 

Correct Answer: A

 

 

QUESTION 110

Which usage represents a valid way of compiling java source file with the name “Main”?

 

A.

javac Main.java

B.

java Main.class

C.

java Main.java

D.

javac Main

E.

java Main

 

Correct Answer: A

Explanation:

The compiler is invoked by the javac command. When compiling a Java class, you must include the file name, which houses the main classes including the Java extension. So to run Main.java file we have to use command in option

A.TO execute Java program we can use Java command but can’t use it for compiling. https://docs.oracle.com/javase/tutorial/getStarted/application/index.html

 

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.