Standard Library & Idioms interview questions

15 real Standard Library & Idioms questions from the Python bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is context manager?

Junior
  1. A.an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
  2. B.an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
  3. C.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
  4. D.the match statement, added in 3.10, that branches by destructuring a value against case patterns
Reveal the answer + AI explanation — free account

2. Which term means: "an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__"?

Junior
  1. A.type hint
  2. B.f-string
  3. C.context manager
  4. D.structural pattern matching
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.context manager — the match statement, added in 3.10, that branches by destructuring a value against case patterns
  2. B.context manager — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
  3. C.context manager — an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
  4. D.context manager — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
Reveal the answer + AI explanation — free account

4. What is dataclass?

Junior
  1. A.a decorator that auto-generates init, repr, and equality methods from annotated class attributes
  2. B.an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
  3. C.an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
  4. D.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.dataclass — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
  2. B.dataclass — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
  3. C.dataclass — a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
  4. D.dataclass — the match statement, added in 3.10, that branches by destructuring a value against case patterns
Reveal the answer + AI explanation — free account

7. What is type hint?

Mid
  1. A.the match statement, added in 3.10, that branches by destructuring a value against case patterns
  2. B.an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
  3. C.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
  4. D.an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.type hint — an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
  2. B.type hint — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
  3. C.type hint — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
  4. D.type hint — the match statement, added in 3.10, that branches by destructuring a value against case patterns
Reveal the answer + AI explanation — free account

10. What is f-string?

Mid
  1. A.the match statement, added in 3.10, that branches by destructuring a value against case patterns
  2. B.a decorator that auto-generates init, repr, and equality methods from annotated class attributes
  3. C.an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
  4. D.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.f-string — a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
  2. B.f-string — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
  3. C.f-string — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
  4. D.f-string — the match statement, added in 3.10, that branches by destructuring a value against case patterns
Reveal the answer + AI explanation — free account

13. What is structural pattern matching?

Senior
  1. A.the match statement, added in 3.10, that branches by destructuring a value against case patterns
  2. B.an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
  3. C.a decorator that auto-generates init, repr, and equality methods from annotated class attributes
  4. D.a string literal prefixed with f that interpolates embedded expressions inside braces at runtime
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Senior
  1. A.structural pattern matching — an optional annotation declaring the expected type of a variable, parameter, or return value, unenforced at runtime
  2. B.structural pattern matching — a decorator that auto-generates init, repr, and equality methods from annotated class attributes
  3. C.structural pattern matching — the match statement, added in 3.10, that branches by destructuring a value against case patterns
  4. D.structural pattern matching — an object used with a with statement that guarantees setup and cleanup around a block via __enter__ and __exit__
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Standard Library & Idioms free