# Subgoals

## Section1.22Assessment: Pre/Post Operators

### Subsection1.22.1Subgoals for evaluating an assignment statement

1. Determine resultant data type of expression
2. Update variable for pre-increment or pre-decrement operators (side effect)
3. Evaluate arithmetic expression according to operator precedence
4. If an assignment statement (=), is Left Hand Side (LHS) a variable? Check data type of value against data type of variable.
5. Update variable for post-increment or post-decrement operators (side effect)

### Exercises1.22.2Exercises

#### 1.

Q1: Given the following, what value is stored in variable alpha?

#### 2.

Q2: Given the following, what value is stored in variable beta?

#### 3.

Q3: Given the following, what value is stored in variable 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;