Hirely-Backend / backend /Data /python_interview_questions.txt
NaikPranav11's picture
Initial clean deployment
1207440
Raw
History Blame Contribute Delete
10.7 kB
Python Interview Questions
1) What is the difference between global and local scope?
2) What is an iterator in Python?
3) What is the __init__() function in Python?
4) When should you use lambda functions in Python?
5) What is the difference between lists, tuples and sets?
6) How can you check if all the characters in a string are alphanumeric?
7) How can you convert a string to an integer?
8) What is indentation in Python, and why is it important?
9) What is the correct syntax to output the type of a variable or object in Python?
10) Which collection does not allow duplicate members?
11) What is Inheritance in Python?
12) What is the output of the following code?
```
x = 41
if x > 10:print("Above ten,")if x > 20:print("and also above 20!")else:print("but not above 20.")
13) Can you list Python's primary built-in data types, in categories?
14) What are Membership Operators?
15) Which statement can be used to avoid errors if an `if` statement has no content?
16) What are Arbitrary Arguments?
17) How can you create and use a Module in Python??
18) Can you copy a List in Python by simply writing: `list2 = list1`?
19) How can you return a range of characters of a string?
20) What is a class in Python, and how do you use it?
Python Interview Questions for Freshers
1. Is Python a compiled language or an interpreted language?
2. How can you concatenate two lists in Python?
3. Difference between for loop and while loop in Python
4. How do you floor a number in Python?
5. What is the difference between / and // in Python?
6. Is Indentation Required in Python?
7. Can we Pass a function as an argument in Python?
8. What is a dynamically typed language?
9. What is pass in Python?
10. How are arguments passed by value or by reference in Python?
11. What is a lambda function?
12. What is List Comprehension? Give an Example.
13. What are *args and **kwargs?
14. What is a break, continue and pass in Python?
15. What is the difference between a Set and Dictionary?
16. What are Built-in data types in Python?
17. What is the difference between a Mutable datatype and an Immutable data type?
18. What is a Variable Scope in Python?
19. How is a dictionary different from a list?
20. What is docstring in Python?
21. How is Exceptional handling done in Python?
22. What is the difference between Python Arrays and Lists?
23. What are Modules and Packages in Python?
Intermediate Python Interview Questions
24. What is the difference between xrange and range functions?
25. What is Dictionary Comprehension? Give an Example
26. Is Tuple Comprehension possible in Python? If yes, how and if not why?
27. Differentiate between List and Tuple?
28. What is the difference between a shallow copy and a deep copy?
29. Which sorting technique is used by sort() and sorted() functions of python?
30. What are Decorators?
31. How do you debug a Python program?
32. What are Iterators in Python?
33. What are Generators in Python?
34. Does Python supports multiple Inheritance?
35. What is Polymorphism in Python?
36. Define encapsulation in Python?
37. How do you do data abstraction in Python?
38. How is memory management done in Python?
39. How to delete a file using Python?
40. What is slicing in Python?
41. What is a namespace in Python?
42. What is PIP?
43. What is a zip function?
44. What are Pickling and Unpickling?
45. What is the difference between @classmethod, @staticmethod and instance methods in Python?
46. What is __init__() in Python and how does self play a role in it?
47. Write a code to display the current time?
48. What are Access Specifiers in Python?
49. What are unit tests in Python?
50. Python Global Interpreter Lock (GIL)?
51. What are Function Annotations in Python?
52. What are Exception Groups in Python?
53. What is Python Switch Statement?
54. What is Walrus Operator?
Python Interview Questions for Freshers
1. What is __init__?
2. What is the difference between Python Arrays and lists?
3. Explain how can you make a Python Script executable on Unix?
4. What is slicing in Python?
5. What is docstring in Python?
6. What are unit tests in Python?
7. What is break, continue and pass in Python?
8. What is the use of self in Python?
9. What are global, protected and private attributes in Python?
10. What are modules and packages in Python?
11. What is pass in Python?
12. What are the common built-in data types in Python?
13. What are lists and tuples? What is the key difference between the two?
14. What is Scope in Python?
15. What is PEP 8 and why is it important?
16. What is an Interpreted language?
17. What is a dynamically typed language?
18. What is Python? What are the benefits of using Python
Python Interview Questions for Experienced
1. What are Dict and List comprehensions?
2. What are decorators in Python?
3. What is Scope Resolution in Python?
4. What are Python namespaces? Why are they used?
5. How is memory managed in Python?
6. What is lambda in Python? Why is it used?
7. Explain how to delete a file in Python?
8. What are negative indexes and why are they used?
9. What does *args and **kwargs mean?
10. Explain split() and join() functions in Python?
11. What are iterators in Python?
12. How are arguments passed by value or by reference in python?
13. How Python is interpreted?
14. What is the difference between .py and .pyc files?
15. What is the use of help() and dir() functions?
16. What is PYTHONPATH in Python?
17. What are generators in Python?
18. What is pickling and unpickling?
19. What is the difference between xrange and range in Python?
20. How do you copy an object in Python?
Python OOPS Interview Questions
1. How will you check if a class is a child of another class?
2. What is init method in python?
3. Why is finalize used?
4. Differentiate between new and override modifiers.
5. How is an empty class created in python?
6. Is it possible to call parent class without its instance creation?
7. Are access specifiers used in python?
8. How do you access parent members in the child class?
9. How does inheritance work in python? Explain it with an example.
10. How do you create a class in Python?
Python Pandas Interview Questions
1. Can you get items of series A that are not available in another series B?
2. While importing data from different sources, can the pandas library recognize dates?
3. How will you get the items that are not common to both the given series A and B?
4. How will you delete indices, rows and columns from a dataframe?
5. How to add new column to pandas dataframe?
6. What do you understand by reindexing in pandas?
7. How will you identify and deal with missing values in a dataframe?
8. Can you create a series from the dictionary object in pandas?
9. How will you combine different pandas dataframes?
10. Define pandas dataframe.
11. What do you know about pandas?
Numpy Interview Questions
1. How will you reverse the numpy array using one line of code?
2. How will you find the nearest value in a given numpy array?
3. How will you sort the array based on the Nth column?
4. How will you read CSV data into an array in NumPy?
5. How will you efficiently load data from a text file?
6. You are given a numpy array and a new column as inputs. How will you delete the second column and replace the column with a new column value?
7. What are the steps to create 1D, 2D and 3D arrays?
8. How are NumPy arrays advantageous over python lists?
9. What do you understand by NumPy?
10. How will you find the shape of any given NumPy array?
Python Libraries Interview Questions
1. Differentiate between deep and shallow copies.
2. What is main function in python? How do you invoke it?
3. Are there any tools for identifying bugs and performing static analysis in python?
4. Define PIP.
5. Define PYTHONPATH.
6. Define GIL.
7. What are the differences between pickling and unpickling?
8. Can you easily check if all characters in the given string is alphanumeric?
9. How can you generate random numbers?
10. What are lambda functions?
11. What are some of the most commonly used built-in modules in Python?
12. Differentiate between a package and a module in python.
Question 1: What is the difference between a list and a tuple?
Question 2: How would you convert a list into a tuple?
Question 3: What is the difference between an array and a list?
Question 4: How would you convert a list to an array?
Question 5: How is memory managed in Python?
Question 6: How do you achieve multithreading in Python?
Question 7: What is monkey patching?
Question 8: What is a lambda function? Give an example of when it’s useful and when it’s not.
Question 9: What is pickling and unpickling?
Question 10: What advantages do NumPy arrays offer over (nested) Python lists?
Question 11: Explain inheritance in Python with an example
Question 12: What is polymorphism in Python?
Question 13: Explain the difference between range() and xrange()
Question 14: Explain the differences between Flask and Django
Question 15: What is PYTHONPATH?
Question 16: What is PEP 8?
Question 17: What are Python decorators?
Question 18: What is init?
Question 19: What is the ternary operator?
Question 20: What are global and local variables in Python?
Question 21: What is the @property in Python?
Question 22: How is try/except used in Python?
Question 23: Explain the differences between Python 2 and Python 3
Question 24: What is the join method in python?
Question 25: What is dictionary comprehension?
Question 26: How would you make a deep copy in Python?
Question 27: How would you check if a key exists in a Python dictionary?
Question 28: How would you achieve memoization in Python?
Question 29: How would you sort a dictionary in Python?
Question 30: How and when would you use any() and all()?
Question 31: What is a Python Docstring?
Question 33: Explain the difference between a generator and an iterator in Python.
Question 34: What is defaultdict in Python?
Question 35: What are Python modules?