Welcome to CMPT 120

i>clicker
i-clicker Session 2 – with Solutions
1
Question 1
What does hand tracing our code mean?
A. We select the Run option of the Python Program
Editor in order to execute our program.
B. We go through the statements of our program
“executing” it as if we were a computer.
C. We type each statement of our program on the
Python Interpreter Shell and observe what it
does.
D. All of the above
E. None of the above
2
Question 2
If I am solving the following problem:
Create a calculator
what would be the most descriptive and correct
variable names I could give to the data my program
is to remember and manipulate?
A.
B.
C.
D.
E.
result, x, 1_operator, y
result, x, operator, y
result, operand1, operator, operand2
All of the above
None of the above
3
Question 3
Consider the following Python code fragment:
numOfPens = 2
numOfPens = numOfPens + 1
numOfPens = numOfPens - 2
print( numOfPens )
What does it produce as a result?
A.
B.
C.
D.
E.
1
2
5
An error
None of the above
4
Question 4
Why do we hand trace our code?
A. To verify that our program is bug free.
B. To figure out what our program does.
C. To verify whether our program is solving
the problem.
D. All of the above
E. None of the above
5
Question 5
Consider the following Python code fragment:
numOfPens = 2
numOfPens = numOfPens + 1
numOfPens = numOfPens - 2
print( numofPens )
What does it produce as a result?
A.
B.
C.
D.
E.
1
2
5
An error
None of the above
6