Python track

Python interview questions and answers

Panel-ready Python & Django questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.

41 Moderate Signals Python

How do weak references affect Django signal receivers?

Short take Full answer on next page

Simple meaning

By default Django stores receivers as weak references, so a local function can be garbage-collected and silently stop running.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
42 Moderate Signals Python

When should you avoid Django signals?

Short take Full answer on next page

Simple meaning

Avoid them for core business rules that callers must understand

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
44 Moderate DRF Python

How does a ViewSet differ from GenericAPIView?

Short take Full answer on next page

Simple meaning

GenericAPIView plus mixins gives you get/post handlers and queryset/serializer_class.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
45 Moderate DRF Python

What do DRF routers do?

Short take Full answer on next page

Simple meaning

DefaultRouter and SimpleRouter bind viewset actions to URL patterns including optional trailing slashes.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
47 Moderate DRF Python

How does pagination work in DRF?

Short take Full answer on next page

Simple meaning

Pagination classes split list querysets into pages and add next/previous metadata.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
48 Moderate DRF Python

How do you serialize nested relations in DRF?

Short take Full answer on next page

Simple meaning

Nest a serializer as a field, or use depth on ModelSerializer for read-only trees.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
50 Moderate Celery Python

How do delay and apply_async differ?

Short take Full answer on next page

Simple meaning

delay(*args, **kwargs) is a shortcut for apply_async.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
51 Moderate Celery Python

How do you retry a failed Celery task?

Short take Full answer on next page

Simple meaning

Bind the task with bind=True and call self.retry(exc=exc, countdown=seconds) inside the catch block, or set autoretry_for and retry_backoff.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
52 Moderate Celery Python

What is Celery Beat?

Short take Full answer on next page

Simple meaning

Beat is a scheduler that enqueues periodic tasks according to a schedule in code or the database.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
54 Moderate Caching Python

How should you design Django cache keys?

Short take Full answer on next page

Simple meaning

Include a version or key prefix, the resource id, and any vary dimension such as locale.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
55 Moderate Caching Python

When would you choose Redis, Memcached, or LocMemCache?

Short take Full answer on next page

Simple meaning

LocMemCache is per-process and wrong for multi-worker production because each Gunicorn worker has its own dict.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
59 Moderate Testing Python

How can you catch N+1 queries in tests?

Short take Full answer on next page

Simple meaning

assertNumQueries(n) on TestCase fails when the count drifts.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
Prev Page 3 of 5 Next
Chat with us