wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Basics Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What will the following code output? print("Hello, World!")

a)

Hello

b)

Hello World

c)

Hello, World!

d)

"Hello, World!"

2.

Which of the following is the correct way to 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

3.

What will be printed? print("3 + 2 =", 3 + 2)

a)

3 + 2 = 3 + 2

b)

3 + 2 = 32

c)

3 + 2 = 5

d)

Error

4.

Which of the following is NOT a correct Python data type?

a)

list

b)

float

c)

string

d)

decimal

5.

What is the result of this code? print("Result:", 5 * "2")

a)

Result: 10

b)

Result: 22222

c)

Result: 2*5

d)

Error

6.

What is the correct way to print the following text including quotes? She said, "Python is fun!"

a)

print('She said, "Python is fun!"')

b)

print("She said, "Python is fun!"")

c)

print(She said, "Python is fun!")

d)

print("She said, \"Python is fun!\"")

7.

What will be displayed? # This is a comment print("Hello")

# Another comment

a)

# This is a comment Hello # Another comment

b)

Hello

c)

This is a comment Hello Another comment

d)

Error

8.

Which code will cause an error?

a)

print(10)

b)

print("10")

c)

print(Hello)

d)

print("Hello")

9.

What is the data type of the variable x? x = 10.0

a)

int

b)

float

c)

double

d)

decimal

10.

What will the following code output?

print("abcdefg") print() print("jklmnop")

a)

abcdefg jklmnop

b)

abcdefg

jklmnop

c)

abcdefg-jklmnop

d)

D. Error