InterviewTreedInterviewTreed

The question library

Technical interview questions and answers

Explore practical questions, clear explanations, and code examples across developer technologies.

Showing 2929–2940 of 3610 questions

Python ProgrammingIntermediate1 min read

Shallow vs deep copy

A shallow copy duplicates the outer container but shares nested objects; deep copy recursively copies nested structures.

Python ProgrammingIntermediate1 min read

Exceptions

try/except handles expected errors; else and finally support success and cleanup paths.

Python ProgrammingIntermediate1 min read

Context managers

A context manager manages setup and cleanup, commonly with the with statement.

Python ProgrammingIntermediate1 min read

pathlib

pathlib provides cross-platform path operations using Path objects.

Python ProgrammingIntermediate1 min read

Modules and packages

A module is commonly a Python file; a package organizes related modules under a namespace.

Python ProgrammingIntermediate1 min read

__main__ guard

The main guard runs code only when a module is executed directly, not when imported.

Python ProgrammingIntermediate1 min read

Decorators

A decorator wraps or transforms a function or class to add behavior.

Python ProgrammingIntermediate1 min read

Dataclasses

dataclasses generate common methods for classes mainly used to store data.