🖥️ 后端技术 - PYTHON

共 45 道题目

#1 初级

Python函数默认参数为什么不建议使用可变类型?

Why is it not recommended to use mutable types as default arguments in Python?

**Why is it not recommended to use mutable types as default arguments in Python?**

*考察点:可变类型默认参数陷阱。*
#2 初级

浅拷贝和深拷贝有什么区别?

What's the difference between shallow copy and deep copy?

**What's the difference between shallow copy and deep copy?**

*考察点:引用传递、浅拷贝、深拷贝。*
#3 初级

列表推导式和生成器表达式有什么区别?

What's the difference between list comprehension and generator expression?

**What's the difference between list comprehension and generator expression?**

*考察点:内存效率、惰性求值。*
#4 初级

闭包中的late binding是什么问题?

What is the late binding issue in closures?

**What is the late binding issue in closures?**

*考察点:闭包、作用域、late binding。*
#5 初级

如何实现一个带参数的装饰器来记录函数执行时间?

How to implement a decorator with arguments that records function execution time?

**How to implement a decorator with arguments that records function execution time?**

*考察点:装饰器原理、高阶函数。*
#6 初级

Django的MTV架构模式是什么?与传统MVC有什么区别?

What is Django's MTV architecture? How is it different from traditional MVC?

**What is Django's MTV architecture? How is it different from traditional MVC?**

*考察点:Django架构理解、框架设计模式。*
#7 初级

Django中URL路由的匹配顺序是怎样的?

How does Django match URL patterns?

**How does Django match URL patterns?**

*考察点:URL路由匹配规则。*
#8 初级

Django ORM中的N+1查询问题是什么?

What is the N+1 query problem in Django ORM?

**What is the N+1 query problem in Django ORM?**

*考察点:N+1查询问题。*
#9 初级

Django模板中如何防止XSS攻击?

How does Django prevent XSS attacks in templates?

**How does Django prevent XSS attacks in templates?**

*考察点:XSS防护、模板自动转义。*
#10 初级

Django中静态文件和媒体文件有什么区别?

What's the difference between static files and media files in Django?

**What's the difference between static files and media files in Django?**

*考察点:静态资源管理、部署配置。*
#11 初级

Django的CSRF保护机制是如何工作的?

How does Django's CSRF protection work?

**How does Django's CSRF protection work?**

*考察点:CSRF攻击防护。*
#12 初级

Django Form和ModelForm有什么区别?

What's the difference between Form and ModelForm?

**What's the difference between Form and ModelForm?**

*考察点:表单系统、代码复用。*
#13 初级

如何自定义Django Admin列表显示?

How to customize Django Admin list display?

**How to customize Django Admin list display?**

*考察点:Admin自定义。*
#14 初级

makemigrations和migrate有什么区别?

What's the difference between makemigrations and migrate?

**What's the difference between makemigrations and migrate?**

*考察点:数据库迁移管理。*
#15 初级

Python虚拟环境解决了什么问题?

What problem does Python virtual environment solve?

**What problem does Python virtual environment solve?**

*考察点:依赖管理、环境隔离。*
#1 中级

什么是生成器?与普通函数有什么区别?

What are generators? How are they different from regular functions?

**What are generators? How are they different from regular functions?**

*考察点:生成器原理、惰性求值。*
#2 中级

如何实现一个上下文管理器?

How to implement a context manager?

**How to implement a context manager?**

*考察点:资源管理、异常处理。*
#3 中级

Python中*args和

What are the unpacking rules for *args and kwargs in Python?

**What are the unpacking rules for *args and **kwargs in Python?**

*考察点:参数传递、参数解包。*
#4 中级

Django QuerySet的惰性求值是什么?

What is lazy evaluation in Django QuerySet?

**What is lazy evaluation in Django QuerySet?**

*考察点:QuerySet惰性求值。*
#5 中级

select_related和prefetch_related有什么区别?

What's the difference between select_related and prefetch_related?

**What's the difference between select_related and prefetch_related?**

*考察点:JOIN查询优化。*
#6 中级

Django模型中related_name的作用是什么?

What is the purpose of related_name in Django models?

**What is the purpose of related_name in Django models?**

*考察点:反向关系、related_name。*
#7 中级

如何使用only()和defer()优化Django查询?

How to optimize Django queries using only() and defer()?

**How to optimize Django queries using only() and defer()?**

