Python interview assault

Python basics#

  1. What is Python anyway? You can compare with other technologies in your answer.
  1. What is PEP?
  1. What are pickling and unpickling?
  1. How is Python interpreted?
  1. How does Python manage memory?
  2. What tools can help debug or do static analysis?
  1. What is a Python decorator?
  1. What is the difference between array and tuple?
  1. How are parameters passed by value and passed by reference implemented?
  1. What are dictionary comprehensions and list comprehensions?
  2. What data structures does Python have?
  3. What is the Python namespace?
  4. What is lambda in Python?
  5. Why is there no statement in lambda?
  6. What is pass in Python?
  7. What is a iterator in Python?
  8. What is unittest in Python?
* In Python, unittest is the unit testing framework in Python. It has functions that support shared setup, automatic testing, pause code during testing, iterate different tests into a group, and so on.
  1. What is slicing in Python?
* Slicing is a grammar that extracts a certain paragraph from an ordered object type (array, tuple, string).
  1. What is a constructor in Python?
* Generators are a mechanism for implementing iterators. The realization of its function depends on the yield expression, except that it is no different from ordinary functions
  1. What is a docstring in Python?
* A docstring in Python is called a docstring, and its role in Python is to generate documentation for functions, modules, and class comments.
  1. How to copy an object in Python?
* If you want to copy an object in Python, most of the time you can use copy.copy()Or copy.deepcopy(). But not all objects can be copied.
  1. What is a negative index in Python?
* Sequence index in Python can be positive or negative. If it is a positive index, 0 is the first index in the sequence, and 1 is the second index. If it is a negative index, (-1) is the last index and (-2) is the penultimate index.
  1. How to convert a number into a string?
  2. What is the difference between Xrange and range?
* Xrange is used to return an xrange object, and range is used to return an array. No matter how large the range is, Xrange uses the same memory.
  1. What are modules and packages in Python?
* In Python, modules are a way of building programs. Each Python code file is a module and can refer to other modules, such as objects and attributes.
* A folder containing a lot of Python code is a package. A package can contain modules and subfolders.
  1. List the member methods of python list as much as possible, and give the answer to the list operation:
  2. a=[1, 2, 3, 4, 5], a[::2]=?, a[-2:] = ?
  3. One line of code realizes the summation after adding 3 to the even-numbered elements in list a?
  4. Disrupt the order of the elements of list a, then sort a to get list b, and then construct a dictionary d from a and b in the order of elements.
  5. Use python to count the occurrence frequency of each word in an English article, and return the top 10 words with the highest occurrence frequency and the number of occurrences, and answer the following questions? (Punctuation marks can be ignored)
  6. After creating the file object f, explain the difference between the readlines and xreadlines methods of f?
  7. Additional requirement: The element within the quotation marks needs to be counted as a word, how to achieve it?
  8. Briefly describe the concept of python GIL and its impact on python multithreading? Write a multi-threaded crawling webpage program, and clarify whether the multi-threaded crawling program can be compared with single-threaded performance improvement, and explain the reason.
  9. Use python to write a thread-safe singleton mode implementation.
  10. Explain the concepts of decorators, descriptors (property), and metaclasses, and enumerate their application scenarios;
  11. How to dynamically get and set the properties of an object.
  12. How to copy an object in Python? (The difference between assignment, shallow copy and deep copy)
  13. Introduce the usage and function of except?
  14. How to use Python to query and replace a text string?
  15. What is the difference between match() and search() in Python?
  16. When matching HTML tags with Python, what is the difference between <.> and <.?>?
  17. How to generate random numbers in Python?
  18. Is there a tool that can help find python bugs and perform static code analysis?
* PyChecker is a static analysis tool for python code, it can help find bugs in python code,Will warn about the complexity and format of the code
 Pylint is another tool for codingstandard checking
  1. How to set a global variable in a function?
  2. What is the difference between single quotes, double quotes and triple quotes?

Recommended Posts

Python interview assault
Python interview questions
Python interview questions summary
Python classic interview question one​
Python classic interview questions two
Python interview questions: string concatenation
Python interview questions collection (three)
Python multithreading
Python CookBook
Python3 dictionary
Python3 module
python (you-get)
Python string
Python basics
Python descriptor
Python basics 2
Python exec
Python notes
Python3 tuple
CentOS + Python3.6+
Python advanced (1)
Python decorator
Python IO
Python multithreading
Python toolchain
Python3 list
Python overview
python introduction
Python analytic
Python basics
07. Python3 functions
Python basics 3
Python multitasking-threads
Python functions
python sys.stdout
python operator
Python entry-3
Centos 7.5 python3.6
Python string
python queue Queue
Python basics 4
Python basics 5