wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PYTHON ::04

Total questions: 17

Worksheet time: 9mins

Name
Class
Date
1.

What will be the output of the command?

>>> print("hi"*2)

a)

"hi""hi"

b)

hi*2

c)

hihi

d)

2 hi

2.

Mutable sequences can be used as keys in a Dictionary?

a)

True

b)

False

3.

To add an item in the dictionary d we need to do :

a)

d.append('new','value)

b)

d['new']='value'

c)

d.extend('new','value)

d)

d.update('new','value)

4.

Dictionary method __________ returns a list of key-value pairs.

a)

items

b)

keys

c)

value

d)

sizes

5.

>>> str ="hello"+1

output ??

a)

"hello1"

b)

"hello+1"

c)

"hello""1"

d)

Python throws a Type error

6.

Which Built-in types are mutable?

a)

List, strings, Dictionaries , sets

b)

List, strings, Dictionaries , sets , Tuples

c)

List, Dictionaries , sets

d)

List, strings , sets,tuples

7.

>>> name ="snow storm"

>>> name[5]="X"

what gets printed?

a)

snow storm

b)

snowXstorm

c)

snow Xtorm

d)

Python throws an error

8.

Which keyword in Python is used to indicate empty functions,classes and loops ?

a)

pass

b)

break

c)

None

d)

null

9.

Given a function that does not return any value, what value is shown when executed at the shell?

a)

int

b)

bool

c)

pass

d)

None

10.

>>>print 0.1 + 0.2 == 0.3

output??

a)

True

b)

False

c)

error

d)

Machine dependent

11.

Which of the following is not a complex number?

a)

k=2+3j

b)

k=complex(2,3)

c)

k= 2+3J

d)

k=2+3I

12.

What does ~~~~~~5 evaluate to?


note:: ~x is equivalent to -(x+1).

a)

-5

b)

5

c)

11

d)

-11

13.

x = 123

for i in x:

print(i)

a)

1 2 3

b)

3 2 1

c)

1

2

3

d)

error

14.

print(bool('False'))

print(bool())

a)

true, false

b)

true,true

c)

false,true

d)

false,false

15.

कर्मण्येवाधिकारस्ते मा फलेषु कदाचन ।

मा कर्मफलहेतुर्भूर्मा ते सङ्गोऽस्त्वकर्मणि ॥

write shloka no.(in the format of: 9.26 )

(a)  

16.

what are three consideration discussed in the shloka? (multiple correct)

a)

prescribed duties

b)

capricious work

c)

Inaction

d)

Forbidden action

17.

Arjuna was therefore advised by the Lord to fight as a matter of _______________without attachment to the result.

a)

duty

b)

action

c)

fear

d)

love