Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python GUI/Files Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which library is most commontly used for GUI development in python

a)

PyQt

b)

Tkinter

c)

kivy

d)

Pygame

2.

What is the main widget in Tkinter used to display text to the user

a)

Label

b)

Button

c)

Entry

d)

Text

3.

Which method is used to enter the main event loop in tkinter

a)

Start()

b)

run()

c)

mainloop()

d)

begin()

4.

How do you create a button in Tkiter?

a)

Button(root,text="clicck me",command=some_function)

b)

button(root,text="Clcik me")

c)

Tk.Button(root)

d)

CreateButton(root)

5.

What does the pack() method in Tkinter do?

a)

Centres the widgets in the window

b)

Sets the widget's size

c)

Places widgets in the window sequentially

d)

Deletes widgets

6.

What will the following code output when executed?

a)

A button that changes the label to "Button Clicked!" when pressed

b)

An error: command is not a valid argument

c)

A window with "Hello, World!" displayed, but the button does nothing

d)

No output as the GUI will not appear

7.

What will the following code output?

a)

An error because the file is not closed

b)

Hello, World!

c)

No output

d)

FileNotFoundError

8.

Which mode is used to open a file and add content on it?

a)

w

b)

r

c)

a

d)

w+

9.

What happens if you open a file in w mode and the file already exists?

a)

An error is raised

b)

The file is appended

c)

The file is overwritten

d)

The file is read-only

10.

What should replace X in the code below to save the text entered in the Entry widget into a new file?

a)

r

b)

w

c)

x

d)

a