Python Interview Quiz Top 25

Source: Internet
Author: User

Python is an interpreted, interactive, object-oriented, high-level programming language. Unlike other languages that use punctuation, Python uses a large number of English words as keywords and is therefore very readable. And it has fewer grammatical constructs than other programming languages.

Python is an explanatory language: This means that your program does not need to be compiled before it executes, but is handled by the interpreter at run time. This feature is much like perl,php.

Python is interactive: This means that you can use a Python terminal to interact directly with the interpreter while writing the program.

Python is Object-oriented: It supports object-oriented styles and various techniques for encapsulating code into classes.

Python is ideal for programming beginners: Python is very easy to get started and has a wide range of applications, from simple word processing to web browsing and game development.

1) What is Python? What are the benefits of using Python?

Python is a programming language that has objects, modules, threads, exception handling, and automatic memory management. It is concise, simple, convenient, easy to expand, has many of its own data structures, and it is open source.

2) What is PEP8?

PEP8 is a programming specification, some advice on how to make your program more readable.

3) What are pickling and unpickling?

The pickle module reads any Python objects, converts them into strings, and then dumps them into a file using the Dump function-a process called pickling. Conversely, the process of extracting the original Python object from the stored string file is called Unpickling.

4) How is Python interpreted?

Python is an explanatory language. Python's source code can be run directly. The Python interpreter converts the source code into an intermediate language, which is then translated into machine code for execution.

5) How does python manage memory?

Python's memory management is managed by the private heap space. All Python objects and data structures are in a private heap. The programmer does not have permission to access the heap, and only the interpreter can manipulate it.

Allocating memory for Python's heap space is done by the Python memory management module. Its core API provides some way to access the module for programmers to use.

Python has its own garbage collection system that reclaims and frees unused memory so that they can be used by other programs.

6) What tools are available to help debug or do static analysis?

Pychecker is a static analysis tool that reports errors in the source code and reports the type and complexity of the error. Pylint is another tool for verifying that a module is meeting code standards.

7) What is a python adorner?

The Python adorner is a unique change in Python that makes it easier to modify a function.

8) What is the difference between an array and a tuple?

The difference between an array and a tuple is that the contents of the array can be modified and the tuple content is read-only. Tuples can be hashed, for example, as a dictionary keyword.

9) How is the parameter passed by value and the reference pass implemented?

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. But if an object can be modified, you can change the object.

10) What is a dictionary derivation and a list derivation?

They are a syntactic structure that makes it easy to create dictionaries and lists.

Each python has its own data structure?

Python comes with data structures that are mutable and immutable.

The variables are:

    • Array

    • Collection

    • Dictionary

Immutable are:

    • String

    • Meta-group

    • Number

12) What is a Python namespace?

In Python, all names exist in one space, they exist and are manipulated in that space--that is, namespaces. It's like a box, each variable name corresponds to an object. When a variable is queried, the corresponding object is found in the box.

What is a lambda in Python?

This is an anonymous function that is often used in a single expression in your code.

14) Why does Lambda have no statements?

The reason that the anonymous function lambda does not have a statement is that it is used to construct a new function object and return it when the code is executed.

What is the pass in Python?

Pass is a statement that will not be executed in Python. In complex statements, if a place needs to be temporarily left white, it is often used for placeholders.

What is a walker in Python?

A walker is used to traverse a set of elements, such as a container such as a list. 、

What is the unittest in Python?

In Python, UnitTest is the unit test framework in Python. It supports shared building, automated testing, pausing code in tests, iterating different tests into groups, and so on.

18) What is slicing in python?

Slicing is a syntax for an excerpt of a paragraph in an ordered object type (array, tuple, string).

19) What is a generator in python?

Generators are a mechanism for implementing iterators. The implementation of this function relies on the yield expression, except that it is not the same as a normal function.

What is docstring in Python?

The Chinese file string in Python is called docstring, which is used in Python to generate documents for functions, modules, and class annotations.

21) How do I 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 (). Not all objects can be copied.

What is a negative index in Python?

The sequence index in Python can be either 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-lowest index.

23) How do I convert a number to a string?

You can use the Self-function str () to convert a number to a string. If you want octal or hexadecimal numbers, you can use the OCT () or Hex ().

What is the difference between xrange and range?

Xrange returns an Xrange object, and range returns an array. No matter how large the range, Xrange uses the same memory.

What are the modules and packages in Python?

In Python, a module is a way to build a program. Each Python code file is a module and can refer to other modules such as objects and properties.

A folder that contains a lot of Python code is a package. A package can contain modules and sub-folders.

Can you add my communication group? 595266089

Python Interview Quiz Top 25

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.