wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python L2 Concepts

Total questions: 40

Worksheet time: 27mins

Name
Class
Date
1.

IDE stands for:

a)

Installed Development Engine

b)

Installed Development Environment

c)

Integrated Development Engine

d)

Integrated Development Environment

2.

What is a debugger?

a)

A tool that assists you in figuring out what a certain error means

b)

A tool that lets you step through your code line-by-line to see where errors may be occurring

c)

A tool that helps you to remove bugs by highlighting any lines that you may want to revise

d)

A tool that helps you to catch errors sooner by modifying your text color scheme to make important words more visible

3.

What is the Python Package Index?

a)

A tool for installing packages in python

b)

An IDE similar to Thonny

c)

A source for python modules and libraries

d)

A ranking of the best available packages for a certain purpose

4.

The order to define colors in Pygame is

a)

(RED, BLUE, YELLOW)

b)

(RED, GREEN, BLUE)

c)

(BLUE, RED, GREEN)

d)

(RED, YELLOW, BLUE)

5.

Which Pygame function is used to set the window size?

a)

pygame.display.set_mode()

b)

pygame.display.set_screen()

c)

pygame.display.screen_size()

d)

pygame.display.set_size()

6.

In Pygame, how do we tell the program to display any changes we made this frame?

a)

pygame.screen.update()

b)

pygame.display.update()

c)

update(pygame.display)

d)

pygame.update.display()

7.

Which of these functions is required to close pygame correctly?

a)

pygame.quit()

b)

pygame.exit()

c)

pygame.stop()

d)

No function required

8.

Which is the proper way to draw a circle in pygame?

a)

new_cir = pygame.Circle(radius, x_position, y_position, color)

b)

pygame.draw.circle(screen, color, (x_position, y_position), radius)

c)

new_cir = pygame.Circle(radius, (x_position, y_position), color)

d)

pygame.draw.circle(screen, color, x_position, y_position, radius)

9.

Why do we use comments when writing code?

a)

To make a function run the correct way

b)

To pass in parameters to a function

c)

To label and explain what the code is doing

d)

To remove code that we no longer need

10.

How do we add a title to the window of pygame?

a)

pygame.display.set_caption("Title")

b)

pygame.display.title = "Title"

c)

screen.set_caption("Title")

d)

screen.set_title("Title")

11.

pygame.QUIT and pygame.MOUSEBUTTONDOWN are types of:

a)

functions

b)

return variables

c)

events

d)

classes

12.

Which is the proper way to define a rectangle in pygame?

a)

new_rect = pygame.Rect(x_positon, y_position, width, height)

b)

new_rect = pygame.Rect((x_positon, y_position), (width, height))

c)

new_rect = pygame.Rect((width, height), (x_positon, y_position))

d)

new_rect = pygame.Rect(width, height, x_positon, y_position)

13.

To make a line appear when we hold down the mouse button in pygame, we:

a)

Draw a circle at the location of the click event on every frame.

b)

Clear the previous shapes by filling the screen black, then draw a circle at the location of the click event on every frame.

c)

Draw a circle at the location of the mouse on every frame until the mouse button is released.

d)

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.

14.

If I want to load the file image.png as a picture into pygame, which of these should I use?

a)

screen.load_image('image.png')

b)

pygame.image.load('image.png')

c)

screen.blit('image.png', button)

d)

'image.png'.load()

15.

Which code draws an image on the screen?

a)

pygame.draw.image(screen, my_image, image_rect)

b)

pygame.draw.rect(screen, image_rect, my_image)

c)

screen.blit(my_image, image_rect)

d)

screen.blit(image_rect, my_image)

16.

Which is correct about images in pygame?

a)

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

b)

Images will be drawn to the screen as their original size, and we can use pygame.transform.scale() to change this size

c)

Images with transparent backgrounds will be drawn with a white background instead

d)

Images with white backgrounds will be drawn with transparent backgrounds instead

17.

Clock.tick(var) limits the _______.

a)

frames per second

b)

time per frame

c)

size of the clock text

d)

