Answers to Chapter 4 Review Questions ------------------------------------- 6. Conditionals & Iteration. Conditionals (switch, if) are used to make decisions, and Iteration (while, for) is used for repitition. 7. One control statement is in the body of another control statement. For example: for (i=0; i<10; i++) { for (j=0; j= 0) && (n <= 9) 12. (x != 4) || (x != 17) is TRUE if x is not equal to 4 OR x is not equal to 17. So it is FALSE if x=4 AND x=17, which can't ever happen. Here's a table: x x!=4 x!=17 either x!=4 TRUE OR x!=17 TRUE --- ---- ----- ------------------------------ 1 TRUE TRUE TRUE 4 FALSE TRUE TRUE 10 TRUE TRUE TRUE 17 TRUE FALSE TRUE 14. It is redundant. A better way to write this is just "if (myFlag) . . ." 17. It completes the current cycle first. 21. (a) for (i = 1; i <= 100; i++) (b) for (i = 0; i < 100; i += 7) (c) for (i = 100; i >= 0; i -= 2) 22. Because floating-point numbers are only approximations, and the precision of the machine may cause unexpected results.