15 Standard Library & Idioms questions from the Python bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.
Free to start: the 2-minute IT readiness check — six questions and a result.
A.an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
B.an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
C.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
D.the match statement, added in 3.10, that branches by destructuring a value against case patterns
Answer + AI explanation with Pro
2. Which term means: "an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__"?
Junior
A.type hint
B.f-string
C.context manager
D.structural pattern matching
Answer + AI explanation with Pro
3. Which statement is correct?
Junior
A.context manager — the match statement, added in 3.10, that branches by destructuring a value against case patterns
B.context manager — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
C.context manager — an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
D.context manager — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
Answer + AI explanation with Pro
4. What is dataclass?
Junior
A.a decorator that auto-generates init, repr, and equality methods from annotated class attributes
B.an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
C.an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
D.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
Answer + AI explanation with Pro
5. Which term means: "a decorator that auto-generates init, repr, and equality methods from annotated class attributes"?
Junior
A.type hint
B.dataclass
C.structural pattern matching
D.context manager
Answer + AI explanation with Pro
6. Which statement is correct?
Junior
A.dataclass — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
B.dataclass — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
C.dataclass — a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
D.dataclass — the match statement, added in 3.10, that branches by destructuring a value against case patterns
Answer + AI explanation with Pro
7. What is type hint?
Mid
A.the match statement, added in 3.10, that branches by destructuring a value against case patterns
B.an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
C.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
D.an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
Answer + AI explanation with Pro
8. Which term means: "an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime"?
Mid
A.context manager
B.dataclass
C.type hint
D.f-string
Answer + AI explanation with Pro
9. Which statement is correct?
Mid
A.type hint — an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
B.type hint — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
C.type hint — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
D.type hint — the match statement, added in 3.10, that branches by destructuring a value against case patterns
Answer + AI explanation with Pro
10. What is f-string?
Mid
A.the match statement, added in 3.10, that branches by destructuring a value against case patterns
B.a decorator that auto-generates init, repr, and equality methods from annotated class attributes
C.an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
D.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
Answer + AI explanation with Pro
11. Which term means: "a string literal prefixed with f that interpolates embedded expressions inside braces at runtime"?
Mid
A.f-string
B.context manager
C.structural pattern matching
D.dataclass
Answer + AI explanation with Pro
12. Which statement is correct?
Mid
A.f-string — a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
B.f-string — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
C.f-string — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
D.f-string — the match statement, added in 3.10, that branches by destructuring a value against case patterns
Answer + AI explanation with Pro
13. What is structural pattern matching?
Senior
A.the match statement, added in 3.10, that branches by destructuring a value against case patterns
B.an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
C.a decorator that auto-generates init, repr, and equality methods from annotated class attributes
D.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
Answer + AI explanation with Pro
14. Which term means: "the match statement, added in 3.10, that branches by destructuring a value against case patterns"?
Senior
A.f-string
B.structural pattern matching
C.context manager
D.type hint
Answer + AI explanation with Pro
15. Which statement is correct?
Senior
A.structural pattern matching — an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
B.structural pattern matching — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
C.structural pattern matching — the match statement, added in 3.10, that branches by destructuring a value against case patterns
D.structural pattern matching — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
Answer + AI explanation with Pro
Free to start
Start with a free readiness check
Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Standard Library & Idioms question come with Pro.