Quiz 7a / Quiz 7b
Graded Quiz • 30 min Quiz14 Questions Week 3
Re⥃askly Logo

Quiz 7a / Quiz 7b

Graded Quiz • 30 min Quiz14 Questions Week 3
Practice More Quizzes:
Quiz
08 Questions Week 1
Quiz
08 Questions Week 1
Quiz
08 Questions Week 2
Quiz
14 Questions Week 3
Quiz
07 Questions Week 4

Q:

Consider the provided ImageInfo and Sprite class code. Assume we want ten asteroids on the screen, each looking exactly alike and using the same image file. How many mageInfo objects and how many Sprite objects should we create?

Q:

What is the supported range of sound volumes in set_volume?

Q:

Assume you have code that loads and plays a sound. Unfortunately, you don’t hear anything. Which of the following could be a reason?

Q:

Which of the following are valid HTML representations of the color blue?

Q:

Imagine we are writing code for something like Rice Rocks, where things are moving in 2D toroidal space, i.e., the wrap around all four sides of the screen. How can we eliminate the duplicated code in the following function? def move(position, vector): “””Moves the position by the given vector in 2D toroidal space.””” position[0] = (position[0] + vector[0]) % SCREEN_SIZE[0] position[1] = (position[1] + vector[1]) % SCREEN_SIZE[1]

Q:

What is Mike Massimino’s greatest accomplishment?

Q:

What is the primary reason for not duplicating code? It was the only reason mentioned in the Programming Tips #7 video.

Q:

Let’s define a class for 2-dimensional points. class Point2D: def __init__(self, x = 0, y = 0): self.x = x self.y = y def translate(self, deltax = 0, deltay = 0): “””Translate the point in the x direction by deltax and in the y direction by deltay.””” self.x += deltax self.y += deltay …Which of the following code snippets are valid usages of the Point2D initializer and its translate method?

Q:

Let’s continue to use the same class for 2-dimensional points. class Point2D: def __init__(self, x=0, y=0): self.x = x self.y = y def translate(self, deltax=0, deltay=0): “””Translate the point in the x direction by deltax and in the y direction by deltay.””” self.x += deltax self.y += deltay …Which of the following code snippets are valid usages of the Point2D initializer and its translate method?

Q:

Now, let’s make this class definition for 2-dimensional points more specific. class Point2D: def __init__(self, x=0, y=0): self.x = x self.y = y def translate(self, deltax=0, deltay=0): “””Translate the point in the x direction by deltax and in the y direction by deltay.””” self.x += deltax self.y += deltay def __str__(self): return “”For the Point2D class above, having only the three methods shown, which of the following code snippets are valid usages of the Point2D class?

Q:

in SimpleGUI, the function draw_image takes an optional sixth parameter that determines the angle of rotation of the destination rectangle around its center. Do positive values for the angle rotate the image clockwise or counterclockwise? Is the angle specified in degrees or radians?

Q:

Which of the following browsers fully support MP3 audio files?

Q:

One interesting extension of Rice Rocks would be to have two ships, with each controlled by a separate player, instead of one single ship. Using the provided class definitions, what is the best way to represent the two ships in this new variant?

Q:

Consider a spaceship where the ship’s thrusters can accelerate the ship by 10 pixels per second for each second that the thrust key is held down. If the friction induces a deceleration that is 10% of the ship’s velocity per second, what is the maximal velocity of the ship? If you are having trouble, consider writing a short program to help understand this problem.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Find Questions in This Page: "CTRL+F"