In this exercise, we ask you to guess the results of the expressions by mentally simulating the execution of expressions.
30.1. Exercise: Results
Examine the following expressions. What is the value returned by the execution of the following expression?
30.1.0.1. Exercise:
Solution.
30.1.0.2. Exercise:
Solution.
30.1.0.3. Exercise:
Solution.
30.1.0.4. Exercise:
Solution.
30.1.0.5. Exercise:
Solution.
30.1.0.6. Exercise:
Solution.
30.1.0.7. Exercise:
Solution.
30.1.0.8. Exercise:
Solution.
30.1.1. Exercise: unneeded parentheses
Putting more parentheses than necessary is a good way to get started. Such practice however leads to less readable expressions.
Rewrite the following expressions using the least number of parentheses.
30.1.1.1. Exercise:
Solution.
30.1.1.2. Exercise:
Solution.
30.1.1.3. Exercise:
Solution.
30.1.1.4. Exercise:
Solution.
30.1.1.5. Exercise:
Solution.
30.1.1.6. Exercise:
Solution.
30.1.1.7. Exercise:
Solution.
30.1.1.8. Exercise:
Solution.
30.1.1.9. Exercise:
Solution.
30.1.2. Exercise: Execution sequence
Examine each of the following expression and write down the sequence of steps of their execution (which message is executed first and so on).