Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PYTHON Q-4

Total questions: 15

Worksheet time: 18mins

Name
Class
Date
1.

Predict the output:

m=[1,3,4,5,6]

print(m[-2])

a)

5

b)

6

c)

4

d)

Error

2.

What is the purpose of 'pip list'

a)

used to display list of installed packages

b)

used to list out .py file directories

c)

used to list keywords in Python

d)

used to install list of packages in python

3.

What is the abbrevation of 'pip'

a)

Package Installer for Python Packages

b)

Package Inisde Package

c)

Python Installed Packages

d)

Package installer for Packages

4.

Which of the following namespace is invalid in python

a)

local

b)

global

c)

builtin

d)

user

5.

What is the the output format of 'locals()' method

a)

dictionary

b)

list

c)

tuple

d)

set

6.

What is the output of the following code:

m=[2,3,3,45,"It"]

print(m.pop())

a)

It

b)

2

c)

None

d)

Error

7.

Predict the output:

def HelloGec():

a=10 #with in def

b=20 # within def

print(locals()) #within def

HelloGec() # in main() calling

a)

a,b

b)

{'a': 10, 'b': 20}

c)

10,20

d)

a=10

b=20

e)

None

8.

Which of the following statment(s) is/are correct

I) Python Package is a Directory which contains Python modules

II) Python module contains Packages.

a)

Only I

b)

Only II

c)

Both I and II

d)

Neither I nor II

9.

Which of the following list is Invalid list.

a)

p=[1,2,'gec',]

b)

v=[[1,2,3],[3,4]]

c)

v=[['KGF'],[ ],]

d)

v=[5,'abc','hai:44']

e)

None of the answers

10.

Predict the output of the following code:

m=[i*i for i in range(10,1) if(i%2==1)]

print(m)

a)

[ ]

b)

Infinite

c)

[1,9,25,49,81]

d)

[81,49,25,9,1]

11.

What is the output of the following code:

m=[3,5,6,76]

k=[1,3,4]

print(m<k)

a)

False

b)

True

c)

Error

d)

None

12.

What is the output of the following code:

PANINDIA=["RRR","KGF-2","Bahubali"]

print("+".join(PANINDIA),'=PANINDIA')

a)

RRR+KGF-2+Bahubali

b)

Error

c)

RRR+KGF-2+Bahubali =RRR+KGF-2+Bahubali

d)

RRR+KGF-2+Bahubali =PANINDIA

13.

What is the output of the following code:

m=[1,2,0,-1]

for x,y in enumerate(m):

print(m[y]+m[x])

a)

3

2

1

-2

b)

1

3

2

2

c)

Error

d)

1

2

0

-1

14.

Predict the output:

IT=[x for x in range(5) if((x&1)==0)]

print(IT)

a)

0

2

4

b)

Error

c)

IT

d)

0

1

2

3

4

5

15.

What is the Output of the Following code:

Nuvvu=['IT']

Nenu=['CSE']

Manam=2*Nuvvu*2+Nenu*4

print(Manam[::-1][3]+Manam[3])

a)

CSEIT

b)

[CSE,IT,CSE]

c)

Error

d)

Naku Teleedu, Nenu Chadavaledu

e)

[CSE,CSE,IT,IT]