Interview 00 basis python

Py10 first test

A written test

  1. What is language? What is a programming language? What is programming?
    Answer:
    Language is the medium of communication between people. Human and computer programming language is the medium of exchange. The program is designed to allow computers to work according to logical thinking person, replacing manpower.
  2. Brief classification of programming languages, as well as the advantages and disadvantages of each category.
    Answer:
    machine language: high efficiency advantages, disadvantages programming too complicated.
    Assembly: the advantages of high efficiency compared to high-level language, the disadvantage is too complex programming and implementation of efficient than machine language.
    High-level language: the advantages of low efficiency compared to other types, but the advantages of high development efficiency.
  3. Brief interpreted and compiled programming language?
    Answer:
    Interpreted: similar simultaneous translation, cross-platform, high development efficiency, low efficiency;
    compiled: Similar to Google translate, compile a permanent use, high efficiency, low development efficiency;
  4. b, B, KB, MB, GB relationship?
    Answer:
    8bit =. IB,
    1024B = 1KB,
    1024KB = 1MB,
    1024MB = 1GB
  5. DESCRIPTION five components of computer hardware.
    The answer:
    the CPU, memory, hard drive, input devices, output devices.
  6. Python implementation of the program in two ways, respectively?
    Answer:
    One way: interactive (small test code in)
    way: the command line
  7. Which is defined by the variables of three parts?
    Answer:
    variable name
    value of the variable
    "=" assignment
  8. How python implement single-line and multi-line comments
    Answer: # '' '' '', "" "" ""
  9. Description of small integers pools
    answer: integer used in the program is very extensive, Python in order to optimize speed, use a small integer object pooling, avoiding the frequent application is an integer and destruction of memory space. -5-256
  10. The role of the variable name is?
    Answer: can be used as a memory address corresponding to the ID number of variable values.

  11. Brief reference counting and garbage collection mechanism
    answer: variable values in memory as long as the binding to the variable name reference count +1,
    garbage collection will not bind variables variable name value recovery out!

  12. Guess achieve Age game features - after three failed wrong exit.
    answer:
age = 18
num = 0
while num < 3:
     info = int(input('请输入年龄:').strip())
     if info == 18:
          print('success')
          break
     elif info > 18:
          print('大了')
          num += 1
     elif info < 18:
          print('小了')
          num += 1
     else:
          print('error')
          num += 1
  1. Common data types include built-in method (at least 5)
    Answer: pass
  2. False native data types are there?
    Answer: empty, None, ""
  3. The assignments of the use of chain 10 assigned to the variable X, Y, Z.
    X = Y = Z = 10
  4. Value exchange achieved by line of code: A =. 1, B 2 =
    A, B = B, A
  5. The line of code info = [ 'tank', 18 , 'male'] in the list the user's name, age, gender, respectively assigned to a variable name, age, gender.
    = info [ 'Tank', 18 is, 'MALE']
    name, Age, Gender = info
  6. Please write some Python code that implements delete duplicate elements inside a list? (Unordered and ordered to go heavy weight)
 无序: list(set(l1))
 有序:
 list1 = [1,2,2,3,4,5,6,6,2,4,'aa','bb','aa']
 res = []
 for line in list1:
 if line not in res:
 res.append(line)
print(res)
  1. Please judge the following code results? (1 point)
# print(10 > 3 and 'alex' != 'sb' or 'abc' > 'd')
# print(10 > 3 and 'alex' == 'sb' or 'abc' < 'd')
# print(10 > 3 or 'alex' < 'sb' or 'abc' < 'd' and 'egon' == ‘nb')

# 逻辑运算符的优先级
not > and > or

The answer:
True
True
True

  1. 1-100 output all odd
    answer:
num = 1
while num < 101:
    if num % 2 == 1:
        print(num)
    num += 1
  1. Please explain the difference between break and continue
    answer:
    break: This layer out of circulation;
    continue: to continue to the end of the current logical next cycle;

  2. Common data types are: numbers, strings, lists, tuples, dictionaries, collection, classification.
# 按照存值个数分类?(1分)
'''
存单个:字符串
存多个:列表、元组、字典、集合
'''

# 按照可变\不可变类型分类?(1分)
'''
可变:列表、字典
不可变:数字、字符串、元组

'''

# 按照取值方式分类(直接取值,按索引,按key取)?(1分)
'''
直接取: 数字,字符串
索引取: 字符串、列表、元组
key取: 字典
'''

# 按照有序\无序分类?(1分)
'''
有序:字符串、列表、元组
无序:字典、集合
'''

Second Machine questions:

1. Log
2. Registration
3. cart function

Guess you like

Origin www.cnblogs.com/dreamlyue/p/12127903.html