项目产品面试
“世风日下”四人小组知识库
# 存储
- 心跳口怎么通信?(ICE) https://blog.csdn.net/lycb_gz/article/details/8729590 万兆以太网规范 (opens new window)
- 产品规格(64 核,飞腾 2000)
- 接管流程?接管时间指标
- 多看看别人的产品怎么设计
- 怎么看待产品经理这个岗位?这个岗位都做什么
- 技术选型: Python vs JAVA
- 喜欢和测试打交道吗?
- 竞品:你们产品和别家产品有没有什么不同?优势在哪?
- 对象存储了解吗?
- 讲一下你们的分布式存储架构;
# Python 面试
# 编程
- 单例模式
# 装饰器
def singleton(cls):
instances = {}
def wrapper(*args, **kw):
if cls not in instances:
instances[cls] = cls(*args, **kw)
return instances[cls]
return wrapper
@singleton
class MyClass:
pass
# new 方法
class Singleton:
_instance = None
def __new__(cls,*args,**kwargs):
if not cls._instance:
# cls._instance = super(Singleton,cls).__new__(cls,*args,**kwargs)
cls._instance = super().__new__(cls,*args,**kwargs)
return cls._instance
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 装饰器实现
time_it
和count_it
import time
from functools import wraps
def time_it(func):
@wraps(func)
def wrapper(*args, **kwargs):
t1 = time.time()
ret = func(*args, **kwargs)
cost_time = time.time()-t1
print(cost_time)
return ret
return wrapper
def count_it(func):
count = 0
@wraps(func)
def wrapper(*args, **kwargs):
nonlocal count
count += 1
ret = func(*args, **kwargs)
print(count)
return ret
return wrapper
# python2 实现
def counter(func):
"""
A decorator that counts and prints the number of times a function has been executed
"""
def wrapper(*args, **kwargs):
wrapper.count = wrapper.count + 1
res = func(*args, **kwargs)
print "{0} has been used: {1}x".format(func.__name__, wrapper.count)
return res
wrapper.count = 0
return wrapper
@time_it
@count_it
def func():
pass
for i in range(5):
func()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
- 生成器实现斐波纳切
def fib(num):
n,a,b = 0,0,1
while n < num:
yield b
a,b = b,a+b
n += 1
for i in fib(5):
print(i)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# 算法/数据结构
深度优先遍历
设计栈
大数据量列表求差集的设计思路 hash、布隆过滤器
# 进程
- 进程消息传递与控制
编辑 (opens new window)
上次更新: 2024-07-15, 03:27:09