Teste killer scjp 5

Disponível somente no TrabalhosFeitos
  • Páginas : 29 (7238 palavras )
  • Download(s) : 0
  • Publicado : 28 de maio de 2012
Ler documento completo
Amostra do texto
Sun Certified Programmer for the Java 2 Platform, Standard Exam 310-055
Edition 5.0

© 2003- 2004 Test Killer, LTD All Rights Reserved

Congratulations!!
You have purchased a Testkiller Ltd. Study Guide. This study guide is a complete collection of questions that have been directly taken from the real exams and answers that have been researched and verified by our professional expert team.Study and memorize the following questions and answers for approximately 15 to 20 hours and you will be prepared to take the exams. We guarantee it! Remember, average study time is 15 to 20 hours and then you are ready!!! GOOD LUCK!

DISCLAIMER

This study guide and/or material is not sponsored by, endorsed by or affiliated with Microsoft, Cisco, Oracle, Citrix, CIW, CheckPoint, Novell,Sun/Solaris, CWNA, LPI, ISC, etc. All trademarks are properties of their respective owners.

Guarantee If you use this study guide correctly and still fail the exam, send a scanned copy of your official score notice at: support@troytec.com We will gladly refund the cost of this study guide. However, you will not need this guarantee if you follow the above instructions.

This material is protectedby copyright law and international treaties. Unauthorized reproduction or distribution of this material, or any portion thereof, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.

Question 1 Given: 11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12? (Choose three.) A.final B. static C. native D. public E. private F. abstract G. protected Answer: ABD Question 2 Given: 10. public class Bar { 11.static void foo(int...x) { 12. // insert code here 13. } 14. } Which two code fragments, inserted independently at line 12, will allow the class to compile? (Choose two.) A. foreach(x) System.out.println(z); B. for(int z : x) System.out.println(z); C. while( x.hasNext())System.out.println( x.next()); D. for( int i=0; i< x.length; i++ ) System.out.println(x[i]); Answer: BD Question 3 Given: 11. public class Test { 12. public static void main(String [] args) { 13. int x =5; 14. boolean b1 = true; 15. boolean b2 = false; 16. 17.if((x==4) && !b2) 18. System.out.print(”l “); 19. System.out.print(”2 “); 20. if ((b2 = true) && b1)

21. System.out.print(”3 “); 22. }23. } What is the result? A. 2 B. 3 C. 1 2 D. 2 3 E. 1 2 3 F. Compilation fails. G. Au exceptional is thrown at runtime. Answer: D Question 4 4. Given: 31. // some code here 32. try { 33. // some code here 34. } catch (SomeException se) { 35. // some code here 36. } finally { 37. // some code here 38. } Under which three circumstances will the code on line 37 be executed? (Choose three.) A. Theinstance gets garbage collected. B. The code on line 33 throws an exception. C. The code on line 35 throws an exception. D. The code on line 31 throws an exception. E. The code on line 33 executes successfully. Answer: BCE Question 5 Given: 10. interface Foo {} 11. class Alpha implements Foo { } 12. class Beta extends Alpha {} 13. class Delta extends Beta { 14. public static void main( String[]args) { 15. Beta x = new Beta(); 16. // insert code here 17. }

18. } Which code, inserted at line 16, will cause a java.lang.ClassCastException? A. Alpha a = x; B. Foo f= (Delta)x; C. Foo f= (Alpha)x; D. Beta b = (Beta)(Alpha)x; Answer: B Question 6 Given: • d is a valid, non-null Date object • df is a valid, non-null DateFormat object set to the current locale What outputs the current localescountry name and the appropriate version of d’s date? A. Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry() + “ “+ df.format(d)); B. Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry() + “ “ + df.format(d)); C. Locale bc = Locale.getLocale(); System.out.println(loc.getDisplayCountry() + “ “+ df.setDateFormat(d)); D. Locale loc = Locale.getDefault();...
tracking img