wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

karan kishore

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

x = ['ab','cd']

print(list(map(list, x)))

a)

[ [‘a’, ‘b’], [‘c’, ‘d’]

b)

['ab','cd']

c)

[[‘a’,’c’],[‘b’,’d’]]

d)

[ [‘a’, ‘d’], [‘b’, ‘c’]]

2.

Find the most frequent value in a list

test = [1, 2, 3, 9, 2, 7, 3, 5, 9, 9, 9]

print(max(set(test), key = test._____))

a)

split

b)

sizeof

c)

count

d)

random

3.

A while is the what type of iteration?

a)

definite

b)

indefinite

c)

indeterminate

d)

discrimnent

4.

What will be the output of the following program?

L=['python','c++','java','c#']

for language in range(Len(L)):

print (language)

a)

Python, C++, Java, c#

b)

0, 1, 2, 3

c)

0, 1, 2, 3, 4

d)

Python, C++, Java

5.

What is the correct way to initialize a dictionary?

a)

D = {a-10, b-20, c-30}

b)

D = {‘a’-10, ‘b’-20, ‘c’-30}

c)

D = {a:10, b:20, c:30}

d)

D = {‘a’:10, ‘b’:20, ‘c’:30}

6.

Python invented by

(a)  

7.

Which error is encountered while accessing a position that is not present in a list?

a)

KeyError

b)

IndexError

c)

ValueError

d)

RuntimeError

8.

Why do we use functions?

a)

To improve readability.

b)

To reuse code blocks.

c)

For the ease of code debugging.

d)

All the above.