SCJP考试题310-025(第二套)92-147/147

来源:java认证发布时间:2012-11-12 13:05:41java认证视频


QUESTION NO 123
Which statement is true?
A. A grid bag layout can position components such that they span multiple rows and/or columns.
B. The “North” region of a border layout is the proper place to locate a menuBar component in a
Frame.
C. Components in a grid bag layout may either resize with their cell, or remain centered in that cell at
their preferred size.
D. A border layout can be used to position a component that should maintain a constant size even
when the container is resized.
Answer: A
QUESTION NO 124
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?
A. Public
B. Private
C. Protected
D. Transient
E. No access modifier is required.
Answer: E
QUESTION NO 125
Which two statements are true regarding the creation of a default constructor? (Choose Two)
A. The default constructor initializes method variables.
B. The default constructor invokes the no-parameter constructor of the superclass.
C. The default constructor initializes the instance variables declared in the class.
D. If a class lacks a no-parameter constructor,, but has other constructors, the compiler creates a
default constructor.
E. The compiler creates a default constructor only when there are no other constructors for the class.
Answer: C, E
QUESTION NO 126
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. static class InnerOne {
public double methoda() {return d1;}
}
B. static class InnerOne {
static double methoda() {return d1;}
}
C. private class InnerOne {
public double methoda() {return d1;}
}
D. protected class InnerOne {
static double methoda() {return d1;}
}
E. public abstract class InnerOne {
public abstract double methoda();
}
Answer: C, E

QUESTION NO 127
Which two declarations prevent the overriding of a method? (Choose Two)
A. Final void methoda() {}
B. Void final methoda() {}
C. Static void methoda() {}
D. Static final void methoda() {}
E. Final abstract void methoda() {}
Answer: A, D
QUESTION NO 128
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. }
10. }
What is the result?
A. Compilation will fail.
B. Compilation will succeed and the program will print “3”
C. Compilation will succeed but the program will throw a ClassCastException at line 6.
D. Compilation will succeed but the program will throw a ClassCastException at line 7.
Answer: B
QUESTION NO 129
Which two create an instance of an array? (Choose Two)
A. int[] ia = new int [15];
B. float fa = new float [20];
C. char[] ca = “Some String”;
D. Object oa = new float[20];
E. Int ia [][] = (4, 5, 6) (1, 2, 3)
Answer: A, D
QUESTION NO 130
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?
A. Throws Exception.
B. Catch (Exception e).
C. Throws RuntimeException.
D. Catch (TestException e).
E. No code is necessary.
Answer: B

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答