Collection of test interview questions | Linux and Python Programming (with answers)

This paper is a study note for the students of Hogwarts Testing Institute, and a group is added at the end of the advanced learning text.

This series of articles summarizes some common interview questions for software test engineers, mainly from personal interview, network collection (improvement), daily work discussion, etc. it is divided into the following ten parts for your reference. If there are mistakes, please correct them. There are more interview questions or pits encountered in the interview. You are also welcome to add and share. I hope everyone can find a satisfactory job and encourage each other~

Software Test Engineer Interview Questions

  1. Test FAQs and procedures

  2. Test tools

  3. Computer network knowledge and database

  4. Linux and Python programming skills

  5. Automated testing (Selenium, Appium and interface testing) and performance testing

  6. Soft quality (torture of 10 souls) and rhetorical interviewer

Linux skills

  1. What Linux commands are commonly used at work?

    awk,sed,vim,iotop,dstat,cp,top,ifconfig,pwd,cd,ll,ls,cat,tail,grep,mv,rm,mkdir,df,du

  2. What commands can help Linux execute scripts uploaded by Windows?

* Change coding format

* vim test.sh

* :set ff?// If dos is displayed

* :set ff=unix:wq
  1. Brief introduction to Linux three swordsmen
* grep command



  * According to the mode specified by the user pattern Filter the target text and display the lines matched by the pattern;

  * `grep [options] pattern [file]`

  * Common parameters:

    * -v Display not pattern Matched rows

    * -i Ignore the case of characters

    * -n Show matching line numbers

    * -c Count the number of matched rows

    * -o Show only matching strings

    * -E use ERE,amount to egrep(More regular expression rules can be recognized)

* sed command

  * Stream editor, used to process a row of data. Store a row of data in the schema space->use sed Command processing->Feed into screen->Empty the space.

  * Common parameters:

    * -h Show help

    * -n Show only script Results after treatment

    * -e The specified script to process the input text file

    * -f Process with the specified script file

  * Common actions:

    * a: newly added sed -e '4 a newline'

    * c: replace sed -e '2,5c No 2-5 number'

    * d: delete sed -e '2,5d'

    * i: insert sed -ed '2i newline'

    * p: Print sed -n '/root/p'

    * s: replace sed -e 's/old/new/g'

    * g: Represent the overall situation

* awk command

  *       * Read the file line by line, and slice each line with space as the default separator. Take the line as input and assign it to`$0`->Segment the line from`$1`start->Regular matching of rows/Execute action->Print content;

  * `awk 'pattern + action' [filenames]`

  * Common syntax:

    * filename awk Browse file name

    * begin What to do before processing text

    * end What to do after processing text

    * fs Set the input field separator, which is equivalent to the command line-F option

    * nf Number of fields (columns) of browsing records

    * nr Number of records read (rows)

  * Common parameters:

    * ofs Output field separator 

    * ors Output record separator

    * rs Control record separator, line break flag

    * `$0` Whole record

    * `$1` First separated record
  1. How to locate the log under the Linux server through the command?
* If you want to monitor logs, use `tail -f | grep xxx` Command to filter the required fields;

* If you view content in a full log, use `cat xxx.log | grep xxxx | awk '{print $1}'` And other commands to filter the content you need;
  1. Briefly describe the environmental construction and maintenance in the project
* Start with common systems, such as your own experience CentOS and Ubuntu Speaking of, system installation is mainly about disk partition and disk array;

* Basic environment dependency, such as MySQL,Redis,Jenkins,Docker,Other dependent environments used in the project;

* Convenient maintenance mainly starts from the errors encountered, such as inability to connect remotely, server reinforcement, etc;

Python Programming

  1. The difference between class method, class instance method and static method in Python
* Instance method: called by object; At least one self Parameters; When the normal method is called, it will be automatically assigned to the object self;

* Class method: called by class; At least one cls Parameters; When a class method is executed, the class that calls the method is automatically copied to the cls;

* Static method: called by class; No default parameters;
  1. The difference between dict, tuple and list (the main difference is listed here, and the interview is enough)
* tuple Is an immutable object, list and dict All are mutable objects. Immutability here refers to immutable pointing addresses;

* list It's orderly, dict It is disordered and cannot store ordered sets;

* dict The search speed is fast. No matter how many elements there are, the time is the same, list The search speed is slow and needs to be searched orderly;

* dict of key Is immutable and non repeatable, list You can repeat and store any object;
  1. The difference between JSON and dict
* JSON Is a data format, pure string. dict Is a complete data structure;

* dict Is a complete data structure, right Hash Table An implementation of this data structure is a set of encapsulated scheme from storage to extraction. It uses the built-in hash function to plan key corresponding value Storage location to obtain O(1)Data reading speed;

* JSON of key Can only be strings, Python of dict Can be any hash Object (immutable object);

* JSON of key Can be ordered and repeatable; dict of key Non repeatable and disordered;

* JSON arbitrarily key There are default values undefined,dict There is no default value by default;

* JSON The access method can be[],It can also be.,Traversal mode in,of;dict of value Only subscript access;

* dict Can be nested tuple,JSON There are only arrays in the;
  1. Does Python have memory leaks and why?
* When objects are referenced to each other and then deleted, the object may not be released and leakage may occur;

* The above is personal understanding. Please supplement if you have any other information;
  1. Synchronization and asynchrony in Python
* The result of getting the final result directly is synchronous call.

* The final result that is not obtained directly is asynchronous call.

* The difference between synchronous and asynchronous is whether the caller gets the desired end result.
  1. Common hand tearing code questions
  • Two lists are extracted as dictionaries
dict(zip(list1, list2))  
  • String inversion output
str = '1234567890'  
print(str[::-1])  
  
l = list(str)  
l.reverse()  
print(''.join(l))  
  • Realize Fibonacci sequence
def Fibonacci(loop):  
    if loop == 0:  
        return 'invalid parameter'  
    elif loop == 1:  
        return 0  
    l = [0, 1]  
    for i in range(2, loop):  
        l.append(l[i - 1] + l[i - 2])  
    return l  
  • Find the maximum value of hump array
li = [1, 2, 10, 10, 2, 1]  
print([v for v in li if v == max(li)])  
  • Narcissistic number
sxh = []  
for i in range(100, 1000):  
    s = 0  
    for j in str(i):  
        s += int(j)**3  
    if i == int(j)**3:  
        sxh.append(i)  
print(sxh)  
  • Perfect number
a = []  
for i in range(1, 1000):  
    s = 0  
    for j in range(1, i):  
        if i % j == 0 and j < i:  
            s += j  
    if s == i:  
        a.append(i)  
  • Recursion of power

    def mi(a, n):
    if n == 0:
    return 1
    else:
    return a * mi(a, n - 1)

  • directory traversal

import os  
  
def get_file(path, rule=''):  
    files = []  
    for fpath, dirs, fs in os.walk(path):  
        for f in fs:  
            if os.path.join(fpath, f).endswith(rule):  
                files.append(f)  
    return files

[related reading]

**
Come to Hogwarts test and development society to learn more advanced technologies of software testing and test development. The knowledge points include web automated testing, app automated testing, interface automated testing, test framework, performance testing, security testing, continuous integration / continuous delivery / DevOps, test left, test right, precision testing, test platform development, test management, etc, The course technology covers bash, pytest, junit, selenium, appium, postman, requests, httprunner, jmeter, jenkins, docker, k8s, elk, sonarqube, Jacobo, JVM sandbox and other related technologies, so as to comprehensively improve the technical strength of test and development engineers

Click for more information

Added by duclet on Tue, 08 Mar 2022 10:37:26 +0200