/Python_study_Materials

Python_study_Materials

Primary LanguageJupyter Notebook

Python Interview Questions

1. Differentiate between lists and tuples.
2. What are negative indices?
3. How long can an identifier be in Python?
4. How would you convert a string into lowercase?
5. What is the pass statement in Python?
6. Explain help() and dir() functions in Python.
7. How do you get a list of all the keys in a dictionary?
8. What is slicing?
9. How would you declare a comment in Python?
10. How will you check if all characters in a string are alphanumeric?
11. How will you capitalize the first letter of a string?
12. With Python, how do you find out which directory you are currently in?
13. How do you insert an object at a given index in Python?
14. How do you reverse a list?
15. What is the Python interpreter prompt?
16. How does a function return values?
17. How would you define a block in Python?
18. Why do we need break and continue in Python?
19. In one line, show us how you’ll get the max alphabetical character from a string.
20. Can you name ten built-in functions in Python and explain each in brief?
21. How will you convert a list into a string?
22. How will you remove a duplicate element from a list?
23. What is a dictionary in Python?
24. Explain the //, %, and ** operators in Python.
25. What do you know about relational operators in Python.
26. What are assignment operators in Python?
27. Explain logical operators in Python.
28. Finally, tell us about bitwise operators in Python.
29. What data types does Python support?
30. How would you convert a string into an int in Python?
31. How do you take input in Python?
32. What is recursion?
33. What does the function zip() do?
34. How do you calculate the length of a string?
35. Explain Python List Comprehension.
36. How do you get all values from a Python dictionary?
37. What if you want to toggle case for a Python string?
38. Write code to print everything in the string except the spaces.
39. Now, print this string five times in a row.
40. What is the purpose of bytes() in Python?
41. What is a control flow statement?
42. Create a new list to convert the following list of number strings to a list of numbers.
43. Given the first and last names of all employees in your firm, what data type will you use to store it?
44. How would you work with numbers other than those in the decimal number system?
45. How many arguments can the range() function take?
46. What is PEP 8?
47. What is the best code you can write to swap two numbers?
48. How can you declare multiple assignments in one statement?
49. If you are ever stuck in an infinite loop, how will you break out of it?
50. What are the benefits of using Python?
51. What are python modules? Name some commonly used built-in modules in Python?
52. What are local variables and global variables in Python?
53. What is a lambda function?
54.  What is self in Python?
55.  How does break, continue and pass work?
56.  What does [::-1} do?
57.  How can you generate random numbers in Python?
58.  What is the difference between range & xrange?
59.  How do you write comments in python?
60.  How to add values to a python array?
61.  What are Python libraries? Name a few of them.
62.  How are classes created in Python? 
63.  What does an object() do?
64.  Write a program to produce Fibonacci series in Python.
65.  Write a program in Python to check if a number is prime.
66.  Write a program in Python to check if a sequence is a Palindrome.
67.   Write a one-liner that will count the number of capital letters in a file. Your code should work even if the file is too big to fit in memory.
68.  Write a sorting algorithm for a numerical dataset in Python.
69.  What is PYTHON PATH?
70. What type of language is python?