volume of the clock tick.

18.

Which is the correct code for getting the position of the mouse?

a)

pygame.mouse.get_pos()

b)

pygame.mouse.get_position()

c)

pygame.get_input.mouse_position()

d)

pygame.mouse.position

19.

What is the pygame clock used for?

a)

The clock tells us the current system time of our computer, which is nice for UI or time-based games

b)

The clock is used to create countdown timers and control the framerate of animations

c)

The clock controls how much processing power is allowed to be used to run the pygame window

d)

The clock is set to ensure that the game doesn't freeze unexpectedly

20.

How can we make a pong bumper move up and down the screen when the user moves the mouse?

a)

Keep the y position constant, and have the x position follow the x position of the ball

b)

Keep the x position constant, and have the y position follow the y position of the ball

c)

Keep the y position constant, and have the x position follow the x position of the mouse

d)

Keep the x position constant, and have the y position follow the y position of the mouse

21.

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.

a)

interpret

b)

outsource

c)

adapt

d)

override

22.

Which of these is NOT a pygame event?

a)

MOUSEBUTTONDOWN

b)

KEYDOWN

c)

QUIT

d)

CREATE

23.

How do we access code that is written on a separate python file?

a)

Download the file containing the code you want to use

b)

Import the file containing the code you want to use

c)

Include the path to the file containing the code you want to use

d)

You can't use multiple files in the same python program

24.

How would we define a class called Dog that inherits from Animal?

a)

class Dog inherits from Animal:

b)

def Dog(parent Animal):

c)

class Dog(Animal):

d)

class Animal(Dog):

25.

API stands for:

a)

Application Programming Interface

b)

Asset Programming Interface

c)

Adjustable Processing Interface

d)

Application Processing Interface

26.

The purpose of an API is:

a)

to process information

b)

to standardize requests between clients and servers

c)

to store data in the client computer

d)

to build applications

27.

API’s generally return information using

a)

Python

b)

JSON

c)

SQL

d)

HTTP

28.

JSON stands for:

a)

JavaScript Oriented Notation

b)

Java Set Object Network

c)

JavaScript Object Notation

d)

Java Set Oriented Notation

29.

Python dictionaries are most similar to

a)

Python strings and integers

b)

Python lists and JSON key-value pairs

c)

Python loops and conditional statements

d)

HTTP requests and response codes

30.

What does HTTP stand for?

a)

Hasty Telecommunication Trading Process

b)

Hyperlink Text Transfer Process

c)

Hypertext Transfer Protocol

d)

Handler for Trading Text Promptly

31.

Which of these HTTP responses means OK?

a)

200

b)

404

c)

500

d)

504

32.

Which will request data from the server and access a web page?

a)

POST

b)

TRACE

c)

CONNECT

d)

GET

33.

GET, HEAD, and POST are examples of

a)

commands

b)

HTTP responses

c)

python constants

d)

HTTP requests

34.

The value of a dictionary item can be:

a)

A string or number

b)

A list

c)

Another dictionary

d)

A dictionary item's value can be any of this things

35.

The key of a dictionary item can be:

a)

A string or number

b)

A list

c)

Another dictionary

d)

A dictionary item's key can be any of this things

36.

Which of these HTTP responses means Not Found?

a)

200

b)

404

c)

500

d)

504

37.

Which character separates a key from its value in a dictionary?

a)

; (semicolon)

b)

: (colon)

c)

, (comma)

d)

_ (underscore)

38.

Which character separates key-value pairs in a dictionary?

a)

; (semicolon)

b)

: (colon)

c)

, (comma)

d)

_ (underscore)

39.

Which statement describes how HTTP functions?

a)

The client sends a response, then the server returns a request

b)

The client sends a request, then the server returns a response

c)

The server sends a response, then the client returns a request

d)

The server sends a request, then the client returns a response

40.

What are some of the benefits of using multiple files?

a)

More modular, reusable code that is easier to read

b)

More condensed, simplified code that takes less time to write

c)

More efficient code that runs faster

d)

More powerful, capable code