Skip to main content

Section 1.6 Evaluate Expressions-WE2-P2

Subgoals for evaluating an assignment statement.

  1. Decide order of operations
    1. Decompose as necessary
  2. Determine operator behavior based on operands
    1. Operator and operands must be compatible
  3. Solve arithmetic, expression, or operation
    1. Decompose as necessary

Subsection 1.6.1

For the assignment statements below, either give the new value of the assigned variable, or enter “invalid” if the statement would result in an error. Each problem is independent of the others (e.g. Question 2 does not depend on Question 1, only the “Given” code).

Subsection 1.6.2 Evaluate Expressions-WE2-P2

Given
alpha = 2
beta = 1
delta = '3.0'
theta = -1.3

Exercises Exercises

1.
Q15: What is the value of gamma?
gamma = beta + alpha
2.
Q16: What is the value of rho?
rho = alpha + theta
3.
    Q17:
    alpha = delta
    
    What type of value is stored in alpha?
  • Number (integer)
  • String
  • Number (double)
  • This is an invalid operation
You have attempted of activities on this page.