# Subgoals

## Section1.22Assessment: Pre/Post Operators

### Subgoals for evaluating an assignment statement.

1. Determine resultant data type of expression
2. Update variable for pre operators based on side effect
3. Solve arithmetic equation, operator precedence
4. If = statement, is Left Hand Side (LHS) a variable? Check data type of copied value against data type of variable
5. Update variable for post operators based on side effect

### ExercisesExercises

#### 1.

Q1: Given the following, what value is stored in variable alpha?
int a = 0, b = 1, c = 2, d = 3, alpha;
alpha = ++a + b--;


#### 2.

Q2: Given the following, what value is stored in variable beta?
int a = 0, b = 1, c = 2, d = 3;
int alpha, beta;


#### 3.

Q3: Given the following, what value is stored in variable gamma?
int a = 0, b = 1, c = 2, d = 3;
int gamma;


#### 4.

Q4: Given the following, what value is stored in variable detla?
int a = 0, b = 1, c = 2, d = 3, delta;
delta = (d / c)++ - (a % ++b);

• 1.5
• 2.5
• 1
• 2
• Compiler error - will not compile

#### 5.

Q5: Which of the following are syntactically valid ways to increment the value of eta by one? Select all that apply.
• eta++;
• eta + 1;
• ++eta;
• ++eta--;
• eta = eta + 1;