NEW
Font size
WorksheetsPython L2 Concepts
Total questions: 40
Worksheet time: 27mins
IDE stands for:
Installed Development Engine
Installed Development Environment
Integrated Development Engine
Integrated Development Environment
What is a debugger?
A tool that assists you in figuring out what a certain error means
A tool that lets you step through your code line-by-line to see where errors may be occurring
A tool that helps you to remove bugs by highlighting any lines that you may want to revise
A tool that helps you to catch errors sooner by modifying your text color scheme to make important words more visible
What is the Python Package Index?
A tool for installing packages in python
An IDE similar to Thonny
A source for python modules and libraries
A ranking of the best available packages for a certain purpose
The order to define colors in Pygame is
(RED, BLUE, YELLOW)
(RED, GREEN, BLUE)
(BLUE, RED, GREEN)
(RED, YELLOW, BLUE)
Which Pygame function is used to set the window size?
pygame.display.set_mode()
pygame.display.set_screen()
pygame.display.screen_size()
pygame.display.set_size()
In Pygame, how do we tell the program to display any changes we made this frame?
pygame.screen.update()
pygame.display.update()
update(pygame.display)
pygame.update.display()
Which of these functions is required to close pygame correctly?
pygame.quit()
pygame.exit()
pygame.stop()
No function required
Which is the proper way to draw a circle in pygame?
new_cir = pygame.Circle(radius, x_position, y_position, color)
pygame.draw.circle(screen, color, (x_position, y_position), radius)
new_cir = pygame.Circle(radius, (x_position, y_position), color)
pygame.draw.circle(screen, color, x_position, y_position, radius)
Why do we use comments when writing code?
To make a function run the correct way
To pass in parameters to a function
To label and explain what the code is doing
To remove code that we no longer need
How do we add a title to the window of pygame?
pygame.display.set_caption("Title")
pygame.display.title = "Title"
screen.set_caption("Title")
screen.set_title("Title")
pygame.QUIT and pygame.MOUSEBUTTONDOWN are types of:
functions
return variables
events
classes
Which is the proper way to define a rectangle in pygame?
new_rect = pygame.Rect(x_positon, y_position, width, height)
new_rect = pygame.Rect((x_positon, y_position), (width, height))
new_rect = pygame.Rect((width, height), (x_positon, y_position))
new_rect = pygame.Rect(width, height, x_positon, y_position)
To make a line appear when we hold down the mouse button in pygame, we:
Draw a circle at the location of the click event on every frame.
Clear the previous shapes by filling the screen black, then draw a circle at the location of the click event on every frame.
Draw a circle at the location of the mouse on every frame until the mouse button is released.
Clear the previous shapes by filling the screen black, then draw a circle at the location of the mouse on every frame until the mouse button is released.
If I want to load the file image.png as a picture into pygame, which of these should I use?
screen.load_image('image.png')
pygame.image.load('image.png')
screen.blit('image.png', button)
'image.png'.load()
Which code draws an image on the screen?
pygame.draw.image(screen, my_image, image_rect)
pygame.draw.rect(screen, image_rect, my_image)
screen.blit(my_image, image_rect)
screen.blit(image_rect, my_image)
Which is correct about images in pygame?
Images are drawn to the screen at a fixed size of 128 by 128 pixels, and we can use pygame.image.set_icon() to change this size
Images will be drawn to the screen as their original size, and we can use pygame.transform.scale() to change this size
Images with transparent backgrounds will be drawn with a white background instead
Images with white backgrounds will be drawn with transparent backgrounds instead
Clock.tick(var) limits the _______.
frames per second
time per frame
size of the clock text
volume of the clock tick.
Which is the correct code for getting the position of the mouse?
pygame.mouse.get_pos()
pygame.mouse.get_position()
pygame.get_input.mouse_position()
pygame.mouse.position
What is the pygame clock used for?
The clock tells us the current system time of our computer, which is nice for UI or time-based games
The clock is used to create countdown timers and control the framerate of animations
The clock controls how much processing power is allowed to be used to run the pygame window
The clock is set to ensure that the game doesn't freeze unexpectedly
How can we make a pong bumper move up and down the screen when the user moves the mouse?
Keep the y position constant, and have the x position follow the x position of the ball
Keep the x position constant, and have the y position follow the y position of the ball
Keep the y position constant, and have the x position follow the x position of the mouse
Keep the x position constant, and have the y position follow the y position of the mouse
When we ____ an inherited method, we redefine the method in the child class and change it so that it does something different than the method defined in the parent class.
interpret
outsource
adapt
override
Which of these is NOT a pygame event?
MOUSEBUTTONDOWN
KEYDOWN
QUIT
CREATE
How do we access code that is written on a separate python file?
Download the file containing the code you want to use
Import the file containing the code you want to use
Include the path to the file containing the code you want to use
You can't use multiple files in the same python program
How would we define a class called Dog that inherits from Animal?
class Dog inherits from Animal:
def Dog(parent Animal):
class Dog(Animal):
class Animal(Dog):
API stands for:
Application Programming Interface
Asset Programming Interface
Adjustable Processing Interface
Application Processing Interface
The purpose of an API is:
to process information
to standardize requests between clients and servers
to store data in the client computer
to build applications
API’s generally return information using
Python
JSON
SQL
HTTP
JSON stands for:
JavaScript Oriented Notation
Java Set Object Network
JavaScript Object Notation
Java Set Oriented Notation
Python dictionaries are most similar to
Python strings and integers
Python lists and JSON key-value pairs
Python loops and conditional statements
HTTP requests and response codes
What does HTTP stand for?
Hasty Telecommunication Trading Process
Hyperlink Text Transfer Process
Hypertext Transfer Protocol
Handler for Trading Text Promptly
Which of these HTTP responses means OK?
200
404
500
504
Which will request data from the server and access a web page?
POST
TRACE
CONNECT
GET
GET, HEAD, and POST are examples of
commands
HTTP responses
python constants
HTTP requests
The value of a dictionary item can be:
A string or number
A list
Another dictionary
A dictionary item's value can be any of this things
The key of a dictionary item can be:
A string or number
A list
Another dictionary
A dictionary item's key can be any of this things
Which of these HTTP responses means Not Found?
200
404
500
504
Which character separates a key from its value in a dictionary?
; (semicolon)
: (colon)
, (comma)
_ (underscore)
Which character separates key-value pairs in a dictionary?
; (semicolon)
: (colon)
, (comma)
_ (underscore)
Which statement describes how HTTP functions?
The client sends a response, then the server returns a request
The client sends a request, then the server returns a response
The server sends a response, then the client returns a request
The server sends a request, then the client returns a response
What are some of the benefits of using multiple files?
More modular, reusable code that is easier to read
More condensed, simplified code that takes less time to write
More efficient code that runs faster
More powerful, capable code
