wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Programming Quiz

Total questions: 28

Worksheet time: 18mins

Name
Class
Date
1.

What is your name

4 lines
2.

What is the correct way to create a variable in Python?

a)

let x = 5

b)

int x = 5

c)

x = 5

d)

x := 5

3.

What will this code output?

a)

Hello World

b)

Hello+World

c)

HelloWorld

d)

Hello World (with space)

4.

What type of data is stored in this variable: x = "ICT"?

a)

Integer

b)

Boolean

c)

String

d)

Float

5.

What symbol is used to take user input in Python?

a)

read()

b)

scan()

c)

input()

d)

enter()

6.

Which of these is a Python keyword?

a)

var

b)

function

c)

if

d)

define

7.

What does the following code output?

print(10 // 3)

a)

3.33

b)

3

c)

4

d)

0

8.

What is the result of 5 ** 2 in Python?

a)

10

b)

25

c)

7

d)

2.5

9.

How do you write a comment in Python?

a)

-- this is a comment

b)

# this is a comment

c)

// this is a comment

d)

/* this is a comment */

10.

Which of the following is a correct if statement?

a)

if x == 5:

b)

if (x = 5)

c)

if x = 5:

d)

if x equals 5

11.

Which data type would be used to store True or False?

a)

Integer

b)

Float

c)

Boolean

d)

String

12.

What function is used to display output in Python?

a)

write()

b)

echo()

c)

print()

d)

say()

13.

What will be the value of y in this code?

x = 3
y = x + 2

a)

3

b)

2

c)

5

d)

x + 2

14.

Which of the following is a correct way to get input from a user and store it in a variable?

a)

name == input("Enter your name: ")

b)

input name = "Enter your name"

c)

name = input("Enter your name: ")

d)

input(name) = "Enter your name"

15.

What will the following code output?

print("5" + "6")

a)

11

b)

56

c)

Error

d)

5 + 6

16.

What is the correct way to convert a string "8" to an integer in Python?

a)

int("8")

b)

str(8)

c)

float("8")

d)

8 = int

17.

Who created the Python programming language?

a)

Dennis Ritchie

b)

Guido van Rossum

c)

James Gosling

d)

Elon Musk

18.

In which year was Python first released?

a)

1980

b)

1991

c)

2000

d)

2010

19.

Why is Python considered a beginner-friendly programming language?

a)

It uses a lot of symbols

b)

It is hard to install

c)

It has simple and readable syntax

d)

It requires complex setup

20.

Which of the following is a common use of Python?

a)

Web design only

b)

Data science and web development

c)

Video editing

d)

Text messaging

21.

What is one benefit of using Python?

a)

It's only for experts

b)

It's expensive to use

c)

It works on many platforms and is free

d)

It is used only for games

22.

What is IDLE in full

(a)  

23.

\n creates a line return in a string of text

a)
True
b)
False
24.

\t creates a new line

a)
True
b)
False
25.

\\ allows a backslash to appear in a string of text

a)
True
b)
False
26.

\" allows a speech mark to be used in a string of text

a)
True
b)
False
27.

Name this mathematical operator *

(a)  

28.

Which of the following is correct

a)

== equal to

b)

> less than

c)

!= not equal to

d)

>= greater than or equal to