Search This Blog

Monday, July 7, 2025

Python Interview Prep - Part 1

The post holds my old notes and questions that have been asked during the era of python2.7. This is my interview prep guide.

Table of Contents

  1. What is python?

  2. What is the purpose of PYTHONSTARTUP environment variable?

  3. Is python a case sensitive language?

  4. What are 5 standard data types in python?

  5. What is PEP8?

  6. What is pickling and unpickling?

  7. How memory is managed in Python?

  8. What are the tools that help to find bugs or perform static analysis?

  9. How will you convert a string to an int in python?

  10. How will you convert a string to a float in python?

  11. How will you convert a object to a regular string representation in python?

  12. How will you convert a String to an object in python?

  13. How will you convert a string to a tuple in python?

  14. How will you convert a string to a list in python?

  15. How will you convert a string to a set in python?

  16. How will you create a dictionary using tuples in python?

  17. How will you convert a string to a frozen set in python?

  18. How will you convert an integer to a character in python?

  19. How will you convert an integer to an unicode character in python?

  20. How to convert ASCII to int and back?

  21. How will you convert an integer to hexadecimal string in python?

  22. How will you convert an integer to octal string in python?

  23. What is the purpose of ** operator?

  24. What is the purpose of // operator?

  25. Difference between is and == in python?

  26. Python Format Specifiers(python 2):

  27. Pick a random item from a list or tuple?

  28. Pick a random item from a range?

  29. How can you get a random number in python?

  30. How will you set the starting value in generating random numbers?

  31. How will you capitalizes first letter of string?

  32. How will you check in a string that all characters are alphanumeric?

  33. How will you check in a string that all characters are digits?

  34. How will you check in a string that all characters are in lowercase?

  35. How will you check in a string that all characters are in uppercase?

  36. How will you check in a string that all characters are numerics?

  37. How will you check in a string that all characters are whitespaces?

  38. How will you check in a string that it is properly titlecased?

  39. How will you replaces all occurrences of old substring in string with new string?

  40. How will you change case for all letters in string?

  41. How will you check in a string that all characters are decimal?

  42. What is the output of ['Hi!'] * 4?

  43. How will you get the max valued item of a list?

  44. How will you get the min valued item of a list?

  45. How will you get the index of an object in a list?

  46. How will you insert an object at given index in a list?

  47. How will you remove last object from a list?

  48. How your python code gets executed?

  49. Is .pyc created every time code is run?

  50. Different python complied extensions