Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to Python Quiz

Total questions: 30

Worksheet time: 5mins

Name
Class
Date
1.

What is the primary purpose of Python in real-world applications?

a)

Data Analysis

b)

Game Development

c)

Web Development

d)

All of the above

2.

Which of the following is the first step in setting up Python?

a)

Installing Python

b)

Learning syntax

c)

Debugging code

d)

Writing a program

3.

What will the following code print? print('Hello, Universe!')

a)

Hello, universe

b)

Hello, Universe!

c)

hello, Universe!

d)

hello universe!

4.

How can you take user input in Python?

a)

read() function

b)

get() function

c)

input() function

d)

scan() function

5.

Which of the following is NOT a Python data type?

a)

complex

b)

char

c)

float

d)

int

6.

What type of data does the 'str' data type represent?

a)

Numeric values

b)

Textual data

c)

None of the above

d)

Boolean values

7.

Which of the following is a sequence type in Python?

a)

dict

b)

int

c)

list

d)

None of the above

8.

What is the output of the following code? print(type(3.14))

a)

<class 'int'>

b)

<class 'float'>

c)

<class 'str'>

d)

Error

9.

Which of the following is a mapping type in Python?

a)

dict

b)

tuple

c)

list

d)

range

10.

What is the purpose of the 'type' function in Python?

a)

To check the data type

b)

To create a variable

c)

To convert data types

d)

To assign datatype

11.

If you want to store multiple values in a single variable, which data type would you use?

a)

float

b)

list

c)

str

d)

int

12.

What will the following code return?

a='Hello World'

print(a[0:8])

a)

Hello Wor

b)

Hello Worl

c)

Hello W

d)

Hello Wo

13.

Which of the following is a correct way to declare a variable in Python?

a)

x==10

b)

var x = 10

c)

x := 10

d)

x = 10

14.

What is the output of the following code? print('Hello' + ' World!')

a)

Hello World

b)

HelloWorld!

c)

Hello World!

d)

Hello + World!

15.

Which of the following data types can store decimal numbers?

a)

complex

b)

str

c)

float

d)

int

16.

What is the result of the expression 5 + 3 * 2?

a)

16

b)

13

c)

11

d)

10

17.

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

a)

[]

b)

{}

c)

()

d)

<>

18.

What will the following code output? print('Hello, ' + input('Enter your name: '))

a)

Hello, [user input]

b)

Hello, Universe!

c)

Hello, World!

d)

Hello, name

19.

Which of the following is a characteristic of Python?

a)

None of the above

b)

Compiled language

c)

Interpreted language

d)

Static typing

20.

What is the purpose of the 'print()' function in Python?

a)

To define a variable

b)

To take user input

c)

To create a loop

d)

To display output

21.

Which of the following is a valid way to create a dictionary in Python?

a)

dict = {key: value}

b)

dict = [key: value]

c)

dict = (key: value)

d)

dict =

22.

What will the following code return? type([1, 2, 3])

a)

<class 'tuple'>

b)

<class 'set'>

c)

<class 'list'>

d)

<class 'int'>

23.

Which of the following is NOT a numeric type in Python?

a)

string

b)

complex

c)

int

d)

float

24.

What is the output of the expression 'Hello' * 3?

a)

3 Hello

b)

Hello + Hello + Hello

c)

Hello 3

d)

HelloHelloHello

25.

Which of the following statements is true about Python lists?

a)

Lists are immutable

b)

Lists can contain mixed data types

c)

Lists are defined using {}

d)

Lists cannot be nested

26.

What will the following code output? print(5 == 5)

a)

True

b)

False

c)

None

d)

Error

27.

Which of the following is a correct way to assign strings with multiple lines in a variable?

a)

" " " lines " " "

b)

' lines '

c)

" lines "

d)

" " lines " "

28.

What is the output of the following code? print(10 / 2)

a)

Error

b)

10

c)

2

d)

5

29.

Which of the following is a valid variable name in Python?

a)

first variable

b)

first-variable

c)

1st_variable

d)

first_variable

30.

What will the following code output? print('Hello' + str(5))

a)

Hello5

b)

Hello 5

c)

5Hello

d)

Error