wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

python pygame

Total questions: 44

Worksheet time: 29mins

Name
Class
Date
1.

Pygame library

2 lines
2.

What is Pygame?

a)

Pygame is a programming language.

b)

Pygame is a software for editing images.

c)

Pygame is a type of puzzle game.

d)

Pygame is a set of Python modules used to create video games.

3.

Which of the following is the correct way to install Pygame?

a)

pip install pygam

b)

pip install pygame

c)

pip install pygame

d)

pip install pygames

4.

What is the first step to create a game window in Pygame?

a)

Import the pygame module

b)

Create a game loop

c)

Install the pygame module

d)

Define the game window size

5.

Which module is used to connect the Pygame library?

a)

pygame.connect

b)

pygame.library

c)

pygame

d)

pygame.module

6.

What is the purpose of the game loop in a Pygame application?

a)

To pause the game and display a game over message.

b)

To randomly generate game elements and obstacles.

c)

To display the game instructions and rules.

d)

To continuously update the game state, handle user input, and redraw the screen.

7.

Which function is used to update the display in Pygame?

a)

pygame.display.render()

b)

pygame.display.refresh()

c)

pygame.display.update()

d)

pygame.display.flip()

8.

What is the correct syntax to create a Pygame window with a width of 800 and height of 600?

a)

pygame.display.set_mode((600, 800))

b)

pygame.display.set_mode(800, 600)

c)

pygame.display.set_mode(800, 600, 0)

d)

pygame.display.set_mode((800, 600))

9.

Which module is used to handle keyboard and mouse events in Pygame?

a)

pygame.event

b)

pygame.controls

c)

pygame.interact

d)

pygame.input

10.

What is the purpose of the pygame.sprite module in Pygame?

a)

The pygame.sprite module in Pygame is used for rendering graphics in a game.

b)

The pygame.sprite module in Pygame is used for handling user input in a game.

c)

The pygame.sprite module in Pygame is used for handling audio in a game.

d)

The purpose of the pygame.sprite module in Pygame is to create and manage sprites in a game.

11.

Which function is used to quit the Pygame application?

a)

pygame.exit()

b)

pygame.close()

c)

pygame.quit()

d)

pygame.stop()

12.

Как называется библиотека (модуль), которая позволяет разрабатывать игры на Python

(a)  

13.

Какую функцию нужно использовать в начале программы, чтобы запустить pygame?

a)

pygame.init()

b)

pygame.__init__()

c)

__init__()

d)

pygame()

14.

Как создать экран с определенным размером?

a)

pygame.screen(400, 400)

b)

pygame.display.set_mode((400, 400))

c)

screen = pygame.screen()

screen.size((400, 400))

d)

pygame.display.size((400, 400))

15.

Как создать прямоугольник?

a)

pygame.Rect(50, 50, 100, 200)

b)

pygame.Rectangle(50, 50, 100, 200)

c)

pygame.Pryamougolnik(50, 50, 100, 200)

d)

pygame.Sqrt(50, 50, 100, 200)

16.

Как создать бесконечный цикл?

a)

while True:

b)

while False:

c)

while beskonecho:

d)

for i in True:

17.

Какие точки нужно указать для создания прямоугольника с помощью функции Rect()?

a)

Верхняя левая

b)

Верхняя правая

c)

Нижняя левая

d)

Нижняя правая

18.

for event in pygame.event.get():

Для чего используется данный цикл?

a)

Для обработки событий

b)

Для начала игры

c)

Для отрисовки изображений

d)

Такой цикл в pygame не используется

19.

Как нарисовать прямоугольник?

a)

pygame.draw.rect(screen, color, r, 10)

b)

pygame.draw.line(screen, сщдщк, (100, 100), (200, 200), 10)

c)

pygame.draw.circle(screen, color, (200, 300), 30)

d)

pygame.draw.ellipse(screen, color, rect, 1)

20.

Как нарисовать линию?

a)

pygame.draw.rect(screen, color, r, 10)

b)

pygame.draw.line(screen, сщдщк, (100, 100), (200, 200), 10)

c)

pygame.draw.circle(screen, color, (200, 300), 30)

d)

pygame.draw.ellipse(screen, color, rect, 1)

21.

Как нарисовать эллипс?

a)

pygame.draw.rect(screen, color, r, 10)

b)

pygame.draw.line(screen, сщдщк, (100, 100), (200, 200), 10)

c)

pygame.draw.circle(screen, color, (200, 300), 30)

d)

pygame.draw.ellipse(screen, color, rect, 1)

22.

Как выбрать цвет из готового набора цветов pygame?

(a)  

23.
What will the output be from the following code?
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
24.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
25.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
26.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
27.
What will the output be from the following code?
Print("Hello world!")
a)
NameError
b)
Hello world!
c)
"Hello world"
d)
Print(Hello world!)
28.
What will the output be from the following code?
print("Hello" + "world" + "today")
a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
29.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
30.
What will the output be from the following code?
print(9/3)
a)
3
b)
3.0
c)
9/3
d)
SyntaxError
31.
Which function takes a users input
a)
print()
b)
int()
c)
input()
d)
def
32.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
33.
Which is the most appropriate data type for: "13th December"
a)
Float
b)
Boolean
c)
Integer
d)
String
34.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
35.

Which of the following is a command to have a message appear on the screen?

a)

print

b)

write

c)

msg

d)

input

36.

Pick the Python command used to let the user type in some data

a)

get

b)

input

c)

int

d)

float

37.

Which of the following is a Python command word used to indicate we want to work with WHOLE numbers

a)

input

b)

int

c)

float

d)

print

38.

Which of the following is a Python command word used to indicate we want to work with DECIMAL numbers

a)

input

b)

int

c)

float

d)

print

39.

Which of the following is a Python command word used to indicate we want to set up a fixed loop

a)

while

b)

print

c)

next

d)

for

40.

What would be printed by the command

print('12-5')

a)

12-5

b)

'12-5'

c)

7

d)

'7'

41.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
42.

Which of the following is used in Python to give a value to a variable

a)

:=

b)

==

c)

=

43.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
44.

How do you insert COMMENTS in Python code?

a)

/*this is a comment

b)

//this is a comment

c)

#this is a comment