1. Chapter 7 review questions:
1. Define operator precedence and operator associativity?
Precedence: defines order and priority of the operator evaluation from
different precedence levels.
Associativity: defines the order of operators evaluation when it is form
the same precedence level.
2. Define functional side effects.
When the function changes either one of its parameters or a global
variable.
3. What is coercion?
Is an implicit type conversion that is initiated by the compiler?
4. What is conditional expression?
Evaluate one of the expression's conditions after Boolean control
statement is evaluated.
5. What is an overloaded operator?
Is an operator with multiple uses.
6. Define narrowing and widening conversions.
A narrowing conversion is converting value to type cannot store even
approximation of all of the original type.
A widening conversion is converting value to type that can include at
least approximation of all of values of original type.
7. What is a mixed-mode expression?
When the operator can take operands of different types.
2. 8. How does operand evaluation order interact with functional side
effects?
If the language does not allow functional side effects then the order of
evaluating the operands has no effects on the value of the expression.
9. What is short-circuit evaluation?
Result is determined without evaluating all of the operands and/or
operators.
10.Name a language that always does short-circuit evaluation of
Boolean expression. Name one that never does it. Name one
which the programmer is allowed to choose.
JavaScript always does short-circuit evaluation and Ada allow the
programmer to choose.
11.How does C support relational and Boolean expressions?
By using numeric types to express the Boolean value 0 for false and 1 for
true.
12.What is the purpose of a compound assignment operator?
A compound assignment operator is a short hand method of specifying a
commonly needed form of assignment.
13.What is the associativity of C's unary arithmetic operators?
Associativity is to the right.
14.What is one possible disadvantage of treating the assignment
operator as if it were an arithmetic operator?
It provide yet another side effect.
15.What mixed-mode assignment are allowed in Ada?
Ada does not allow mixed-mode assignment.
16.What mixed-mode assignment are allowed in Java?
It allow mixed-mode assignment only if the required coercion is
widening.