Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
5Activity
0 of .
Results for:
No results containing your search query
P. 1
SCJP 5[1] 0 (310-055) - Q&A - CertMagic

SCJP 5[1] 0 (310-055) - Q&A - CertMagic

Ratings:

4.8

(5)
|Views: 1,300 |Likes:
Published by anon-17239

More info:

Published by: anon-17239 on Oct 29, 2007
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/08/2014

pdf

text

original

 
310-055http://www.certmagic.com- 1 -
Exam Code: 310-055
 
Sun Certified Programmer for the Java 2 Platform,Standard Edition 5.0
Demo Version
To Access Full Version, Please go towww.certmagic.com
 
310-055http://www.certmagic.com- 2 -
1. Given11. public interface Status {12. /* insert code here */ int MY_VALUE = 10;13. }Which three are valid on line 12? (Choose three.)A. finalB. staticC. nativeD. publicE. privateF. abstractG. protected
Answer: ABD
2. Given:10. public class Bar {11. static void foo( int... x ) {12. // insert code here13. }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
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("1 ");19. System.out.print("2 ");20. if ((b2 = true) && b1 )21. System.out.print("3 ");22. }23. }What is the result?A. 2B. 3C. 1 2D. 2 3E. 1 2 3F. Compilation fails.G. An exception is thrown at runtime.
Answer: D
4. Given:31. // some code here32. try {33. // some code here34. } catch (SomeException se) {35. // some code here36. } finally {37. // some code here
 
310-055http://www.certmagic.com- 3 -
38. }Under which three circumstances will the code on line 37 be executed? (Choose three.)A. The instance 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
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 here17. }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
6. Given:• d is a valid, non-null Date object• df is a valid, non-null DateFormat object set to the current localeWhat outputs the current locale's country 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 loc = Locale.getLocale();System.out.println(loc.getDisplayCountry()+ " " + df.setDateFormat(d));D. Locale loc = Locale.getDefault();System.out.println(loc.getDisplayCountry()+ " " + df.setDateFormat(d));
Answer: B
7. 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. }

Activity (5)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Alcimar Joaquim liked this
Lennox Mudau liked this
ravi_b2588 liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->