wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PYTHON

Total questions: 22

Worksheet time: 11mins

Name
Class
Date
1.

Pick the odd man out

a)

import

b)

pass

c)

break

d)

continue

2.

List is represented by

a)

{ }

b)

[ ]

c)

( )

d)

< >

3.

Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?

a)

[3, 4, 5, 20, 5, 25, 1, 3]

b)

[1, 3, 3, 4, 5, 5, 20, 25]

c)

[3, 5, 20, 5, 25, 1, 3]

d)

[1, 3, 4, 5, 20, 5, 25]

4.

List is Mutable

a)

YES

b)

NO

5.

A reserved keyword may not be chosen as an identifier

a)

True

b)

False

6.

Which operator is called as equality operator?

a)

- *

b)

==

c)

- +

d)

=

7.

Python ____________ holds key-value pairs.

a)

Set

b)

Tuple

c)

Dictionary

d)

List

8.

Which keyword is use for function?

a)

define

b)

fun

c)

def

d)

function

9.

mylist = ["apple", “Orange", "cherry"]

x = len(mylist)

What is the value of x?

a)

2

b)

4

c)

1

d)

3

10.

List = [1, 2, 3, 1, 2, 1, 2, 3, 2, 1]

print(List.count(1))

a)

4

b)

3

c)

2

d)

1

11.

What is a recursive function?

a)

A function that calls other function

b)

A function which calls itself.

c)

Both A and B

d)

None

12.

List = [2.3, 4.445, 3, 5.33, 1.054, 2.5]

print(List.pop(0))

Which value will be popped out?

a)

2.5

b)

2.3

c)

3

d)

None

13.

Which one of the following is the correct way of calling a function?

a)

function_name()

b)

call function_name()

c)

ret function_name()

d)

function function_name()

14.

Which operator is used to perform mod operation?

a)

%

b)

*

c)

+

d)

&

15.

Lambda is a function in python?

a)

Yes

b)

No

16.

What is a variable defined outside a function referred to as?

a)

local variable

b)

global variable

c)

static Variable

d)

automatic variable

17.

__________ is a general-purpose array-processing package

a)

NumPy

b)

exception

c)

ArrayNum

d)

NumPython

18.

Which of the following statements is not related to list?

a)

[ ]

b)

unmutable

c)

mutable

d)

Dynamic array

19.

Type code for Int in array concept

a)

f

b)

i

c)

int

d)

num

20.

n = 10

sum = 0 i = 1

while i <= n:

sum = sum + i

i = i+1

print("The sum is", sum)

What is the Result?

a)

55

b)

45

c)

100

d)

200

21.

Pick odd man out

a)

set

b)

tuple

c)

list

d)

array

22.

The ____________ statement is a null statement

a)

pass

b)

asert

c)

break

d)

continue