SunはUNIX領域でずっと技術と市場占有率のリーダである;近年来Java技術を推しだして、業界の標準になリます、だからSun会社が行う認証試験は絶対JavaとUNIX情報界の公認する標準になります
310-055 の問題皆と分かち合います
5.Given: 10. interface Jumper { public void jump(); } ... 20. class Animal {} ... 30. class Dog extends Animal
{ 31. Tail tail; 32. } ... 40. class Beagle extends Dog implements Jumper{ 41. public void jump() {} 42. } ...
50. class Cat implements Jumper{ 51. public void jump() {} 52. } Which three are true? (Choose three.)
A.Cat is-a Animal
B.Cat is-a Jumper
C.Dog is-a Animal
D.Dog is-a Jumper
E.Cat has-a Animal
F.Beagle has-a Tail
G.Beagle has-a Jumper
Answer:B C F
6.Given: 10: public class Hello { 11: String title; 12: int value; 13: public Hello() { 14: title += " World"; 15: }
16: public Hello(int value) { 17: this.value = value; 18: title = "Hello"; 19: Hello(); 20: } 21: } and: 30: Hello c
= new Hello(5); 31: System.out.println(c.title); What is the result?
A.Hello
B.Hello World
C.Compilation fails.
D.Hello World 5
E.The code runs with no output.
F.An exception is thrown at runtime.
Answer:C
7.Given: 10. interface A { public int getValue(); } 11. class B implements A { 12. public int getValue()
{ return 1; } 13. } 14. class C extends B { 15. // insert code here 16. } Which three code fragments, inserted
individually at line 15, make use of polymorphism? (Choose three.)
A.public void add(C c) { c.getValue(); }
B.public void add(B b) { b.getValue(); }
C.public void add(A a) { a.getValue(); }
D.public void add(A a, B b) { a.getValue(); }
E.public void add(C c1, C c2) { c1.getValue(); }
Answer:B C D
8.Given: 20. public class CreditCard { 21. 22. private String cardID; 23. private Integer limit; 24. public
String ownerName; 25. 26. public void setCardInformation(String cardID, 27. String ownerName, 28.
Integer limit) { 29. this.cardID = cardID; 30. this.ownerName = ownerName; 31. this.limit = limit; 32. } 33. }
Which statement is true?
A.The class is fully encapsulated.
B.The code demonstrates polymorphism.
C.The ownerName variable breaks encapsulation.
D.The cardID and limit variables break polymorphism.
E.The setCardInformation method breaks encapsulation.
Answer:C
9.Given: 1. class Super { 2. private int a; 3. protected Super(int a) { this.a = a; } 4. } ... 11. class Sub
extends Super { 12. public Sub(int a) { super(a); } 13. public Sub() { this.a = 5; } 14. } Which two,
independently, will allow Sub to compile? (Choose two.)
A.Change line 2 to: public int a;
B.Change line 2 to: protected int a;
C.Change line 13 to: public Sub() { this(5); }
D.Change line 13 to: public Sub() { super(5); }
E.Change line 13 to: public Sub() { super(a); }
Answer:C D
10.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;
Answer:A E F