Oracle Java Certified Programmer 認定 1Z0-501 試験問題:
1. Which will declare a method that forces a subclass to implement it?
A) Abstract public void methoda();
B) Static void methoda (double d1) {}
C) Public native double methoda();
D) Protected void methoda (double d1){}
E) Public double methoda();
2. Exhibit:
1 . public class test (
2 .private static int j = 0;
3 .
4 .private static boolean methodB(int k) (
5 .j += k;
6 .return true;
6 . )
7 .
8 . public static void methodA(int i) {
9 .boolean b:
1 0.b = i < 10 | methodB (4);
1 1.b = i < 10 || methodB (8);
1 2.)
1 3.
1 4.public static void main (String args[] }(
1 5.methodA (0);
1 6.system.out.printIn(j);
1 7.)
1 8.)
What is the result?
A) The program prints "0"
B) The code does not complete.
C) The program prints "12"
D) The program prints "8"
E) The program prints "4"
3. Given:
1. public class OuterClass {
2. private double d1 1.0;
3. //insert code here
4. }
You need to insert an inner class declaration at line2. Which two inner class declarations are valid? (Choose Two)
A) protected class InnerOne {
static double methoda() {return d1;}
}
B) private class InnerOne {
public double methoda() {return d1;}
}
C) static class InnerOne {
public double methoda() {return d1;}
}
D) public abstract class InnerOne {
public abstract double methoda();
}
E) static class InnerOne {
static double methoda() {return d1;}
}
4. Exhibit:
1 . import java.awt.*;
2 .
3 . public class Test extends Frame {
4 . public Test(){
5 . add(new Label("Hello"));
6 . add(new TextField("Hello"));
7 . add(new Button("Hello"));
8 . pack();
9 . show();
1 0. }
1 1.
1 2. public static void main(String args[]) {
1 3.new Test ();
1 4.}
1 5. )
What is the result?
A) An IllegalArgumentException is thrown at line 6.
B) A Window button will appear but will not contain the Label, TextField, or Button.
C) A Window will appear containing a Label on the left, a TextField to the right of the Label, and abutton to the right of the TextField.
D) A Window will appear containing a Label at the top, a TextField below the Label, and a Buttonbelow the TextField.
E) A Window will appear containing only a Button.
F) The code will not compile.
5. Given:
1 . public class Foo {
2 . public void main (String [] args){
3 .system.out.printIn("Hello World.");
4 .}
5 .}
What is the result?
A) The program exits without printing anything.
B) The code does no compile.
C) "Hello World." Is printed to the terminal.
D) An exception is thrown.
質問と回答:
質問 # 1 正解: A | 質問 # 2 正解: E | 質問 # 3 正解: B、D | 質問 # 4 正解: E | 質問 # 5 正解: D |