wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Data Structures & Statements

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.

list1= [ 1,5]

list1=list1.append(6)

list1

a)

[1,5,6]

b)

[1,6]

c)

None

d)

Error

2.

list1=[1,2,3,4,5]

popped=list1.pop[0]

list1.append(popped)

list1

The Output will be ..........

a)

[2,3,4,5,1]

b)

[1,2,3,4,5]

c)

Error

3.

p='123456789'

p[ : : 7]

a)

18

b)

'17'

c)

19

d)

None of the Above

4.

g= 1<3>2

k= 1<5 and 5 >2

y= g and k

y

a)

True

b)

False

c)

Error

d)

Mohamed Mounir

5.

Strings and lists has a common point both are .....

a)

immutable

b)

mutable

c)

mapping

d)

sequence

6.

Which of the following are true of Python dictionaries:

a)

Items are accessed by their position in a dictionary.

b)

Dictionaries are accessed by key.

c)

Dictionaries can be nested to any depth.

d)

A dictionary can contain any object type except another dictionary.

e)

Dictionaries are mutable.

7.

d = {'foo': 100, 'bar': 200, 'baz': 300}


d['bar':'baz']

a)

(200, 300)

b)

It raises an exception

c)

[200, 300]

d)

200 300

8.

input_list = ['a', 'b', 'c']

','.join(input_list)

a)

'abc'

b)

'a,b,c'

c)

'a','b','c'

d)

'a b c'

9.


a)

6

b)

24

c)

120

d)

5

10.
a)

4

b)

1

2

4

c)

It doesn’t generate any output.

d)

1

2

3

4

11.
a)

black

white

yellow

blue

Done

b)

red

blue

yellow

Done

c)

black

white

blue

Done

d)

black

white

yellow

Done