阿摩線上測驗
登入
首頁
>
OJCP(SCJP)
>
104年 - SCJP 51-100#99391
> 申論題
63. Given:
11. class ClassA{}
12. class ClassB extends ClassA{}
13. class ClassC extends ClassA{}
and:
21. ClassA p0 = new ClassA();
22. ClassB p1 = new ClassB();
23. ClassC p2 = new ClassC();
24. ClassA p3 = new ClassB();
25. ClassA p4 = new ClassC();
Which three are valid? (Choose three.) (A) p0 = p1; (B) p1 = p2, (C) p2 = p4; (D) p2 = (ClassC)p1; (E) p1 = (ClassB)p3; (F) p2 = (ClassC)p4;
相關申論題
64. Given: class A { String name = "A"; String getName() { return name; } String greeting(){ return "class A"; } } class B extends A { String name = "B"; String greeting() { return "class B"; } } public class Client { public static void main( String[] args ) { A a = new A(); A b = new B(); System.out.println(a.greeting() + "has name" + a.getName()); System.out.println(b.greeting() + "has name" + b.getName()); } }
#415597
65. Replace two of the Modifiers that appear in the Single class to make the code compile. Note: Three modifiers will not be used and four modifiers in the code will remain unchanged. Code public class Single { private static Single instance; public static Single getInstance() { if (instance =
#415598
66. Given: 5. class Thingy{ Meter m = new Meter(); } 6. class Component {void go() { System.out.print("c");}} 7. class Meter extends Component {void go() { System.out.print("m"); }} 8. 9. class DeluxeThingy extends Thingy { 10. public static void main(String[] args) { 11. DeluxeThingy dt = new DeluxeThingy(); 12. dt.m.go(); 13. Thingy t = new DeluxeThingy(); 14. t.m.go(); 15. } 16. } Which two are true? (Choose two.) (A) The output is mm. (B) The output is mc. (C) Component is-a Meter. (D) Component has-a Meter. (E) DeluxeThingy is-a Component. (F) DeluxeThingy has-a Component.
#415599
71. Given: 1. interface A{public void aMethod();} JarB JarD JarE JarA JarC 2. interface B { public void bMethod(); } 3. interface C extends A, B { public void cMethod(); } 4. class D implements B { 5. public void bMethod(){} 6. } 7. class E extends D implements C { 8. public void aMethod(){} 9. public void bMethod(){} 10. public void cMethod(){} 11. } What is the result? (A) Compilation fails because of an error in line 3. (B) Compilation fails because of an error in line 7. (C) Compilation fails because of an error in line 9. (D) If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5. (E) If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5. (F) If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
#415600
78. A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Book class? (Choose Three.) (A) The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar. (B) The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar. (C) The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar/Paper.class. (D) The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar. (E) The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -cp /foo/myLib.jar/Paper Book.java (F) The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -d /foo/myLib.jar Book.java (G) The JAR file is located at foo/myLib.jar and the Book class is compiled using javac -classpath /foo/myLib.jar Book.java
#415601
86. Given: 10. abstract class A{ 11. abstract void a1(); 12. void a2(){} 13. } 14. class B extends A{ 15. void a1(){} 16. void a2(){} 17. } 18. class C extends B{void c1(){}} and: A x = new B(); C y = new C(); A z = new C(); What are four valid examples of polymorphic method calls? (Choose four.) (A) x.a2(); (B) z.a2(); (C) z.c1(); (D) z.a1(); (E) y.c1(); (F) x.a1();
#415602
88. Which Three statements are true? (Choose Three.) (A) A final method in class X can be abstract if and only if X is abstract. (B) A protected method in class X can be overridden by any subclass of X. (C) A private static method can be called only within other static methods in class X. (D) A non-static public final method in class X can be overridden in any subclass of X. (E) A public static method in class X can be called by a subclass of X without explicitly referencing the class X. (F) A method with the same signature as a private final method in class X can be implemented in a subclass of X. (G) A protected method in class X can be overridden by a subclass of X only if the subclass is in the same package as X.
#415603
96. Given a class Repetition: 1. package utils; 2. 3. public class Repetition { 4. public static String twice(String s){return s + s;} 5. } and given another class Demo: 1. // insert code here 2. 3. public class Demo { 4. public static void main(String[] args){ 5. System.out.println(twice("pizza")); 6. } 7. } Which code should be inserted at line 1 of Demo.java to compile and run Demo to print "pizzapizza"? (A) import utils.*; (B) static import utils.*; (C) import utils.Repetition.*; (D) static import utils.Repetition.*; (E) import utils.Repetition.twice(); (F) import static utils.Repetition.twice; (G)static import utils.Repetition.twice;
#415604
83. Given: 10. interface Foo{ 11. int bar(); 12. } 13. 14. public class Beta { 15. 16. class A implements Foo{ 17. public int bar(){return 1;} 18. } 19. 20. public int fubar(Foo foo){return foo.bar();} 21. 22. public void testFoo(){ 23. 24. class A implements Foo{ 25. public int bar() {return 2;} 26. } 27. 28. System.out.println(fubar(new A())); 29. } 30. 31. public static void main(String[] argv){ 32. new Beta().testFoo(); 33. } 34. } Which three statements are true? (Choose three.) (A)Compilation fails. (B) The code compiles and the output is 2. (C)If lines 16, 17 and 18 were removed, compilation would fail. (D) If lines 24, 25 and 26 were removed, compilation would fail. (E)If lines 16, 17 and 18 were removed, the code would compile and the output would be 2. (F)If lines 24, 25 and 26 were removed, the code would compile and the output would be 1.
#415605
二、問答題 1.王老師針對八年級數學領域的測驗進行試題分析,其中甲、乙兩道選擇題的分析數據如下: 請根據上列資訊計算這兩題的難度與鑑別度(4分),再提出三項試題品質優劣的評論(6分)。
#415606
相關試卷
104年 - SCJP 201-244#99410
104年 · #99410
104年 - SCJP 51-100#99391
104年 · #99391
104年 - SCJP 151-200#99330
104年 · #99330
104年 - SCJP 1-50#41416
104年 · #41416
無年度 - SCJP 6.0 認證教戰手冊第二版 SCJP 6.0 認證教戰手冊第二版 認證教戰手冊第二版_題庫 201-244#83084
#83084
無年度 - SCJP 6.0 認證教戰手冊第二版 SCJP 6.0 認證教戰手冊第二版 認證教戰手冊第二版_題庫 151-200#83081
#83081
無年度 - SCJP 6.0 認證教戰手冊第二版 SCJP 6.0 認證教戰手冊第二版 認證教戰手冊第二版_題庫 101-150#83070
#83070
無年度 - SCJP 6.0 認證教戰手冊第二版 SCJP 6.0 認證教戰手冊第二版 認證教戰手冊第二版_題庫 51-100#83056
#83056