Worksheets6th August
Total questions: 30
Worksheet time: 15mins
What does pygame.display.set_mode((width, height)) do?
Sets the game's FPS
Opens a window with given dimensions
Fills the screen with color
Initializes the game engine
What is the use of pygame.display.set_caption("Title")?
Changes font of text
Sets the title of the game window
Adds title to a sprite
Creates a text label
What does pygame.Rect(x, y, width, height) create?
A rectangle shape
A clock
A button
A sprite
What is the role of pygame.time.Clock()?
Returns system time
Creates a timer for FPS control
Displays current date
Checks keypress duration
Which function retrieves events like keypresses or mouse clicks?
pygame.wait()
pygame.event.get()
pygame.key.get()
pygame.handle()
What is event.type == pygame.QUIT used for?
Detects mouse clicks
Detects keypresses
Checks if window is closed
Stops drawing
What does pygame.quit() do?
Quits Python
Closes the Pygame window and uninitializes modules
Stops music
Restarts game
Which function is used to check multiple keys being held down?
key.get()
pygame.key.get_pressed()
key.is_down()
pygame.key.get()
What does screen.fill((0, 0, 0)) do?
Paints a black background
Clears text
Loads image
Fills font
What does pygame.draw.rect(screen, color, rect) do?
Fills screen with color
Draws a rectangle
Detects collision
Rotates an image
What is the purpose of rect.colliderect(other_rect)?
Fills the rect
Checks for collision
Moves rect
Changes color
What is screen.blit(image, (x, y)) used for?
Create buttons
Fill text
Draw images/surfaces
Set screen size
What does font.render("Hello", True, color) return?
Font object
Rendered text surface
String output
Color image
What is the purpose of pygame.time.delay(ms)?
Delay key press
Waits for a specified time in milliseconds
Pause font rendering
Syncs frame rate
Which method updates the Pygame display?
refresh()
flip()
pygame.display.update()
screen.update()
What does clock.tick(60) control?
Game resolution
Frame rate (FPS)
Keyboard speed
Sound delay
Which method loads a system font?
pygame.font.SysFont()
pygame.font.load()
pygame.font.open()
pygame.font.ttf()
What does rect.y += 5 do?
Moves rect left
Moves rect up
Moves rect down
Stretches rect
What does rect.x -= speed do?
Moves rect left
Moves rect right
Increases size
Resets position
What happens if rect.bottom >= screen_height?
The rect bounces
Rect goes off screen
Rect hits bottom edge
Nothing
Which method draws a line in Pygame?
draw.line()
pygame.line()
pygame.draw.line()
line.draw()
What happens if pygame.K_UP is detected?
Player moves right
Player jumps or moves up
Game ends
Image is loaded
Which parameter in font.render() enables anti-aliasing?
True
False
1
None
What is the output of print(pygame.key.get_pressed())?
Current mouse position
A list of key states (pressed/unpressed)
Key name
None
Which of the following is required before rendering text?
Load music
Load font using SysFont()
Call tick()
Check for events
What does rect.centery return?
Width of the rect
Y-coordinate of center of rect
Center of screen
Top of rect
What is the purpose of rect.top?
Height of the rect
Top coordinate of the rect
Center position
Text value
Which surface method displays an image or text on screen?
write()
blit()
show()
put()
What does pygame.font.Font(None, 36) do?
Uses system font
Loads custom font
Uses default font of size 36
Loads a bold font
What is required to update the Pygame screen continuously?
while loop
pygame.display.update()
pygame.event.get()
All of the above
