How to get half of the interview company offers - my Python job search

https://blog.csdn.net/IAlexanderI/article/details/65035857

I started looking for a job at the end of August. In just over a week, I interviewed 9 companies and got 5 offers. It may be because the companies I interviewed are all entrepreneurial companies, but I still feel a lot. Because the time to learn Python is still very short, I didn't expect it to be relatively easy to find a job, so I would like to share my interview experience these days with you, hoping to provide some help for those who are learning Python to find a job.

The author feels that the two main points of the interview are: 1. Project experience. 2. The project experience is consistent with the recruitment position, which is the most important, and the others are the icing on the cake.

Self introduction

This is a question of sending points, the first question that will remain unchanged for thousands of years. However, some friends may not care too much. In fact, this question has already determined your direction in the mind of the interviewer. The main structure of self-introduction: personal basic information + basic technical composition + project experience (specific project and the responsible part in the project) + self-evaluation, the principle of which is to introduce closely around the needs of the recruitment position. Before that, make preparations to see what direction the R&D engineer is specifically needed by the recruiter. At present, for Python, most of the recruitments on the hook are the design and development of automated test platforms, and data mining and cleaning. Pure web development doesn't seem to exist yet, so students in the web direction should pay attention to focusing on operation and maintenance and automation.

two-part question

During the interview process, when the interviewer asks questions, they often lead to deeper questions about the question itself. For example: Have you ever used the with statement? My answer is: the with statement is often used in the case of accessing resources, ensuring that necessary cleanup operations are performed regardless of whether an exception occurs during the access process, such as the automatic closing of files and the automatic acquisition and release of locks in threads. The interviewer immediately asked, then you know why the with statement can close the file correctly, which made me feel bored all of a sudden, I can only vaguely remember that the with statement will open up an independent environment to perform file access, similar to the sandbox mechanism. The interviewer was noncommittal about this answer, which was considered a reluctance to pass. Therefore, it is better to know why. In the usual study, ask one more why, and you will not be too passive during the interview.

Don't dig a hole for yourself

Make sure you understand every knowledge point in the answer when answering the interviewer, otherwise it will be embarrassing to be asked. When I was answering web security questions, I talked about SQL injection, and the interviewer said that since SQL injection was mentioned, please talk about its principles and solutions! The shame is that I actually confuse the XSS cross-site injection attack with the SQL injection, and the scene is a bit embarrassing. So consider every word you say, and a smarter classmate can guide the interviewer to ask the questions he wants to be asked.

Must ask Redis, high concurrency solution

After interviewing many companies, I must ask how much Redis knows and the solution to high concurrency. The author's answer is not very good.

What new skills did you learn this year?

This is the interviewer looking to see if you have great enthusiasm for new technology. All the interviewers who interviewed me asked this question without exception. They all hope to find a young man who is constantly learning and innovating. Browse through the latest technical information and choose your area of ​​interest.

Would you choose a startup or a big company like BAT and why?

Of course, it depends on which company the recruiter belongs to, but it is generally a startup company that asks this kind of question. The answer is nothing more than: the challenge is big, enjoy the challenge; the start-up company has infinite possibility of success, and wants to grow with the company;

Why did you leave your last company?

This is also a question that must be asked. Find a more legitimate reason. Don't say that the company has too many snacks and gained 20 pounds. The takeaways near the company are tired of eating. Really don't say that... The main principle is not to say anything to the former company. If you have complaints, bosses change from time to time, PMs are unreliable or something, you should look for your own reasons: the development of the company is relatively stable, but I am still young and hope to have greater challenges and more learning opportunities. Something like this will do.

Describe your last company

This question is not very likely to be asked, but there are still three companies who have asked it. The recruiter mainly wants to locate your level from the specific business scale and main business of the previous company. Knowing the purpose of the recruiter can be calm. answer.

technical issues

The non-technical questions are just as many as the above. With a little preparation as a reference, you will be able to answer them well during the interview. Let's talk about the technical questions in the interview. Personally, the interviewer does not ask many technical questions. Generally, there are 2-3 questions, from shallow to deep.

