For Python engineers, 25 knowledge points and 25 pythones are required
There are 25 Python knowledge points required for an interview with a Python engineer:
1. What is Python? You can compare it with other technologies in the answer
The following are some key points:
Python is an interpreted language. This means that, unlike C and C, Python code does not need to be compiled before running. Other interpreted languages include PHP and Ruby.
Python is a dynamic type language. It means that you do not need to describe the type of a variable when declaring a variable. You can directly write code such as x = 111 and x = "I'm a string" without any errors.
Python is ideal for Object-Oriented Programming (OOP) because it supports defining classes through composition and inheritance ).
Python does not have access specifiers (access specifier, similar to public and private in C ++). The basis for this design is "Everyone is an adult ".
In Python, a function is the first class Object (first-class objects ). This means that they can be specified to variables. A function can return both the function type and the function can be used as input. Class is also the first class object.
Python code writing is faster, but the running speed is slower than that of the compiling language. Fortunately, Python allows extensions written in C language. Therefore, we can optimize the code and eliminate bottlenecks, which is usually implemented.
Numpy is a good example. It runs very fast because many arithmetic operations are not actually implemented through Python.
Python is widely used-network applications, automation, scientific modeling, big data applications, and so on. It is also often used as a "glue language" to help other languages and components improve running conditions.
Python makes difficult things easier, so programmers can focus on the design of algorithms and data structures without having to deal with the underlying details.
If you are applying for a job in Python development, you should know the language and why it is so cool. And where it is not good.
2. What is PEP8?
PEP8 is a programming specification that provides some suggestions on how to make your program more readable.
Its main content includes code orchestration, document orchestration, space usage, comments, document descriptions, naming conventions, and coding recommendations.
3. What are pickling and unpickling?
The Pickle module reads any Python objects, converts them into strings, and uses the dump function to dump them into a file. This process is called pickling.
The process of extracting the original Python object from the stored string file is called unpickling.
4. How is Python interpreted?
Python is an interpreted language and its source code can be directly run. The Python interpreter converts the source code into an intermediate language, and then translates the source code into a machine code and then executes it.
5. How does Python manage memory?
Python memory management is managed by private heap space. All Python objects and data structures are in a private heap. The programmer has no permission to access the heap. Only the interpreter can operate on the heap.
The memory allocated to the heap space of Python is implemented by the Python memory management module. Its core API provides some methods to access this module for programmers to use.
Python has its own garbage collection system, which recycles and releases unused memory so that it can be used by other programs.
6. What tools can be used to help debug or perform static analysis?
PyChecker is a static analysis tool that not only reports errors in the source code, but also reports error types and complexity. Pylint is another tool used to check whether the module meets the code standards.
7. What is a Python decorator?
The Python modifier is a special change in Python that makes it easier to modify functions.
8. What are the differences between arrays and elements?
Differences between arrays and elements: the array content can be modified, while the content of tuples is read-only. In addition, tuples can be hashed, for example, as Dictionary keywords.
9. How does one implement parameter value transfer and reference transfer?
Everything in Python is a class, and all variables are references to an object. The referenced value is determined by the function and cannot be changed. However, if an object can be modified, you can modify the object.
10. What are dictionary derivation and list derivation?
They are the syntax structure that allows you to easily create dictionaries and lists.
11. What built-in data structures does Python have?
Python comes with data structures that are variable and immutable. The variables include arrays, sets, and dictionaries. The variables include strings, tuples, and numbers.
12. What is a Python namespace?
In Python, all names exist in a single space, which exists in the space and is operated-this is the namespace.
It is like a box where every variable name corresponds to an object. When querying a variable, the corresponding object is searched from the box.
13. What is lambda in Python?
This is an anonymous function that is often used for a single expression in code.
14. Why does lambda have no statements?
The reason why lambda does not have a statement is that it is used to build a new function object and return it when the code is executed.
15. What is pass in Python?
Pass is a statement that is not executed in Python. In complex statements, if a place needs to be temporarily white, it is often used as a placeholder.
16. What is a traversal in Python?
The traversal tool is used to traverse a group of elements, such as a list container.
17. What is unittest in Python?
In Python, unittest is a unit test framework in Python. It supports shared building, automatic testing, code suspension during testing, and iteration of different tests into a group.
18. What is slicing in Python?
Slicing is a syntax used to extract a segment from ordered object types (arrays, tuples, strings.
19. What is a constructor in Python?
Generator is a mechanism for implementing the iterator. The implementation of its function depends on the yield expression. In addition, it is similar to a common function.
20. What is docstring in Python?
The document string in Python is called docstring. in Python, it is used to generate documents for functions, modules, and class annotations.
21. How to copy an object in Python?
If you want to copy an object in Python, you can use copy. copy () or copy. deepcopy () most of the time (). But not all objects can be copied.
22. What is a negative index in Python?
Sequence indexes 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 second to last index.
23. How to convert a number into a string?
You can use the built-in function str () to convert a number to a string. If you want octal or hexadecimal numbers, you can use oct () or hex ().
24. What is the difference between Xrange and range?
Xrange is used to return an xrange object, while range is used to return an array. Regardless of the range, Xrange uses the same memory.
25. What are the modules and packages in Python?
In Python, modules are a way to build programs. Every Python code file is a module and can reference other modules, such as objects and attributes.
A folder containing many Python code is a package. A package can contain modules and subfolders.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.