최신Oracle Java Certified Programmer - 1Z0-501무료샘플문제
문제1
Given:
1 . public class Foo {
2 . private int val;
3 . public foo(int v) (val = v;)}
4 . public static void main (String [] args){
5 . Foo a = new Foo (10);
6 . Foo b = new Foo (10);
7 . Foo c = a;
8 . int d = 10;
9 . double e = 10.0;
1 0. }
1 1. }
Which three logical expression evaluate to true? (Choose Three)
Given:
1 . public class Foo {
2 . private int val;
3 . public foo(int v) (val = v;)}
4 . public static void main (String [] args){
5 . Foo a = new Foo (10);
6 . Foo b = new Foo (10);
7 . Foo c = a;
8 . int d = 10;
9 . double e = 10.0;
1 0. }
1 1. }
Which three logical expression evaluate to true? (Choose Three)
정답: A,D,E
문제2
Exhibit:
1. class A {
2 . public int getNumber(int a) {
3 .return a + 1;
4 .}
5 .}
6 .
7 . class B extends A {
8 . public int getNumber (int a) {
9 . return a + 2
1 0. }
1 1.
1 2. public static void main (String args[]){
1 3. A a = new B();
1 4. System.out.printIn(a.getNumber(0));
1 5.}
1 6. }
What is the result?
Exhibit:
1. class A {
2 . public int getNumber(int a) {
3 .return a + 1;
4 .}
5 .}
6 .
7 . class B extends A {
8 . public int getNumber (int a) {
9 . return a + 2
1 0. }
1 1.
1 2. public static void main (String args[]){
1 3. A a = new B();
1 4. System.out.printIn(a.getNumber(0));
1 5.}
1 6. }
What is the result?
정답: A
문제3
Given:
1. public class Foo {
2 . public static void main (String [] args){
3 .StringBuffer a = new StringBuffer ("A");
4 .StringBuffer b = new StringBuffer ("B");
5 .operate (a,b);
6 .system.out.printIn{a + "," +b};
7 . )
8 . static void operate (StringBuffer x, StringBuffer y){
9 .x.append {y};
1 0.y = x;
1 1.)
1 2.}
What is the result?
Given:
1. public class Foo {
2 . public static void main (String [] args){
3 .StringBuffer a = new StringBuffer ("A");
4 .StringBuffer b = new StringBuffer ("B");
5 .operate (a,b);
6 .system.out.printIn{a + "," +b};
7 . )
8 . static void operate (StringBuffer x, StringBuffer y){
9 .x.append {y};
1 0.y = x;
1 1.)
1 2.}
What is the result?
정답: E
문제4
You want a class to have access to members of another class in the same package. Which is the most restrictive access modifier that will accomplish that will accomplish this objective?
You want a class to have access to members of another class in the same package. Which is the most restrictive access modifier that will accomplish that will accomplish this objective?
정답: B
문제5
Given:
1 . switch (i){
2 . default:
3 . System.out.printIn("Hello");
4 . )
What are the two acceptable types for the variable i? (Choose Two)
Given:
1 . switch (i){
2 . default:
3 . System.out.printIn("Hello");
4 . )
What are the two acceptable types for the variable i? (Choose Two)
정답: A,B
문제6
Given:
1 .public class ForBar {
2 .public static void main(String []args){
3 .int i = 0, j = 5;
4 .tp: for (;;){
5 .i ++;
6 .for(;;)
7 .if(i > --j) break tp;
8 .}
9 .system.out.printIn("i = " + i + ", j = "+ j);
1 0.}
1 1.}
What is the result?
Given:
1 .public class ForBar {
2 .public static void main(String []args){
3 .int i = 0, j = 5;
4 .tp: for (;;){
5 .i ++;
6 .for(;;)
7 .if(i > --j) break tp;
8 .}
9 .system.out.printIn("i = " + i + ", j = "+ j);
1 0.}
1 1.}
What is the result?
정답: B
문제7
Given:
1 . public class Test {
2 . public static void main (String args[]) {
3 .class Foo {
4 .public int i = 3;
5 .}
6 .Object o = (Object) new Foo();
7 .Foo foo = (Foo)o;
8 .System.out.printIn(foo. i);
9 .}
1 0. }
What is the result?
Given:
1 . public class Test {
2 . public static void main (String args[]) {
3 .class Foo {
4 .public int i = 3;
5 .}
6 .Object o = (Object) new Foo();
7 .Foo foo = (Foo)o;
8 .System.out.printIn(foo. i);
9 .}
1 0. }
What is the result?
정답: D
문제8
CORRECT TEXT
Given:
3. string foo = "ABCDE";
4. foo.substring(3);
5. foo.concat("XYZ");
6. Type the value of foo at line 6.
CORRECT TEXT
Given:
3. string foo = "ABCDE";
4. foo.substring(3);
5. foo.concat("XYZ");
6. Type the value of foo at line 6.
정답:
A,B,C,D,E
문제9
Given:
1 . public class ExceptionTest {
2 . class TestException extends Exception {}
3 . public void runTest () throws TestException {}
4 . public void test () /* Point X*/ {
5 . runTest ();
6 .}
7 . }
At point X on line 4, which code can be added to make the code compile?
Given:
1 . public class ExceptionTest {
2 . class TestException extends Exception {}
3 . public void runTest () throws TestException {}
4 . public void test () /* Point X*/ {
5 . runTest ();
6 .}
7 . }
At point X on line 4, which code can be added to make the code compile?
정답: E