Briefly describe functional programming

In functional programming, a function is the basic unit and a variable is just a name, not a storage unit. In addition to anonymous functions, Python also uses fliter(), map(), reduce(), apply() functions to support functional programming.

What is an anonymous function and what are the limitations of anonymous functions

Anonymous functions, also known as lambda functions, are usually used on functions with simpler function bodies. Anonymous functions, as the name suggests, are functions without names, so you don't have to worry about function name collisions. However, Python has limited support for anonymous functions, and only some simple cases can use anonymous functions.

How to catch exceptions and what are the commonly used exception mechanisms?

If we do not take any precautions against exceptions, then an exception occurs during the execution of the program, the program will be interrupted, the default exception handler of python will be called, and the exception information will be output in the terminal.

try...except...finally statement: When an exception occurs when the try statement is executed, go back to the try statement layer to find out whether there is an except statement behind it. This custom exception handler is called when the except statement is found. After the exception is handled by except, the program continues to execute. The finally statement means that the statements in the finally will be executed regardless of whether an exception occurs or not.

assert statement: judge whether the statement immediately following assert is True or False, if it is True, continue to execute print, if it is False, interrupt the program, call the default exception handler, and output the prompt information after the comma in the assert statement.

with statement: If an exception occurs in the with statement or statement block, the default exception handler will be called, but the file will still be closed normally.

The difference between copy() and deepcopy()

copy is a shallow copy, only the parent element of the mutable object is copied. deepcopy is a deep copy that recursively copies all elements of a mutable object.

What is the function of the function decorator (common test)

A decorator is essentially a Python function that allows other functions to add extra functionality without any code changes. The return value of the decorator is also a function object. It is often used in scenarios with aspect requirements, such as: log insertion, performance testing, transaction processing, caching, permission verification and other scenarios. With decorators, you can extract a lot of identical code that has nothing to do with the function itself and continue to reuse it.

Briefly describe Python's scope and the order in which Python searches for variables

A Python scope is simply a namespace for variables. The location where the variable is assigned in the code determines which scope of objects can access the variable, and this scope is the scope of the variable. In Python, only modules, classes, and functions (def, lambda) introduce new scopes. Python's variable name resolution mechanism is also known as the LEGB rule: local scope (Local) → current scope is embedded local scope (Enclosing locals) → global/module scope (Global) → built-in scope (Built-in)

The difference between new-style classes and old-style classes, how to ensure that the classes used are new-style classes

In order to unify classes and types, python introduced new-style classes in version 2.2. In version 2.1, classes and types are different.

To make sure you are using a new-style class, there are the following methods:

Put metaclass = type at the top of the class module code
and inherit directly or indirectly from the built-in class object.
In the python3 version, all classes are new-style classes by default.

Briefly describe the difference between new and init

Call new when creating a new instance, and use init when initializing an instance . This is the most essential difference between them.

The new method returns the constructed object, init does not.

The new function must take cls as its first parameter, while init takes self as its first parameter.

Python garbage collection mechanism (common test)

Python GC mainly uses reference counting to track and collect garbage. On the basis of reference counting, the circular reference problem that may be generated by container objects is solved by "mark and sweep", and the efficiency of garbage collection is improved by "generation collection" by replacing space with time.

1 reference count

PyObject is a must for each object, and ob_refcnt is used as a reference count. When an object has a new reference, its ob_refcnt is incremented, and when the object referencing it is deleted, its ob_refcnt is decremented. When the reference count reaches 0, the object's life is over.

advantage:

Simple real-time disadvantages:

Maintaining reference counts consumes resources Circular references

2 Mark-sweep mechanism

The basic idea is to allocate on demand first, and then start from the registers and references on the program stack when there is no free memory, traverse the graph with objects as nodes and references as edges, mark all accessible objects, and then clean Once the memory space is released, all unmarked objects are released.

3 generation technology

The overall idea of ​​generational recycling is to divide all memory blocks in the system into different sets according to their survival time, each set becomes a "generation", and the garbage collection frequency increases with the increase of the survival time of the "generation". Decrease, time-to-live is usually measured by passing through several garbage collections.

