2. What is the standard way to draw sprites in a program?
a) Call the sprite’s .blit(screen) method.
b) Call the sprite’s .draw(screen) method.
c) Call the sprite’s .update(screen) method.
d) Add a sprite to a group. Then call .draw(screen) on the group.
3. Select the best class definition for an alien:
a) class Alien():
def __init__(self):
self.name = “”
self.height = 7.2
self.weight = 156
b) class alien():
def __init__(self):
self.name = “”
self.height = 7.2
self.weight = 156
c) class alien.name = “”
class alien.height = 7.2
class alien.weight = 156
d) class alien(
def __init__(self):
self.name = “”
self.height = 7.2
self.weight = 156
)
4. What does this code do?
d1 = Dog()
d2 = Dog()
a) Creates two objects, of type Dog.
b) Creates two classes, of type Dog.
c) Creates one object, of type Dog.
5. What code will get the x and y position of the mouse?
a) pos = pygame.mouse.get_pos()
x = pos(x)
y = pos(y)
b) pos = pygame.mouse.get_pos()
x = pos[x]
y = pos[y]
c) pos = pygame.mouse.get_pos()
x = pos[0]
y = pos[1]
d) x = pygame.mouse.get_pos(x)
y = pygame.mouse.get_pos(y)
e) x = pygame.mouse.get_pos(0)
y = pygame.mouse.get_pos(1)
Tests answer keys:
Chapter 1:
8.d 9.a 10.d
Chapter 3:
1.d 2.d 3.b 4.a 5.c 6.b 7.a 8.a 9.d 10.d 11.b 12.a 13.c 14.d 15.b 16.b 17.a 18.d 19.c 20.c
Chapter 4:
1. d 2. d 3. a 4. a 5. c
GLOSSARY
A
Absolute Cell Reference – an absolute cell reference is one that does not change when it is copied.
Algorithm – a set of rules for solving a problem in a finite number of steps.
ASCII – a standard code, consisting of 128 7-bit combinations, for characters stored in a computer or to be transmitted between computers.
B
Binary number – number, expressed as 0 or 1.
BIt – also called binary digit. a single, basic unit of information, used inconnection with computers and information theory.
Bold – text that is darkened to help emphasize.
Bug – coding error in a computer program.
Byte – a group of bits, usually eight, processed as a single unit of data.
C
Cache – a temporary storage space or memory that allows fast access to
data.
Cell – a cell is a rectangular area formed by the intersection of a column
and a row.
Chart – a graphic representation, as by curves, of a dependent variable, as
temperature, price, etc.; graph.
Column – columns run vertically on the spreadsheet screen.
Compile – to translate (a computer program) from a high-level language into another language, usually machine language.