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

Ensurepass

QUESTION 61

Which two statements are true for a two-dimensional array of primitive data type?

 

A.

It cannot contain elements of different types.

B.

The length of each dimension must be the same.

C.

At the 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: CD

Explanation:

http://stackoverflow.com/questions/12806739/is-an-array-a-primitive-type-or-an-object-or-something-else-entirely

 

 

QUESTION 62

Given:

 

import java.util.*;

 

public class Ref {

 

public static void main(String[] args) {

 

StringBuilder s1 = new StringBuilder(“Hello Java!”);

 

String s2 = s1.toString();

 

List<String> lst = new ArrayList<String>();

 

lst.add(s2);

 

System.out.println(s1.getClass());

 

System.out.println(s2.getClass());

 

System.out.println(lst.getClass());

 

}

 

}

 

What is the result?

 

A.

class java.lang.String

class java.lang.String

class java.util.ArrayList

B.

class java.lang.Object

class java.lang. Object

class java.util.Collection

C.

class java.lang.StringBuilder

class java.lang.String

class java.util.ArrayList

D.

class java.lang.StringBuilder

class java.lang.String

class java.util.List

 

Correct Answer: C

Explanation:

class java.lang.StringBuilder

class java.lang.String

class java.util.ArrayList

 

 

QUESTION 63

Given the code from the Greeting.Java file:

 

clip_image002

 

Which set of commands prints Hello Duke in the console?

 

clip_image004

 

A.

Option A

B.

Option B

C.

Option C

D.

Option D

 

Correct Answer: C

 

QUESTION 64

Given:

 

public class MainMethod {

 

void main() {

 

System.out.println(“one”);

 

}

 

static void main(String args) {

 

System.out.println(“two”);

 

}

 

public static void main(String[] args) {

 

System.out.println(“three”);

 

}

 

void mina(Object[] args) {

 

System.out.println(“four”);

 

}

 

}

 

What is printed out when the program is excuted?

 

A.

one

B.

two

C.

three

D.

four

 

Correct Answer: C

 

 

QUESTION 65

Given:

 

public class Test {

 

public static void m
ain(String[] args) {

 

int arr[] = new int[4];

 

arr[0] = 1;

 

arr[1] = 2;

 

arr[2] = 4;

arr[3] = 5;

 

int sum = 0;

 

try {

 

for (int pos = 0; pos <= 4; pos++) {

 

sum = sum + arr[pos];

 

}

 

} catch (Exception e) {

 

System.out.println(“Invalid index”);

 

}

 

System.out.println(sum);

 

}

 

}

 

What is the result?

 

A.

12

B.

Invalid Index

C.

Invalid Index

D.

Compilation fails

 

Correct Answer: B

Explanation:

The loop ( for (int pos = 0; pos <= 4; pos++) { ), it should be pos <= 3, causes an exception, which is caught. Then the correct sum is printed.

 

 

QUESTION 66

Given the code fragment:

 

clip_image006

Which statement is true?

 

A.

After line 8, three objects are eligible for garbage collection

B.

After line 8, two objects are eligible for garbage collection

C.

After line 8, one object is eligible for garbage collection

D.

After line 8, none of the objects are eligible for garbage collection

 

Correct Answer: C

 

 

QUESTION 67

Given:

 

public class Test {

 

static boolean bVar;

 

public static void main(String[] args) {

 

boolean bVar1 = true;

 

int count =8;

 

do {

 

System.out.println(“Hello Java! ” +count);

 

if (count >= 7) {

 

bVar1 = false;

 

}

 

} while (bVar != bVar1 && count > 4);

 

count -= 2;

 

}

 

}

 

What is the result?

 

A.

Hello Java! 8

Hello Java! 6

Hello Java! 4

B.

Hello Java! 8

Hello Java! 6

C.

Hello Java! 8

D.

Compilation fails

 

Correct Answer: C

Explanation:

Hello Java! 8

 

QUESTION 68

Given:

 

clip_image008

 

What is the result?

 

A.

2 4 6 8

B.

2 4 6 8 9

C.

1 3 5 7

D.

1 3 5 7 9

 

Correct Answer: D

 

 

QUESTION 69

Given the code fragment:

 

clip_image010

 

Which modification enables the code fragment to print TrueDone?

 

A.

Replace line 5 With String result = “true”;

Replace line 7 with case “true”:

B.

Replace line 5 with boolean opt = l;

Replace line 7 with case 1=

C.

At line 9, remove the break statement.

D.

Remove the default section.

 

Correct Answer: A

 

QUESTION 70

Given the code fragment:

 

List colors = new ArrayList();

 

colors.add(“green”);

 

colors.add(“red”);

 

colors.add(“blue”);

 

colors.add(“yellow”);

 

colors.remove(2);

 

colors.add(3,”cyan”);

 

System.out.print(colors);

 

What is the result?

 

A.

[green, red, yellow, cyan]

B.

[green, blue, yellow, cyan]

C.

[green, red, cyan, yellow]

D.

Am IndexOutOfBoundsException is thrown at runtime

 

Correct Answer: A

Explanation:

First the list [green, red, blue, yellow] is build.

The blue element is removed:

[green, red, yellow]

Finally the element cyan is added at then end of the list (index 3).

[green, red, yellow, cyan]

 

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 Uncategorized and tagged , . Bookmark the permalink.