# Review Questions

 10.1 Given the following program, which lines will print 11 exactly? ```class MyClass { public static void main(String[] args) { double v = 10.5; System.out.println(Math.ceil(v)); // (1) System.out.println(Math.round(v)); // (2) System.out.println(Math.floor(v)); // (3) System.out.println((int) Math.ceil(v)); // (4) System.out.println((int) Math.floor(v)); // (5) } } ``` Select the two correct answers. The line labeled (1).The line labeled (2).The line labeled (3).The line labeled (4).The line labeled (5). 10.11 Which method is not defined in the Math class? Select the one correct answer. double tan2(double)double cos(double)int abs(int a)double ceil(double)float max(float, float) 10.12 What is the return type of the method round(float) from the Math class? Select the one correct answer. intfloatdoubleIntegerFloat 10.13 What is the return type of the method ceil(double) from the Math class? Select the one correct answer. intfloatdoubleIntegerDouble 10.14 What will the following program print when run? ```public class Round { public static void main(String[] args) { System.out.println(Math.round(-0.5) + " " + Math.round(0.5)); } }; ``` Select the one correct answer. 0 00 1-1 0-1 1None of the above. 10.15 Which statements are true about the expression ((int)(Math.random()*4))? Select the three correct answers. It may evaluate to a negative number.It may evaluate to the number 0.The probability of it evaluating to the number 1 or the number 2 is the same.It may evaluate to the number 3.It may evaluate to the number 4.

 List of Figures
 List of Tables
 List of Examples
 Foreword
 Preface
 Chapter 1. Basics of Java Programming
 Chapter 2. Language Fundamentals
 Chapter 3. Operators and Assignments
 Chapter 4. Declarations and Access Control
 Chapter 5. Control Flow, Exception Handling, and Assertions
 Chapter 6. Object-oriented Programming
 Chapter 7. Nested Classes And Interfaces
 Chapter 8. Object Lifetime
 Chapter 9. Threads
 Chapter 11. Collections and Maps
 Appendix A. Taking the SCPJ2 1.4 Exam
 Appendix B. Objectives for the SCPJ2 1.4 Exam
 Appendix C. Objectives for the Java 2 Platform Upgrade Exam
 Appendix D. Annotated Answers to Review Questions
 Appendix E. Solutions to Programming Exercises
 Appendix F. Mock Exam
 Appendix G. Number Systems and Number Representation
 Appendix H. About the CD
 Single-User License Agreement