You are on page 1of 2

SENIOR CODING

PRACTICE 1 (LESSONS 1)

ANSWERS
Please record your answers here for the questions below:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

QUESTIONS
Fill in the blank

1. The single most important skill for a computer scientist is ____________.

2. A ________ is a sequence of instructions that specifies how to perform a


computation.

3. A ________ language is one that is designed to be easy for humans to read and
write.

4. A ________ error in a program makes it do something other than what the


programmer intended.

Multiple Choice:

5. Select the following variable names which are both legal and follow expected Python
naming conventions.

a. trombones_76 = 'big parade'


b. lambda = 0.12
c. Answer = 42
d. myFirstString = “remember your towel”
e. float5 = 3.14159

6. Select the equation(s) below which evaluate to 42. Hint: Pay attention to PEMDAS
and type.

a. (4 + 8) * (6.5 – 3)
b. (1 + 2)**(5 – 2) + 5 * 3
c. 2**3 * 3**2 + 6 + 4/2
d. (1 + 2)**3 + (5 – 1) * 3 + 4 – 1
e. 3 * 7 + 6/2 * (4 +3)

Practice using the Python interpreter:

7. The equation to calculate the volume of a cone with height h and radius r is
1 2
V = π r h. What is the volume of a cone with a radius of 2 and a height of 3 to two
3
decimal places? Use 3.14 for the value of π .

8. A group of 266 persons consists of men, women, and children. There are four times
as many men as children, and twice as many women as children. How many children
are there?

9. If the sum of three consecutive numbers is 72, what is the largest number?

10. What is the value of x after the following statements are executed?
x = 'py'
x += 'thon'
y = z = '42'
x += y + z
x *= 2

Copyright
These course materials have been adapted from Allen B. Downey’s Think Python, 2nd edition
(http://greenteapress.com/wp/think-python-2e/)

Permission is granted to copy, distribute, and/or modify the course materials under the terms of the Creative
Commons Attribution-Non Commercial 3.0 Unported License, which is available at
http://creativecommons.org/licenses/by-nc/3.0/.

You might also like