Skip to main content

Section 1.5 Evaluate Expressions-WE2-P1

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.5.1

For all given problems below indicate if the code is valid or invalid. Each problem is independent of the others (e.g. Question 2 does not depend on Question 1, only the “Given” code).

Subsection 1.5.2 Evaluate Expressions-WE2-P1

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

Exercises Exercises

1.
    Q11:
    gamma = beta + theta
    
  • valid
  • invalid
2.
    Q12:
    theta = 42
    
  • valid
  • invalid
3.
    Q13:
    rho = delta
    
  • valid
  • invalid
4.
    Q14:
    alpha = beta + delta
    
  • valid
  • invalid
You have attempted of activities on this page.