You are on page 1of 1

PYTHON QUESTIONS 1(20.1.

2022)
1. How would you modify the definition of extendList to produce the presumably
desired behavior?
2. What will be the output of the code below? Explain your answer.
def multipliers():
return [lambda x : i * x for i in range(4)]
print [m(2) for m in multipliers()]
3. How would you modify the definition of multipliers to produce the presumably
desired behavior?
4. What will be the output of the code below? Explain your answer.
class Parent(object):
x=1
class Child1(Parent):
pass
class Child2(Parent):
pass
print Parent.x, Child1.x, Child2.x
Child1.x = 2
print Parent.x, Child1.x, Child2.x
Parent.x = 3
print Parent.x, Child1.x, Child2.x
5. How do you list the functions in a module?
6. What is the difference between list and tuples in Python?
7. What are the key features of Python?
8. What type of language is python? Programming or scripting?
9. Python an interpreted language. Explain.
10. What is pep 8?
11. What are the benefits of using Python?
12. What are Python namespaces?
13. What are decorators in Python?
14. What are Dict and List comprehensions?
15. What are the common built-in data types in Python?
16. What is the difference between .py and .pyc files?
17. What is slicing in Python?
18. What are Keywords in Python?
19. What are Literals in Python and explain about different Literals
20. How to combine dataframes in pandas?

You might also like