*考察点:字段级查询优化。*
#8 中级

Django CBV中as_view()方法做了什么?

What does as_view() do in Django CBV?

**What does as_view() do in Django CBV?**

*考察点:CBV原理、方法解析顺序。*
#9 中级

JsonResponse和HttpResponse有什么区别?

What's the difference between JsonResponse and HttpResponse?

**What's the difference between JsonResponse and HttpResponse?**

*考察点:HTTP响应类型、Content-Type。*
#10 中级

Django信号机制的工作原理是什么?

How does Django's signal mechanism work?

**How does Django's signal mechanism work?**

*考察点:信号机制、事务处理。*
#11 中级

Django中间件的执行流程是怎样的?

How does Django middleware execution flow work?

**How does Django middleware execution flow work?**

*考察点:中间件生命周期、洋葱模型。*
#12 中级

如何实现一个JWT认证中间件?

How to implement a JWT authentication middleware?

**How to implement a JWT authentication middleware?**

*考察点:认证机制、JWT原理。*
#13 中级

如何实现基于对象的权限控制?

How to implement object-level permissions?

**How to implement object-level permissions?**

*考察点:权限系统、对象级权限。*
#14 中级

Django Session的存储后端有哪些?各有什么特点?

What are the Django session storage backends? What are their characteristics?

**What are the Django session storage backends? What are their characteristics?**

*考察点:Session存储策略。*
#15 中级

Python的GIL是什么?对并发有什么影响?

What is Python's GIL? How does it affect concurrency?

**What is Python's GIL? How does it affect concurrency?**

*考察点:GIL理解、并发vs并行。*
#1 高级

DRF嵌套序列化器有什么性能问题?

What are the performance issues with nested serializers in DRF?

**What are the performance issues with nested serializers in DRF?**

*考察点:DRF性能优化、嵌套序列化。*
#2 高级

如何实现writable nested serializer?

How to implement writable nested serializers in DRF?

**How to implement writable nested serializers in DRF?**

*考察点:嵌套写入、事务管理。*
#3 高级

如何实现多租户权限控制?

How to implement multi-tenant permissions in DRF?

**How to implement multi-tenant permissions in DRF?**

*考察点:多租户架构、数据隔离。*
#4 高级

如何实现API限流?

How to implement API throttling in DRF?

**How to implement API throttling in DRF?**

*考察点:限流算法、API保护。*
#5 高级

如何优化Django的复杂查询?

How to optimize complex Django queries?

**How to optimize complex Django queries?**

*考察点:复杂查询优化、聚合查询。*
#6 高级

如何防止缓存穿透、缓存雪崩、缓存击穿?

How to prevent cache penetration, cache avalanche, and cache breakdown?

**How to prevent cache penetration, cache avalanche, and cache breakdown?**

*考察点:缓存架构、高可用设计。*
#7 高级

Celery的工作原理是什么?

How does Celery work?

**How does Celery work?**

*考察点:异步任务架构、消息队列。*
#8 高级

如何设计数据库读写分离?

How to design database read/write splitting in Django?

**How to design database read/write splitting in Django?**

*考察点:数据库架构、主从复制。*
#9 高级

如何设计RESTful API的版本管理?

How to design RESTful API versioning?

**How to design RESTful API versioning?**

*考察点:API设计、版本管理。*
#10 高级

如何实现分布式事务?

How to implement distributed transactions?

**How to implement distributed transactions?**

*考察点:分布式系统、事务一致性。*
#11 高级

Django应用常见的安全隐患有哪些?

What are common security vulnerabilities in Django applications?

**What are common security vulnerabilities in Django applications?**

*考察点:Web安全、漏洞防护。*
#12 高级

如何管理Django的配置?

How to manage Django configuration following 12-Factor App principles?

**How to manage Django configuration following 12-Factor App principles?**

*考察点:配置管理、环境隔离。*
#13 高级

如何容器化Django应用?

How to containerize Django applications?

**How to containerize Django applications?**

*考察点:容器化、Docker最佳实践。*
#14 高级

如何实现Django应用的可观测性?

How to implement observability for Django applications?

**How to implement observability for Django applications?**

*考察点:可观测性、日志系统、监控告警。*
#15 高级

如何设计Django应用的高可用架构?

How to design high availability architecture for Django applications?

**How to design high availability architecture for Django applications?**

*考察点:高可用架构、故障恢复、弹性设计。*