Page: 5
8. OOPs
Q: 20 Click the Exhibit button. What is the output of the program shown in the exhibit?  A. 300-100-100-100-100 B. 300-300-100-100-100 C. 300-300-300-100-100 D. 300-300-300-300-100
Answer: B Q: 21 Click the Task button. 
Solution: public void bar(int x){ } public int bar(String x){ return 1; } public void bar(int x,int y) { } Q: 22 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 Q: 23 Click the Exhibit button. What is the result?  A. snootchy 420 third second first B. snootchy 420 first second third C. first second third snootchy 420 D. third second first snootchy 420 E. third first second snootchy 420 F. first second first third snootchy 420
Answer: D
Page: 5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|