최신Oracle Java Standard Edition 6 Programmer Certified Professional - 1Z0-851무료샘플문제
문제1
Given:
11.public static void main(String[] args) {
12.Integer i = new Integer(1) + new Integer(2);
13.switch(i) {
14.case 3: System.out.println("three"); break;
15.default: System.out.println("other"); break;
16.}
17.}
What is the result?
Given:
11.public static void main(String[] args) {
12.Integer i = new Integer(1) + new Integer(2);
13.switch(i) {
14.case 3: System.out.println("three"); break;
15.default: System.out.println("other"); break;
16.}
17.}
What is the result?
정답: E
문제2
DRAG DROP
Click the Task button.

DRAG DROP
Click the Task button.

정답:

문제3
Which two code fragments will execute the method doStuff() in a separate thread? (Choose two.)
Which two code fragments will execute the method doStuff() in a separate thread? (Choose two.)
정답: C,D
문제4
Which two statements are true? (Choose two.)
Which two statements are true? (Choose two.)
정답: B,D
문제5
Given:
1.public class Venus {
2.public static void main(String[] args) {
3.int [] x = {1,2,3};
4.int y[] = {4,5,6};
5.new Venus().go(x,y);
6.}
7.void go(int[]... z) {
8.for(int[] a : z)
9.System.out.print(a[0]);
10.}
11.}
What is the result?
Given:
1.public class Venus {
2.public static void main(String[] args) {
3.int [] x = {1,2,3};
4.int y[] = {4,5,6};
5.new Venus().go(x,y);
6.}
7.void go(int[]... z) {
8.for(int[] a : z)
9.System.out.print(a[0]);
10.}
11.}
What is the result?
정답: E
문제6
Click the Exhibit button. What is the output if the main() method is run?

Click the Exhibit button. What is the output if the main() method is run?

정답: E
문제7
Given:
11.public static Collection get() {
12.Collection sorted = new LinkedList();
13.sorted.add("B"); sorted.add("C"); sorted.add("A");
14.return sorted;
15.}
16.public static void main(String[] args) {
17.for (Object obj: get()) {
18.System.out.print(obj + ", ");
19.}
20.}
What is the result?
Given:
11.public static Collection get() {
12.Collection sorted = new LinkedList();
13.sorted.add("B"); sorted.add("C"); sorted.add("A");
14.return sorted;
15.}
16.public static void main(String[] args) {
17.for (Object obj: get()) {
18.System.out.print(obj + ", ");
19.}
20.}
What is the result?
정답: A
문제8
DRAG DROP
Click the Task button.

DRAG DROP
Click the Task button.

정답:

문제9
Given:
1.class TestException extends Exception { }
2.class A {
3.public String sayHello(String name) throws TestException {
4.if(name == null) throw new TestException();
5.return "Hello " + name;
6.}
7.}
8.public class TestA {
9.public static void main(String[] args) {
10.new A().sayHello("Aiko");
11.}
12.}
Which statement is true?
Given:
1.class TestException extends Exception { }
2.class A {
3.public String sayHello(String name) throws TestException {
4.if(name == null) throw new TestException();
5.return "Hello " + name;
6.}
7.}
8.public class TestA {
9.public static void main(String[] args) {
10.new A().sayHello("Aiko");
11.}
12.}
Which statement is true?
정답: C
문제10
Given the following directory structure: bigProject |--source | |--Utils.java | |--classes |-- And the following command line invocation: javac -d classes source/Utils.java Assume the current directory is bigProject, what is the result?
Given the following directory structure: bigProject |--source | |--Utils.java | |--classes |-- And the following command line invocation: javac -d classes source/Utils.java Assume the current directory is bigProject, what is the result?
정답: C
문제11
Given:
11.public class Test {
12.public static void main(String [] args) {
13.int x = 5;
14.boolean b1 = true;
15.boolean b2 = false;
16.17.
if ((x == 4) && !b2 )
18.System.out.print("1 ");
19.System.out.print("2 ");
20.if ((b2 = true) && b1 )
21.System.out.print("3 ");
22.}
23.}
What is the result?
Given:
11.public class Test {
12.public static void main(String [] args) {
13.int x = 5;
14.boolean b1 = true;
15.boolean b2 = false;
16.17.
if ((x == 4) && !b2 )
18.System.out.print("1 ");
19.System.out.print("2 ");
20.if ((b2 = true) && b1 )
21.System.out.print("3 ");
22.}
23.}
What is the result?
정답: E
문제12
Given:
11.public class Rainbow {
12.public enum MyColor {
13.RED(0xff0000), GREEN(0x00ff00), BLUE(0x0000ff);
14.private final int rgb;
15.MyColor(int rgb) { this.rgb = rgb; }
16.public int getRGB() { return rgb; }
17.};
18.public static void main(String[] args) {
19.// insert code here
20.}
21.}
Which code fragment, inserted at line 19, allows the Rainbow class to compile?
Given:
11.public class Rainbow {
12.public enum MyColor {
13.RED(0xff0000), GREEN(0x00ff00), BLUE(0x0000ff);
14.private final int rgb;
15.MyColor(int rgb) { this.rgb = rgb; }
16.public int getRGB() { return rgb; }
17.};
18.public static void main(String[] args) {
19.// insert code here
20.}
21.}
Which code fragment, inserted at line 19, allows the Rainbow class to compile?
정답: B
문제13
A company that makes Computer Assisted Design (CAD) software has, within its application, some utility classes that are used to perform 3D rendering tasks. The company's chief scientist has just improved the performance of one of the utility classes' key rendering algorithms, and has assigned a programmer to replace the old algorithm with the new algorithm. When the programmer begins researching the utility classes, she is happy to discover that the algorithm to be replaced exists in only one class. The programmer reviews that class's API, and replaces the old algorithm with the new algorithm, being careful that her changes adhere strictly to the class's API. Once testing has begun, the programmer discovers that other classes that use the class she changed are no longer working properly. What design flaw is most likely the cause of these new bugs?
A company that makes Computer Assisted Design (CAD) software has, within its application, some utility classes that are used to perform 3D rendering tasks. The company's chief scientist has just improved the performance of one of the utility classes' key rendering algorithms, and has assigned a programmer to replace the old algorithm with the new algorithm. When the programmer begins researching the utility classes, she is happy to discover that the algorithm to be replaced exists in only one class. The programmer reviews that class's API, and replaces the old algorithm with the new algorithm, being careful that her changes adhere strictly to the class's API. Once testing has begun, the programmer discovers that other classes that use the class she changed are no longer working properly. What design flaw is most likely the cause of these new bugs?
정답: B