CS 235A Quiz #1: Page 1 of 4
COSC235 Spring 2007
Test #2
Please read each question carefully and be sure to give complete answers. Work quickly
and good luck!
1. (1 pt.) Print your name: ___________________________________________
2. (9 pts.) Given that x10 is 10 and y3 is 3, what is the value of x10 after each statement
is executed? Assume each part is independent of the preceding parts.
a) x10 %= y3
b) x10 += 2 + x10 / y3
c) x10 -= x10 * 3 – 4
3. (6 pts.) Write an update operator that will
a) add y to x. E.g., if x is 2 and y is 3, x becomes 5.
b) triple the value of x and add five to it. E.g., if x is 10, then x becomes 35.
4. (9 pts.) For each of the following, give the result or explain why the action is illegal:
a) a = 1, 2, 3
b) b = (1, 2, 3)
b[3 ] = 4
c) (a, b) = 5
5. (4 pts.) What command do you execute to load the graphics library in Python?