wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

QUIZ-A-THON PYTHON LEVEL 1

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What will be the output of the following code? print(type(10))

a)

A)

b)

B)

c)

C)

d)

D)

2.

What is the correct way to create a variable x with the value 5 in Python?

a)

A) int x = 5

b)

B) x = int(5)

c)

C) x == 5

d)

D) x = 5

3.

What will be the output of the following code? x = [1, 2, 3] print(x[3])

a)

A) 3

b)

B) 1

c)

C) IndexError

d)

D) None

4.

What will be the output of the following code? print(bool(0))

a)

A) True

b)

B) False

c)

C) 0

d)

D) None

5.

Which of the following is used to create a comment in Python?

a)

A) // This is a comment

b)

B) # This is a comment

c)

C) /* This is a comment */

d)

D)

6.

What is the output of the following code? print("2" + "3")

a)

A) 5

b)

B) 23

c)

C) 6

d)

D) Error

7.

What does the len() function do in Python?

a)

A) Returns the length of a variable name

b)

B) Returns the length of an integer

c)

C) Returns the length of an object

d)

D) Returns the sum of all elements in a list

8.

Which of the following will result in a syntax error?

a)

A) print("Hello")

b)

B) 10 = x

c)

C) x, y = 5, 10

d)

D) print(10 + 5)

9.

What is the output of the following code? x = 10 y = 5 print(x > y and y < x)

a)

A) True

b)

B) False

c)

C) Error

d)

D) None

10.

Which of the following data types is immutable in Python?

a)

A) List

b)

B) Dictionary

c)

C) Tuple

d)

D) Set

11.

What will be the output of the following code? x = [1, 2, 3] y = x y.append(4) print(x)

a)

A) [1, 2, 3]

b)

B) [1, 2, 3, 4]

c)

C) None

d)

D) Error

12.

Which of the following is not a valid keyword in Python?

a)

A) try

b)

B) finally

c)

C) catch

d)

D) with

13.

What will be the output of the following code? print(5 / 2)

a)

A) 2

b)

B) 2.5

c)

C) 3

d)

D) Error

14.

How do you create an empty dictionary in Python?

a)

A) d = []

b)

B) d = ()

c)

C) d = {}

d)

D) d = dict{}

15.

What will be the output of the following code? print("Hello"[1])

a)

A) H

b)

B) e

c)

C) l

d)

D) Error

16.

What will be the output of the following code? print(2 ** 3)

a)

A) 6

b)

B) 8

c)

C) 9

d)

D) Error

17.

Which of the following will result in the same output? x = 10

a)

A) print(x == 10)

b)

B) print(x = 10)

c)

C) print(x = x + 10)

d)

D) print(x != 10)

18.

What is the output of the following code? x = "hello" print(x.upper())

a)

A) HELLO

b)

B) hello

c)

C) Error

d)

D) Hello

19.

Which of these is used to terminate a loop in Python?

a)

A) continue

b)

B) break

c)

C) return

d)

D) end

20.

What will be the output of the following code? print("Python"[-1])

a)

A) P

b)

B) n

c)

C) h

d)

D) Error