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. For any method to be abstract - what must also be true about the class?






2. Once a reference variable is defined - can it's object type be changed?






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






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


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


6. A class is access modified as default. It's methods are access modified as 'public'. What other class files can access the methods in this class?






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






8. Where can the brackets for an array declaration go?






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






10. What is the length in bytes of type 'long' - and what is it's maximum size?






11. An instance variable cannot be marked...






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






13. When would you get an error for a class declaration as follows and why? - protected class Me { }


14. What is the effect of making a method argument final?






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






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






17. What is the length in bytes of type 'int' - and what is it's maximum size?






18. What is the purpose of making a field 'volatile'?


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






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






21. What is the length in bytes of type 'short' - and what is it's maximum size?






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






23. A reference variable can be reassigned to another object that is of the same type. It can also be reassigned to a supertype or subtype of the original type?






24. What are the seven non-access modifiers for methods?






25. An instance variable cannot be...






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






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






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


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






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






31. Can multiple non-primitive variables be defined in one line?






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


33. What is the purpose of an Enum?






34. When are class instance variables instantiated?






35. What Java version began allowing an Enum type?






36. An interface method cannot be...






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






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


39. Enums can be declared outside a Class - but in...






40. At what point will you get an error if an interface method is 'protected' or 'private'?






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






42. Enums cannot be declared inside...






43. Which of the three non-access modifiers (strictfp - final - abstract) can and can't be used together in a class declaration?


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






45. How many interfaces can a class implement?


46. How many public classes can be defined in one source code file?






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






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






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






50. Can an abstract class have a final method?