Python defines three generations of object sets by default. The larger the index number, the longer the object survival time.

What does @property in Python do? How to implement read-only properties for member variables?

The @property decorator is responsible for turning a method into a property call. It is usually used in the get method and set method of the property. By setting @property, you can achieve direct access to instance member variables, while retaining parameter checking. In addition, the read-only property of member variables can be achieved by setting the get method without defining the set method.

*args and **kwargs

*args stands for positional arguments, which takes any number of arguments and passes them to the function as a tuple. The keyword arguments represented by **kwargs allow you to use parameter names that are not defined in advance. In addition, positional arguments must be placed in front of keyword arguments.

Have you ever used a with statement? What are its benefits? How to achieve it?

The with statement is suitable for accessing resources, ensuring that necessary "cleanup" operations are performed regardless of whether an exception occurs during use, and resources are released, such as automatic closing of files after use, automatic acquisition and release of locks in threads, etc.

what will be the output of the code below? explain your answer

def extend_list(val, list=[]):
list.append(val)
return list

list1 = extend_list(10)
list2 = extend_list(123, [])
list3 = extend_list(‘a’)

print(list1) # list1 = [10, ‘a’]
print(list2) # list2 = [123]
print(list3) # list3 = [10, ‘a’]

class Parent(object):
x = 1

class Child1(Parent):
pass

class Child2(Parent):
pass

print(Parent.x, Child1.x, Child2.x) # [1,1,1]
Child1.x = 2
print(Parent.x, Child1.x, Child2.x) # [1,2,1]
Partent .x = 3
print(Parent.x, Child1.x, Child2.x) # [3,2,3]
In a two-dimensional array, each row is sorted from left to right in increasing order, and each column is sorted by Sort in ascending order from top to bottom. Please complete a function, input such a two-dimensional array and an integer, and determine whether the array contains the integer.

arr = [[1,4,7,10,15], [2,5,8,12,19], [3,6,9,16,22], [10,13,14,17,24], [18,21,23,26,30]]

def getNum(num, data=None):
while data:
if num > data[0][-1]:
del data[0]
print(data)
getNum(num, data=None)
elif num < data[0][-1]:
data = list(zip(*data))
del data[-1]
data = list(zip(*data))
print(data)
getNum(num, data=None)
else:
return True
data.clear()
return False

if name == ' main ':
print(getNum(18, arr))
to get the greatest common divisor and least common multiple

a = 36
b = 21

def maxCommon(a, b):
while b: a,b = b, a%b
return a

def minCommon(a, b):
c = a*b
while b: a,b = b, a%b
return c//a

if name == ' main ':
print(maxCommon(a,b))
print(minCommon(a,b))
get the median

def median(data):
data.sort()
half = len(data) // 2
return (data[half] + data[~half])/2

l = [1,3,4,53,2,46,8,42,82]

if name == ' main ':
print(median(l))
Input an integer and output the number of 1's in the binary representation of the number. Negative numbers are represented in complement.

def getOneCount(num):
if num > 0:
count = b_num.count(‘1’)
print(b_num)
return count
elif num < 0:
b_num = bin(~num)
count = 8 - b_num.count(‘1’)
return count
else:
return 8

if name == ' main ':
print(getOneCount(5))
print(getOneCount(-5))
print(getOneCount(0))
The above are the questions I was asked during the interview process. There are still relatively few algorithm questions. Only 2 companies asked to write algorithms. It seems that the data structure was not particularly asked, so the structure of a B+ tree was asked. The database is asking about index-related optimizations. A little basic can be answered, but it is best to explore in depth.

This article is only for the purpose of attracting new ideas. Some of the insights are not very mature. I hope to provide some help for partners who are learning Python to find a job. The most important point in the interview process is to calm down. Be nervous and express your knowledge fully. As long as you are a thousand miles horse, sooner or later, Bole will lead you out for a walk.

Please indicate the source when reprinting~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325526031&siteId=291194637