You are on page 1of 2

Pre-Test on Python / Marks – 10x2 = 20 / Time – 10 Minutes

1. What is output for −


a = ['he', 'she', 'we']
' '.join(a)
A - ['heshewe']
B - 'heshewe'
C - ['he she we']
D - 'he she we'

2. Which of the following is false statement in python

A - int(144)==144

B - int('144')==144

C - int(144.0)==144

D - None of the above

3. In the following options which are python libraries which are used for data
analysis and scientific computations
A - Numpy
B - Scipy
C - Pandas
D - All the above

4. What is output of following code −


deffunc(x, ans):
if(x==0):
return 0
else:
return func(x-1, x+ans)
print(func(2,0))
A-0
B-1
C-2
D-3

5. What is the output of the following code?


defnprint(message, n):
while(n > 0):
print(message)
n-=1
nprint('z', 5)
A - zzzz
B - zzzzz
C - Syntax Error
D - Infinite Loop
6. What is the output of the following code?
s = ''\t\t\t\n\nGoogle\n\n\n\t\t\t''
s.strip()
A - '\n\nGoogle\n\n\n'
B - '\t\t\tGoogle\t\t\t'
C - 'Google'
D - 'Google' , '\t\t\t\n\n \n\n\n\t\t\t'

7. Which options are correct to create an empty set in Python?


A - {}
B - ()
C - []
D - set()

8. What is the output of the code shown below?


import math
[str(round(math.pi)) for i in range (1, 6)]
A. [‘3’, ‘3’, ‘3’, ‘3’, ‘3’, ‘3’]
B. [‘3.1’, ‘3.14’, ‘3.142’, ‘3.1416’, ‘3.14159’, ‘3.141582’]
C. [‘3’, ‘3’, ‘3’, ‘3’, ‘3’]
D. [‘3.1’, ‘3.14’, ‘3.142’, ‘3.1416’, ‘3.14159’]

9. What is the output of the code shown below?


t=32.00
[round((x-32)*5/9) for x in t]
A. [0]
B. 0
C. [0.00]
D. Error

10. What is the output of the following?


print([i.lower() for i in "HELLO"])
A. [‘h’, ‘e’, ‘l’, ‘l’, ‘o’].
B. ‘hello’
C. [‘hello’].
D. hello

Mail your answer to "toarnabchakraborty@gmail.com"


Keeping "gdsanjib@gmail.com" in CC

You might also like