Untitled
user_8555809
plain_text
02/20/2026 2:32 PM
7.7 KB
10
Indexable
Advanced Technical Interview Questions (With Expected Answers)
š Python (Advanced)
1) Explain GIL in Python. When does it become a bottleneck and how do you overcome it?
Expected Answer:
GIL (Global Interpreter Lock) allows only one thread to execute Python bytecode at a time.
Bottleneck in CPU-bound multithreaded programs.
Not a problem for I/O-bound tasks.
Solutions:
Use multiprocessing
Use C extensions (NumPy releases GIL)
Use async programming (for I/O bound)
Use alternative interpreters (Jython, PyPy ā limited cases)
2) Difference between asyncio, threading, and multiprocessing?
Expected Answer:
threading: Shared memory, affected by GIL.
multiprocessing: Separate processes, true parallelism, more memory.
asyncio: Single-threaded, cooperative multitasking, event loop.
Best choice depends on workload (CPU-bound vs I/O-bound).
3) What happens internally when you use a Python decorator?
Expected Answer:
Decorator is a higher-order function.
It wraps a function and returns a modified function.
Happens at function definition time.
Uses closures.
functools.wraps preserves metadata.
š FastAPI (Deep)
4) How does FastAPI achieve high performance?
Expected Answer:
Built on Starlette (ASGI framework)
Uses Pydantic for validation
Async support
Runs on Uvicorn (ASGI server)
Automatic OpenAPI generation
5) How do you handle background tasks and dependency injection in FastAPI?
Expected Answer:
BackgroundTasks class
Dependency injection using Depends()
Supports scoped dependencies
Can use middleware for cross-cutting concerns
ā AWS (Advanced)
6) Difference between EC2 Auto Scaling and Kubernetes HPA?
Expected Answer:
EC2 ASG scales VMs based on CloudWatch metrics.
HPA scales pods based on CPU/custom metrics.
HPA works inside cluster; ASG works at infrastructure level.
Best practice: Use both together.
7) How would you design a highly available system on AWS?
Expected Answer:
Multi-AZ deployment
ALB in front
Auto Scaling
RDS Multi-AZ
S3 for static content
Route53 health checks
Use IAM roles
š³ Docker (Advanced)
8) Explain difference between CMD and ENTRYPOINT.
Expected Answer:
ENTRYPOINT: fixed executable
CMD: default arguments
ENTRYPOINT + CMD used together
CMD overridden easily
9) What are multi-stage builds?
Expected Answer:
Reduce image size
Separate build and runtime environments
Improves security
āø Kubernetes (Deep)
10) What happens when a pod crashes?
Expected Answer:
Kubelet detects failure
Restart based on restart policy
ReplicaSet ensures desired replicas
If node fails ā rescheduled on another node
11) Explain difference between Deployment, StatefulSet, and DaemonSet.
Expected Answer:
Deployment ā stateless apps
StatefulSet ā stable identity, persistent storage
DaemonSet ā one pod per node
12) How does Kubernetes service discovery work?
Expected Answer:
Kube-DNS / CoreDNS
Service creates DNS entry
ClusterIP virtual IP
kube-proxy manages iptables rules
š¦ Terraform (Advanced)
13) What is Terraform state? Why is remote backend important?
Expected Answer:
State file maps infrastructure to config
Tracks resource metadata
Remote backend (S3 + DynamoDB lock)
Collaboration
State locking
Prevent corruption
ā Jenkins (Advanced)
14) Difference between scripted and declarative pipelines?
Expected Answer:
Declarative: simpler, structured syntax
Scripted: full Groovy flexibility
Declarative preferred for maintainability
š Prometheus
15) How does Prometheus pull metrics?
Expected Answer:
Pull-based model
Scrapes HTTP endpoints
Uses time-series DB
PromQL for queries
Alertmanager for alerts
š§ Linux (Advanced)
16) Explain what happens when you run a command in Linux.
Expected Answer:
Shell parses command
Fork system call
Exec replaces process image
Parent waits
Uses environment variables
š DevOps Scenario Question (Tough)
17) Your Kubernetes application is randomly restarting. How do you debug?
Expected Answer:
Check kubectl describe pod
Check events
Check logs
Check liveness/readiness probes
Check resource limits (OOMKilled?)
Check node status
Use kubectl top
š» Tough Coding Questions
š„ Coding Question 1 (Concurrency + Rate Limiting)
Implement a Thread-Safe Rate Limiter in Python
Design a rate limiter that:
Allows max 5 requests per 10 seconds
Thread-safe
Rejects excess requests
Expected Concepts:
threading.Lock
time window logic
deque
Example usage:
limiter = RateLimiter(5, 10)
if limiter.allow():
print("Allowed")
else:
print("Blocked")
This tests:
Concurrency
Data structures
Edge case handling
š„ Coding Question 2 (System Design + Algorithm)
Implement an LRU Cache from Scratch (Without Using OrderedDict)
Requirements:
O(1) get
O(1) put
Fixed capacity
Use HashMap + Doubly Linked List
Example:
cache = LRUCache(2)
cache.put(1,1)
cache.put(2,2)
cache.get(1) # returns 1
cache.put(3,3) # evicts key 2
Expected Concepts:
Hash map
Doubly linked list
Edge case handling
Memory efficiency
šÆ Bonus Extreme Scenario Question
18) Design a CI/CD pipeline for microservices deployed on Kubernetes using Jenkins and Terraform.
Expected Answer Should Include:
Git trigger
Build Docker image
Push to ECR
Terraform infra provisioning
Helm deployment
Rollback strategy
Blue-Green or Canary deployment
Monitoring with Prometheus
If you want, I can also give:
š„ Mock interview simulation
š§ System design whiteboard questions
š£ Real-world troubleshooting cases
š» Full solutions to coding problems
Tell me which one you want.Editor is loading...
Leave a Comment