NAME (1pt): _________________________    SEC (1pt):    1    2    3    4    

1) (1pt) How far - how detailed - should the problem decomposition be carried?

Until each step in the decomposition outline can be confidently translated into source code.  

2) (2pts) What are the three basic control structures used in structured programming?

sequence, selection, repetition     (1pt if at least two are correct)

 

3) (2pts) Two operators are "complementary" if they always produce the opposite result. With that in mind, group the six relational operators available in C into three pairs of complementary operators.

( = = , ! =), ( <. > =), (>, < =)      (1pt if at least two are correct)

 

4) (1pt) What common mathematical function does the conditional statement a = (a<0)? -a : a; implement?

The absolute value function.

 

5) (2pts) In a switch statement, the case labels must be unique constants. This implies two conditions that must be met. What are they?

    1) The labels must be unique - no two case labels can be the same.

   2) The labels must be constants - they cannot be variables or expressions.