• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

BMS Processing Class

A Course23.com Production

"Stop, Pause, and Think..." -- Ms. Elwell
"Take your time, it isn't a race" -- Mr. Helmke

  • Home
  • Graphing and Color
    • Graphing Shapes
      • Activity 1
      • Activity 2
    • Color (R,G,B) and Grey Scale
      • Activity 3
      • Activity 4
  • Code and Sketches
    • Parts of Code
      • Activity 5
    • Your Code & OpenProcessing Sketches
      • Activity 6
      • Activity 7
  • Variables, etc
    • Variables
      • Activity pre8 and 8
      • Activity 8.1
      • Activity 9
      • Activity 10
      • Activity 11
      • Activity 11.1
    • Operator Precedence
      • Activity 12
      • Activity 13
    • Random
      • Activity 14
      • Activity 15
  • Conditionals – If, Else, Else If
  • Resources

Activity 13

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// 1. Given the following code:
 
var x = 2;
var y = 3;
var z = 4;
var q;
 
x = y + z;
y = x - z;
z = x + y;
z = z - y + x;
 
// Answer and show your work:
 
// 1a. What is the final value of x:
// 1b. What is the final value of y:
// 1c. What is the final value of z:
 
// 2. Given the following code:
 
var x = 10;
var y = 10;
var z = 20;
var r;
 
x = x + y;
r = y + z;
r = r - z;
y = r + x;
 
// Answer and show your work:
 
// 2a. What is the final value of x:
// 2b. What is the final value of y:
// 2c. What is the final value of r:
 
 
// 3. Given the following code:
 
var x = 20;
var y = 30;
 
x = x + y; // (a)
y = x - y;
x = x - y; // (b)
 
// Answer and show your work:
 
// 3a. What is the value of x at (a):
// 3b. What is the final value of y:
// 3c. What is the value of x at (b):
 
// 4. Given the following code:
 
var x = 10;
var y = 20;
var z = 30;
var r, q;
 
r = y + z;
q = r;
r = r - x; // (a)
q = q + r;
 
// Answer and show your work:
 
// 4a. What is the value of r at (a):
// 4b. What is the final value of q:
 
// 5. Given the following code:
 
var x = 10;
var y = 20;
var z = 30;
 
y = y + x;
x = x + z;
z = 5;
y = y + x;
x = x + z;
 
// Answer and show your work:
 
// 5a. What is the final value of y:
// 5b. What is the final value of x:
 
// 6. Given the following code:
 
var x = 10;
var y = 30;
var z = 50;
var p, q;
 
q = z - x; // (a)
p = 10;
x = x + p;
p = z - x;
q = p + y; // (b)
 
// Answer and show your work:
 
// 6a. What is the value of q at (a):
// 6b. What is the final value of x;
// 6c. What is the final value of p:
// 6d. What is the value of q at (b):
 
// 7. Given the following code:
 
var x = 1;
var y = 2;
var z = 3;
var p, q;
 
p = z + y + x;   // (a)
q = (z * y) + x; // (b)
z = x;
p = z + y + x;   // (c)
q = (z * y) + x; // (d)
 
// Answer and show your work:
 
// 7a. What is the value of p at (a):
// 7b. What is the value of q at (b):
// 7c. What is the value of p at (c):
// 7d. What is the value of q at (d):

Go back to:  Operator Precedence

Primary Sidebar

Required Reading:

Course Coding Standards

Copyright © 2016–2021 Chris Elwell/Michael Helmke · This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License · Log in