最新的Oracle Java Standard Edition 5 Programmer Certified Professional - 1Z0-853免費考試真題
問題1
Given:
12.
String csv = "Sue,5,true,3";
13.
Scanner scanner = new Scanner( csv );
14.
scanner.useDelimiter(",");
15.
int age = scanner.nextInt();
What is the result?
Given:
12.
String csv = "Sue,5,true,3";
13.
Scanner scanner = new Scanner( csv );
14.
scanner.useDelimiter(",");
15.
int age = scanner.nextInt();
What is the result?
正確答案: A
問題2
Click the Exhibit button.
What is the outcome of the code?

Click the Exhibit button.
What is the outcome of the code?

正確答案: B
問題3
Given:
d is a valid, non-null Date object
df is a valid, non-null DateFormat object set to the current locale
What outputs the current locale's country name and the appropriate version of d's date?
Given:
d is a valid, non-null Date object
df is a valid, non-null DateFormat object set to the current locale
What outputs the current locale's country name and the appropriate version of d's date?
正確答案: A
問題4
Given:
11.
public void genNumbers() {
12.
ArrayList numbers = new ArrayList();
13.
for (int i=0; i<10; i++) {
14.
int value = i * ((int) Math.random());
15.
Integer intObj = new Integer(value);
16.
numbers.add(intObj);
17.
}
18.
System.out.println(numbers);
19.
}
Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?
Given:
11.
public void genNumbers() {
12.
ArrayList numbers = new ArrayList();
13.
for (int i=0; i<10; i++) {
14.
int value = i * ((int) Math.random());
15.
Integer intObj = new Integer(value);
16.
numbers.add(intObj);
17.
}
18.
System.out.println(numbers);
19.
}
Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?
正確答案: D
問題5
Assuming that the serializeBanana() and the deserializeBanana() methods will correctly use Java serialization and given:
13.
import java.io.*;
14.
class Food implements Serializable {int good = 3;}
15.
class Fruit extends Food {int juice = 5;}
16.
public class Banana extends Fruit {
17.
int yellow = 4;
18.
public static void main(String [] args) {
19.
Banana b = new Banana(); Banana b2 = new Banana();
20.
b.serializeBanana(b); // assume correct serialization
21.
b2 = b.deserializeBanana(); // assume correct
22.
System.out.println("restore "+b2.yellow+ b2.juice+b2.good);
24.
}
25.
// more Banana methods go here 50. }
What is the result?
Assuming that the serializeBanana() and the deserializeBanana() methods will correctly use Java serialization and given:
13.
import java.io.*;
14.
class Food implements Serializable {int good = 3;}
15.
class Fruit extends Food {int juice = 5;}
16.
public class Banana extends Fruit {
17.
int yellow = 4;
18.
public static void main(String [] args) {
19.
Banana b = new Banana(); Banana b2 = new Banana();
20.
b.serializeBanana(b); // assume correct serialization
21.
b2 = b.deserializeBanana(); // assume correct
22.
System.out.println("restore "+b2.yellow+ b2.juice+b2.good);
24.
}
25.
// more Banana methods go here 50. }
What is the result?
正確答案: C
問題6
Given:
1.class Pizza {
2.java.util.ArrayList toppings;
3.public final void addTopping(String topping) {
4.toppings.add(topping);
5.}
6.}
7.public class PepperoniPizza extends Pizza {
8.public void addTopping(String topping) {
9.System.out.println("Cannot add Toppings");
10.
}
11.
public static void main(String[] args) {
12.
Pizza pizza = new PepperoniPizza();
13.
pizza.addTopping("Mushrooms");
14.
}
15.
}
What is the result?

Given:
1.class Pizza {
2.java.util.ArrayList toppings;
3.public final void addTopping(String topping) {
4.toppings.add(topping);
5.}
6.}
7.public class PepperoniPizza extends Pizza {
8.public void addTopping(String topping) {
9.System.out.println("Cannot add Toppings");
10.
}
11.
public static void main(String[] args) {
12.
Pizza pizza = new PepperoniPizza();
13.
pizza.addTopping("Mushrooms");
14.
}
15.
}
What is the result?

正確答案: D
問題7
DRAG DROP
Click the Task button.

DRAG DROP
Click the Task button.

正確答案:

問題8
DRAG DROP
Click the Task button.

DRAG DROP
Click the Task button.

正確答案:

問題9
Given:
1.public class Target {
2.private int i = 0;
3.public int addOne(){
4.return ++i;
5.}
6.} And:
1.public class Client {
2.public static void main(String[] args){
3.System.out.println(new Target().addOne());
4.}
5.}
Which change can you make to Target without affecting Client?
Given:
1.public class Target {
2.private int i = 0;
3.public int addOne(){
4.return ++i;
5.}
6.} And:
1.public class Client {
2.public static void main(String[] args){
3.System.out.println(new Target().addOne());
4.}
5.}
Which change can you make to Target without affecting Client?
正確答案: A