Monday, April 8, 2013

Answers of Concepts of Programming Languages Chapter 7


1.
2. operator requiring 3 operands
3. operator preceding the operands
4. the exponentiation
5. an expression needed to be parenthesized to show the desired order
6. APL uses right to left associativity rule
7.
8. functional side effect is the unwanted output that occurs when the function changes either one of its parameters or a global variable
9.
10. conditional expression is the expression used to determine which actions should be taken based on certain condition

Problem set
1
2
3. I think it will be beneficial, because it can eliminate the confusion of those operators function, thus increases the readibility
4. I don't think it will be a good idea, because when we eliminate the precedence rules, it means we need extra effort to determine the precedence by adding more syntax or operators. It will just waste of time and decrease efficiency.
5. Yes, because it really will simplify the length of the statement and make the user looks like more professional.
6. Yes, because it will be really helpful, especially in looping, so we don't need to write longer statements, instead, just by using the ++ sign to refer to increment by 1.
7.
8. When there is 2 integers which has really big number. When we want to add both of them, it will cause an overflow exception, because the result will pass over the range supported.
9
10
11
12
13. a. sum1 = 46, sum2 = 46
    b. sum1 = 44, sum2 = 44

No comments:

Post a Comment