Classes, Methods & Objects in Java Chapter Exam

Exam Instructions:

Choose your answers to the questions and click 'Next' to see the next set of questions. You can skip questions if you would like and come back to them later with the yellow "Go To First Skipped Question" button. When you have completed the practice exam, a green submit button will appear. Click it to see your results. Good luck!

Page 1

Question 1 1. What does this method return?

Question 2 2. Which of the following is NOT true about a method in Java?

Question 3 3. The line of code that creates an object from the class is called a _____

Question 4 4. Information can be _____ in a Java class, meaning available only to that class

Question 5 5. What will happen if you do not include a main method (e.g., public static void main)?

Page 2

Question 6 6. In the statement, what does the public statement mean?

Question 7 7. Examine the following code. What is the term for converting the wrapper class back to a primitive type?

Question 8 8. Examine the following code. What is happening to the variable e?

Question 9 9. The number of strings passed into the main method's local variable named args can be obtained via _____.

Question 10 10. The main method is called from _____ after your Java program is loaded into memory.

Page 3

Question 11 11. Examine the following code. The method getID is _____ in the subclass VipOrder.

Question 12 12. Which of the following statements correctly overrides the setQoh method?

Question 13 13. Which of the following method declarations followings the accepted naming convention?

Question 14 14. Method names should be _____

Question 15 15. To call a non-static method from a static method you have to:

Page 4

Question 16 16. In the code below, how can the method quote called from the method main?

Question 17 17. An instance of a class _____ methods and variables from the main class.

Question 18 18. Examine the following code. What is missing from the instantiation of the instance of the DiskDrive class?

Question 19 19. Examine the following methods. We need to add another method with the same name (overload the methods), to add 2 values together. What must be true about these new arguments?

Question 20 20. Examine the following code for a class and its constructor. What is the correct method to overload the constructor for a third argument?

Page 5

Question 21 21. After constructing a specific object, the Java new operator returns _____.

Question 22 22. A {Blank} must be specified before a specific instance of a Java object can be created.

Question 23 23. Why might you want to use a static nested class?

Question 24 24. If you have a class called IceScraper nested within the class Car, which of these would be the correct way to instantiate an IceScraper object?

Question 25 25. If you have overridden a method but still want to use the parent class method, what keyword is used?

Page 6

Question 26 26. Examine the following code that defines a class for Bonds. Which of the following is the correct way to override the method calcFees?

Question 27 27. Examine the following code: Which of the following correctly creates an instance of both the Product and the ProductDetail (a non-static inner) class?

Question 28 28. Examine the following code. What type of class is ProductCode?

Question 29 29. What happens if you don't create a constructor for a class?

Question 30 30. Examine the following constructor. Which code snippet correctly creates a new instance of the Cards class?

Classes, Methods & Objects in Java Chapter Exam Instructions

Choose your answers to the questions and click 'Next' to see the next set of questions. You can skip questions if you would like and come back to them later with the yellow "Go To First Skipped Question" button. When you have completed the practice exam, a green submit button will appear. Click it to see your results. Good luck!

Java Programming Tutorial & Training  /  Business Courses
Support