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

Ensurepass

QUESTION 51

Given:

 

class MarksOutOfBoundsException extends IndexOutOfBoundsException { }

 

public class GradingProcess {

 

void verify(int marks) throws IndexOutOfBoundsException {

 

if (marks > 100) {

 

throw new MarksOutOfBoundsException();

 

}

 

if (marks > 50) {

 

System.out.print(“Pass”);

 

} else {

 

System.out.print(“Fail”);

 

}

 

}

 

public static void main(String[] args) {

int marks = Integer.parseInt(args[2]);

 

try {

 

new GradingProcess().verify(marks));

 

} catch(Exception e) {

 

 

System.out.print(e.getClass());

 

}

 

}

 

}

 

And the command line invocation:

 

Java grading process 89 50 104

 

What is the result?

 

A.

Pass

B.

Fail

C.

Class MarketOutOfBoundsException

D.

Class IndexOutOfBoundsException

E.

Class Exception

 

Correct Answer: C

Explanation:

The value 104 will cause a MarketOutOfBoundsException

 

 

QUESTION 52

Given:

 

clip_image001

What is the result?

 

A.

Shining Sun

Shining Sun

Shining Sun

B.

Shining Sun

Twinkling Star

Shining Sun

C.

Compilation fails

D.

A ClassCastException is thrown at runtime

 

Correct Answer: D

 

 

QUESTION 53

Given the following two classes:

 

clip_image003

 

How should you write methods in the ElectricAccount class at line n1 so that the member variable bill is always equal to the value of the member variable kwh multiplied by the member variable rate?

 

Any amount of electricity used by a customer (represented by an instance of the customer class) must contribute to the customer’s bill (represented by the member variable bill) through the method useElectricity method. An instance of the customer class should never be able to tamper with or decrease the value of the member variable bill.

 

clip_image005

 

A.

Option A

B.

Option B

C.

Option C

D.

Option D

 

Correct Answer: B

 

 

QUESTION 54

Given:

 

public class Test1 {

 

static void doubling (Integer ref, int pv) {

 

ref =20;

 

pv = 20;

 

}

public static void main(String[] args) {

 

Integer iObj = new Integer(10);

 

int iVar = 10;

 

doubling(iObj++, iVar++);

 

System.out.println(iObj+ “, “+iVar);

 

What is the result?

 

A.

11, 11

B.

10, 10

C.

21, 11

D.

20, 20

E.

11, 12

 

Correct Answer: A

Explanation:

The code doubling(iObj++, iVar++); increases both variables from to 10 to 11.

 

 

QUESTION 55

Given:

 

clip_image007

 

Which code fragment, when inserted at line 14, enables the code to print Mike Found?

 

A.

int f = ps.indexOf {new patient (“Mike”)};

B.

int f = ps.indexOf (patient(“Mike”));

C.

patient p = new Patient (“Mike”);

int f = pas.indexOf(P)

D.

int f = ps.indexOf(p2);

 

Correct Answer: C

 

 

QUESTION 56

Given:

 

public class Test {

 

public static void main(String[] args) {

 

try {

 

String[] arr =new String[4];

 

arr[1] = “Unix”;

 

arr[2] = “Linux”;

 

 

arr[3] = “Solarios”;

 

for (String var : arr) {

 

System.out.print(var + ” “);

 

}

 

} catch(Exception e) {

 

System.out.print (e.getClass());

 

}

 

}

 

}

 

What is the result?

 

A.

Unix Linux Solaris

B.

Null Unix Linux Solaris

C.

Class java.lang.Exception

D.

Class java.lang.NullPointerException

 

Correct Answer: B

Explanation:

null Unix Linux Solarios

The first element, arr[0], has not been defined.

 

 

QUESTION 57

Given:

 

clip_image009

 

What will be the output?

 

clip_image011

 

A.

Option A

B.

Option B

C.

Option C

D.

Option D

 

Correct Answer: D

 

 

QUESTION 58

Given:

 

public class TestOperator {

 

public static void main(String[] args) {

 

int result = 30 -12 / (2*5)+1;

 

System.out.print(“Result = ” + result);

 

}

 

}

 

What is the result?

 

A.

Result = 2

B.

Result = 3

C.

Result = 28

D.

Result = 29

E.

Result = 30

 

Correct Answer: E

 

 

QUESTION 59

Given the code fragment:

 

int b = 3;

 

if ( !(b > 3)) {

 

System.out.println(“square “);

 

}{

 

System.out.println(“circle “);

 

}

 

System.out.println(“…”);

 

What is the result?

 

A.

square…

B.

circle…

C.

squarecircle…

D.

Compilation fails.

 

Correct Answer: C

 

 

QUESTION 60

Given the code fragment:

 

public class ForTest {

 

public static void main(String[] args) {

 

int[] array = {1, 2, 3};

 

for ( foo ) {

 

}

 

}

Which three code fragments, when replaced individually for foo, enables the program to compile?

 

A.

int i : array

B.

int i = 0; i < 1;

C.

; ;

D.

; i < 1; i++

E.

i = 0; i<1;

 

Correct Answer: ABC

 

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.