Section 2.31 Assessment: Swap
Subgoals for evaluating an assignment statement.
-
Determine resultant data type of expression
-
Update variable for pre operators based on side effect
-
Solve arithmetic equation, operator precedence
-
Is the Left Hand Side (LHS) of the assignment statement a variable? Check the data type of the value on right hand side (RHS) against data type of LHS variable.
-
Update variable for post operators based on side effect
Exercises Exercises
- d = temp; b = a;
- d = c; b = a;
- d = c; b = temp;
- d = a; b = temp;
- d = a; b = c;
2.
3.
4.
5.
Q5: Suppose there are four
integer
variables a
,b
,c
, and d
as depicted below. The code beside the diagram is intended to move the values in those variables one place clockwise, but two statements are missing. Choose the option that has the correct 2 statements.

You have attempted of activities on this page.