wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PPS PYTHON QUIZ

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

Who developed the Python language?

a)

Zim Den

b)

Guido van Rossum

c)

Niene Stom

d)

Wick van Rossum

2.

What do we use to define a block of code in Python language?

a)

Key

b)

Brackets

c)

Indentation

d)

None of these

3.

Which character is used in Python to make a single line comment?

a)

/

b)

//

c)

#

d)

!

4.

Which of the following statements is correct regarding the object-oriented programming concept in Python?

a)

Classes are real-world entities while objects are not real

b)

Objects are real-world entities while classes are not real

c)

Both objects and classes are real-world entities

d)

All of the above

5.

Study the following function:

any([5>8, 6>3, 3>1])  

a)

False

b)

True

c)

Invalid code

d)

None of these

6.

Study the following code:

>>>"javatpoint"[5:]  

a)

javatpoint

b)

java

c)

point

d)

None of these

7.

Study the following program:

i = 1:  

while True:  

    if i%3 == 0:  

        break  

    print(i)  

a)

1 2 3

b)

3 2 1

c)

1 2

d)

Invalid syntax

8.

Which of the following option is not a core data type in the python language?

a)

Dictionary

b)

Lists

c)

Class

d)

All of the above

9.

Which of the following data types is shown below?

a)

Dictionary

b)

Tuple

c)

List

d)

Stack

10.

Study the following program:

print(print(print("javatpoint")))    

a)

javatpoint None None

b)

None None javatpoint

c)

None javatpoint None

d)

Javatpoint

11.

Study the following program:

a = '1 2'  

print(a * 2)  

print(a * 0)  

print(a * -2)  

a)

1 2 1 2

b)

2 4

c)

0

d)

-1 -2 -1 -2

12.

Study the following expression:

str = [(1, 1), (2, 2), (3, 3)]  

What type of data is in this expression?

a)

String type

b)

Array lists

c)

List of tuples

d)

str lists

13.

Which of the following code will create a set in python language?

1. thisset = (("apple", "banana", "cherry"))

2. thisset = ("car", "bike", "123")

3. thisset = {}

a)

1 only

b)

1 and 2 both

c)

1, 2, and 3 will create a set

d)

None of the these

14.

Which of the following statements would create a tuple in python?

a)

mytuple = ("apple", "banana", "cherry")

b)

mytuple[123] = ("apple", "banana", "cherry")

c)

mytuple = ("2" * ("apple", "banana", "cherry"))

d)

None of the these

15.

To add a new element to a list we use which Python command?

a)

list1.addEnd(5)

b)

list1.addLast(5)

c)

list1.append(5)

d)

list1.add(5)

16.

What will be the output of the following Python code?

>>>list1 = [1, 3]

>>>list2 = list1

>>>list1[0] = 4

>>>print(list2)

a)

[1, 4]

b)

[1, 3, 4]

c)

[4, 3]

d)

[1, 3]

17.

What will be the output of the following Python code snippet?

z=set('abc$de') 'a' in z

a)

Error

b)

True

c)

False

d)

No output

18.

What will be the output of the following Python code?

>>> str1 = 'hello'

>>> str2 = ','

>>> str3 = 'world'

>>> str1[-1:]

a)

olleh

b)

hello

c)

h

d)

o

19.

What is the purpose of NumPy in Python?

a)

To do numerical calculations

b)

To do scientific computing

c)

Both A and B

d)

None of the mentioned above

20.

NumPy arrays can be ___.

a)

Indexed

b)

Sliced

c)

Iterated

d)

All of the mentioned above