APPENDIX G
Solutions to Selected Exercises
1.7 Exercises, Problems, and Projects
1.7.1 Multiple Choice Exercises:
1. Java
4. servers.
7. is a multiple of 4.
10. C
13. javac Hello.java
1.7.2 Converting Numbers
16. 11000011100
19. 0x15
1.7.3 General Questions
22. 1.5 billion
25. red = 51; green = 171; blue = 18
28. javac
2.7 Exercises, Problems, and Projects
2.7.1 Multiple Choice Exercises
1. int a;
2.7.2 Reading and Understanding Code
4. 12.5
7. 2.0
10. 4
13. 5
16. 2.4
19. 5
22. 0
2.7.3 Fill In the Code
25. boolean a; a = false;
28. float avg = (float) ( a + b ) / 2; System.out.println( “The average is” + avg );
31. a *= 3;
2.7.4 Identifying Errors in Code
34. Cannot assign a double to a float variable (possible loss of precision).
Get Java Illuminated, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.