Test your basic knowledge |

Oracle Sun Certified Java Programmer

Instructions:
  • Answer 50 questions in 15 minutes.
  • If you are not ready to take this test, you can study here.
  • Match each statement with the correct term.
  • Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.

This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. When would you get an error for a class declaration as follows and why? - protected class Me { }


2. For any method to be abstract - what must also be true about the class?






3. When accessing an object you really don't have access to (it's 'private' or 'default' in another package - etc) - when will you get an error: at compilation or at run-time?


4. What is the syntax for declaring multiple variables on one line?






5. Enums can be declared...






6. All methods in an Interface are what by default?






7. What is the purpose of making a field 'transient'?






8. The following field is defined in an interface. What do we know about it's access and non-access modifiers? int aNumber = 59;


9. An ________cannot be static?






10. An interface method cannot be...






11. Where do var-args have to appear on the method parameter list?






12. What is the purpose of making a class 'abstract'?






13. Does an override have to throw all the exceptions of the original method?






14. When overriding a method - the return type must be what?


15. If a class is abstract - do the methods which ares supposed to be abstract too need to be marked 'abstract'?


16. When overriding a method - the argument list (i.e. signature) must be what?






17. Where in the source code must a 'package' statement be?






18. How many bits does a primitive 'float' hold?






19. Enums cannot be declared inside...






20. Can you make an overriding method more access restrictive (public to private) or less restrictive (private to public)?






21. An original method that will be overriden by a class in the same package as the original could have what access levels and still be considered an 'override'?






22. What three non-access modifiers can be used with a class declaration?






23. What are the eight primitive types in Java?






24. Can a subclass see and use inherited 'private' methods and fields?


25. When you try to use a method that you don't have access to (due to 'private' etc) - when do you get an error?






26. What kind of error (run-time or compile) do you get when trying to extend a final class?






27. An interface method cannot be modified as...


28. How many classes can a class extend?






29. How many arguments can an Enum constructor have?






30. What must you do when extending an abstract class or implementing any interface?






31. What is a 'constant specific class body' and where can you use it?






32. What is the purpose of making a method 'synchronized'?






33. How many var-arg's can you have in a method signature?






34. What occurs when a class is marked as 'final'?






35. If an Enum has a constructor - can you call that constructor?






36. What is the proper syntax for declaring a var-arg in a method signature?






37. How many bits does a primitive 'double' hold?






38. An instance variable cannot be...






39. Is this identifier name valid? Why or why not? int 34myVar-Yes;






40. Putting abstract and final in the class declaration will give you a run-time or compile time error?






41. What is the purpose of making a method 'native'?






42. How many interfaces can a class implement?


43. What is the most basic construction for an Enum?






44. How many non public classes can be in any one file?






45. If a class's public class declaration is something like - 'public class HiThereSally {' - what must the source code file be named? Why?






46. What are the only two access modifiers valid for a Class?






47. All fields in an interface must have what three access & non-access modifiers?






48. Do Enums have to be within an existing class?






49. What is the purpose of an Enum?






50. Can a private method be overriden by a subclass?