Questions for Chapter 6
1) What is the purpose of a conditional expression in an If/Else statement?
2) A conditional expression in an If/Else statement must evaluate to what type of value?
3) What type of value is obtained by evaluating each of the following expressions: a) height
< 3, b) (5 + 1) * 10, c) who == plato?
a) Boolean
4) In Alice, where can you find the built-in random number functions?
5) Alice provides many built-in functions. Why would a programmer want to write hir/her
own function?
6) Why must a function have a Return statement?
A function must return the specified type of information. If it did not, the caller of the
7) Is it possible to have more than one Return statement in a function? Explain your answer.
8) What is the difference between the types of parameters (explained in Chapter 4) used in
methods and the types of values that can be returned from a function?
They behave quite analogously. The difference is that the parameters behave as input to
9) In Alice’s drag and drop interface, nested tiles and parentheses are automatically inserted
in the expression. What is the purpose of nested tiles and parentheses in an expression?
10) In a Boolean expression containing multiple conditions, what operators may be used to
connect the conditions?
11) A Boolean expression containing multiple conditions is often difficult to understand.
What alternate structure can be used to obtain the same result?