Some interview questions (Python) and summaries of test engineers

Source: Internet
Author: User

(i) Description

1. document Some of the programming questions (Python) that you encounter when interviewing a test engineer.

2, review the interview process, do a summary.

(ii) title

1. Input: JSON {"A": "AA", "B": "BB", "C": {"D": "DD", "E": "EE"}} output: Dictionary {' A ': ' AA ', ' B ': ' BB ', ' d ': ' DD ', ' e ': ' EE '}

1 defconversion (n,the_dict):2      forKey,valueinchN.items ():3         #if value is a dictionary, recursion4         ifisinstance (value, dict):5 conversion (value,the_dict)6         Else:7The_dict[key] =value8     returnthe_dict9 #in fact, the JSON object should first be decoded with Json.loads (R) and converted to a Python dictionary.Ten #However, if this type of data is entered directly in this format, it will default to the Dictionary object, it will not decode the OneR = {"a":"AA","b":"BB","C":{"D":"DD","e":"ee"}} A  -The_dict =dict () - Print(conversion (R,THE_DICT))

2, calculate n!, for example n=3 (calculate 3*2*1=6)

1 def factorial (n): 2     if n = = 1:3         return 14     return n*factorial (n-1 )56print(factorial (5))

3. String segmentation, merging the list data into a string. Gets the key and value values for the dictionary

1The_str ='12,33,44'2 3 #splits a string, returns a list4The_list = The_str.split (',')5 Print(the_list)6 7 #merge the list into a string, ', ' to specify separators between different elements8 Print(','. Join (The_list))
1The_dict = {'a':'AA','b':'BB','D':'DD','e':'ee'}2 3 #the key and value values of the iteration dictionary4  forKey,valueinchThe_dict.items ():5     Print(Key)6     Print(value)7 #the key value of the iteration dictionary8  forKey1inchThe_dict.keys ():9     Print(Key1)Ten  One #the value of the iteration dictionary A  forValue1inchthe_dict.values (): -     Print(value1)

4, there is a list, each element holds the student's name, the result, according to the student result favorably to the difference sort.

Because there is no restriction on what sort algorithm to use, so I use the choice sort to implement

1 defStudent_achie (A):2      forIinchRange (len (A)):3Key =I4          forJinchRange (i+1, Len (A)):5             ifA[key].split (':') [1] < A[j].split (':') [1]:6Key =J7A[key],a[i] =A[i],a[key]8     returnA9 Ten #Student name and student performance OneStu = ['Zhang San:','John Doe:','Harry:','Li Liu:','Wang Ji Huanghua: 55.5',] A  - Print(Student_achie (Stu))

5, there is a list, each element holds the student's name, the result, calculates the student's total score.

1 #Calculate student Total2 defTotal_achie (A):3     ifLen (A) = = 1:4         returnFloat (A[0].split (':') [1])5     returnFloat (A.pop (). Split (':') [1]) +Total_achie (A)6 #Student name and student performance7Stu = ['Zhang San:','John Doe:','Harry:','Li Liu:','Wang Ji Huanghua: 55.5',]8 9 Print(Total_achie (Stu))

6, the realization of the Fibonacci sequence (the first and second items are 1, followed by the previous 2 items added), and print the first 10

1 defFibonacci (N):2The_list = []3      forIinchrange (n):4         ifi = =0:5The_list.append (1)6         elifi = = 1:7The_list.append (1)8         Else:9The_list.append (The_list[i-1] + the_list[i-2])Ten     returnthe_list One #output [1, 1, 2, 3, 5, 8,, +, +, +] A Print(Fibonacci (10))

7. What are the main factors affecting the performance of the algorithm? (I answered the spatial complexity and the complexity of the time first), and then he asked about the stability of the algorithm.

I was only back when I was affected by the complexity of space and the complexity of time. Stability is not known. Algorithm I have not learned the performance analysis of this piece, in a short time should also not plan to spend time on it, so this question no answer, first remember, and so on, and then study.

8. XPath expression for div with id = "Info"

div[@id = "Info"]

9, there are some SQL topics and basic theoretical knowledge will not say, not too difficult (do not ask some of the more biased door or I usually do not have the basic knowledge points should have no problem), SQL basic to Multi-table association query. (Before the interview review the join on, the group by, the order by, have the use of basic enough, some may need to go to format to_data () To_char (), because the recent half a year less write SQL, not review under very easy to make some low-level errors)

10, there is a recursive query of Oracle did not write out, this really has to be carefully studied.

11, there are other asked some selenium elements to locate those, did not ask too hard.

(iii) Summary

The first one, the interview feeling in the sleepwalking, did not play out the level, some will also not in the self-introduction and dialogue reflected in (there is a very simple topic did not write out). Now think about the main:

1, no serious preparation, did not go to review some basic knowledge, just quit mentality has not adjusted over (just came to Shenzhen to find a house, find a job to tell the truth a little tired, state general), attitude is not correct.

2, usually write code, SQL is generally a general idea to write directly, after writing the test down the line, where there is a problem on the debugging, what function/method does not understand or forget, Baidu or Google search information (in addition to some of the more difficult, the basic is to see understand). But in the interview, write directly on the paper, this time feel away from the IDE and the network is really not used to.

After careful review of the basic knowledge, after 2 interviews, successfully received an offer. The second interview Python programming written and face test should be basically correct (there may be a little problem), not the reason for the feeling is mainly that they want to recruit a familiar with the Android automation, and is responsible for maintaining their automated testing framework, to others to answer their automated testing framework of some problems, Skilled use of Linux, ADB commands, view, analyze the log and so on, this work I really do not competent.

Summarize:

1, self-introduction, talk about their own advantages, the view of overtime (found that the 3 problems seem to have basic) is not eloquence particularly good, it is best to write a version on paper, the interview without temporary organization language.

2, do not focus too much on the interview, relaxed mentality, as a conversation with friends, you will find that you will behave better. Show your normal level on the line, so the interview is good, because it does mean that you are not competent for the job.

3, before the interview review some basic knowledge, some of the more common programming problems, the most commonly used in some of the methods of writing on the paper.

4, others may want to think about how to avoid talking about their not good at the point of knowledge, the focus of the conversation to their own good technology.

5, feel the programming of the topic is not too difficult, generally test some basis, and then according to your resume to ask some questions. (But it is embarrassing that the first time with the IDE a few minutes can be knocked out of the code, on the paper is not written out, this situation is usually some key and very simple function/method forgotten) So before the interview, it is better to spend some time to review (basic data type Integer, floating point, String, List, dictionary, collection and some common functions/methods, etc.).

Some interview questions (Python) and summaries of test engineers

Related Article

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.