Question 1

A. Yes. A character is just a small integer.

B. It will execute when b is not equal to 0.

C. Example: for (; 3 < 2 ;)
or, perhaps more obviously
for (int i = 1; i <= 0; i++)

D. Short-circuit evaluation refers to the way that C executes expressions containing && and ||. As soon as it knows the truth of such an expression, it can stop evaluating. For example, the following expression does not print anything:
0 && printf ("hi");

E. 5 3 5

F. For-loops make the structure of a counting loop more clear, since all of the control information is found in one place. We can look at the first line of a well-designed for-loop and know how many times it will execute, and what the value of the control variable will be on each iteration.


-----

Question 2

A. bool b = i != j;

B. while (num >= 0 && num <= 50);
or
while (!(num < 0 || num > 50));


-----

Question 3

see convert.c


-----

Question 4

See speeding.c


-----

Question 5

see repeated.c (includes main function for convenience, not written by students)


-----

Question 6

Output (see output.c):
3
8
18


-----

Question 7

See roll.c


-----

Question 8

A. see square.c (includes main function for convenience, not written by students)

B. The function does not modify the first parameter, so a pointer is not required.

