ch3_answers - Gaddis: Starting Out with Java: From Control...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Gaddis: Starting Out with Java: From Control Structures through Objects, 3/e 1 Starting Out with Java - From Control Structures through Objects Answers to Review Questions Chapter 3 Multiple Choice and True/False 1. b 2. d 3. a 4. b 5. c 6. d 7. a 8. b 9. a 10. a 11. a 12. c 13. c 14. b 15. c 16. False 17. True 18. True 19. True 20. False 21. True Find the Error 1. Each if clause is prematurely terminated by a semicolon. 2. The = operator should be == . 3. The conditionally-executed blocks of code should be enclosed in braces. 4. The case expressions cannot have relational operators. They must be integer expressions. 5. The ! operator is only applied to the variable x , not the expression. The code should read: if (!(x > 20)) 6. The statement should use the operator instead of the || operator. 7. The statement should use the || operator instead of the operator. 8. The : and ? are reversed in their positions. The statement should read: z = (a < 10) ? 0 : 7;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/13/2011 for the course CS 1093P taught by Professor Smith during the Spring '11 term at Akademia Ekonomiczna w Krakowie.

Page1 / 4

ch3_answers - Gaddis: Starting Out with Java: From Control...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online