Skip to main content

Section 1.17 Evaluate Expressions-WE8-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.17.1

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

Subsection 1.17.2 Expressions-WE8-P1

Given
x = 4
y = 6

Exercises Exercises

1.
    Q45:
    result = x < y
    
  • True
  • False
  • Invalid
2.
    Q46:
    result = x + 2 < y
    
  • True
  • False
  • Invalid
3.
    Q47:
    result = x != y
    
  • True
  • False
  • Invalid
4.
    Q48:
    result = x and (3 >= y)
    
  • True
  • False
  • Invalid
5.
    Q49:
    result = y == x
    
  • True
  • False
  • Invalid
6.
    Q50:
    result = y == x + 2
    
  • True
  • False
  • Invalid
7.
    Q51:
    result = 7 == 7
    
  • True
  • False
  • Invalid
8.
    Q52:
    result = 13 < 100
    
  • True
  • False
  • Invalid
9.
    Q53:
    result = -17.32 < -17.32
    
  • True
  • False
  • Invalid
10.
    Q54:
    result = '3' == 3
    
  • True
  • False
  • Invalid
11.
    Q55:
    result = '13' + 3 == 16
    
  • True
  • False
  • Invalid
12.
    Q56:
    result = -18 < -15
    
  • True
  • False
  • Invalid
13.
    Q57:
    result = 4.2 > 3.7
    
  • True
  • False
  • Invalid
14.
    Q58:
    result = 13 <= 13
    
  • True
  • False
  • Invalid
15.
    Q59:
    result = 0.012 > 0.013
    
  • True
  • False
  • Invalid
You have attempted of activities on this page.