Comprehensions & Iterators interview questions

15 real Comprehensions & Iterators 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 list comprehension?

Junior
  1. A.an object that can return a fresh iterator via __iter__, such as a list or string
  2. B.a bracketed expression that builds a new list eagerly by iterating over a source
  3. C.a brace-delimited expression of the form key:value that builds a mapping from an iterable
  4. D.a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.list comprehension — an object that can return a fresh iterator via __iter__, such as a list or string
  2. B.list comprehension — a bracketed expression that builds a new list eagerly by iterating over a source
  3. C.list comprehension — a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
  4. D.list comprehension — an object implementing __next__ that produces successive values and raises StopIteration when exhausted
Reveal the answer + AI explanation — free account

4. What is generator expression?

Mid
  1. A.a brace-delimited expression of the form key:value that builds a mapping from an iterable
  2. B.a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
  3. C.an object implementing __next__ that produces successive values and raises StopIteration when exhausted
  4. D.an object that can return a fresh iterator via __iter__, such as a list or string
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Mid
  1. A.generator expression — a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
  2. B.generator expression — an object implementing __next__ that produces successive values and raises StopIteration when exhausted
  3. C.generator expression — a bracketed expression that builds a new list eagerly by iterating over a source
  4. D.generator expression — an object that can return a fresh iterator via __iter__, such as a list or string
Reveal the answer + AI explanation — free account

7. What is dict comprehension?

Junior
  1. A.an object implementing __next__ that produces successive values and raises StopIteration when exhausted
  2. B.a brace-delimited expression of the form key:value that builds a mapping from an iterable
  3. C.a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
  4. D.a bracketed expression that builds a new list eagerly by iterating over a source
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Junior
  1. A.dict comprehension — a bracketed expression that builds a new list eagerly by iterating over a source
  2. B.dict comprehension — an object implementing __next__ that produces successive values and raises StopIteration when exhausted
  3. C.dict comprehension — a brace-delimited expression of the form key:value that builds a mapping from an iterable
  4. D.dict comprehension — a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
Reveal the answer + AI explanation — free account

10. What is iterator?

Mid
  1. A.an object that can return a fresh iterator via __iter__, such as a list or string
  2. B.a bracketed expression that builds a new list eagerly by iterating over a source
  3. C.an object implementing __next__ that produces successive values and raises StopIteration when exhausted
  4. D.a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.iterator — an object that can return a fresh iterator via __iter__, such as a list or string
  2. B.iterator — an object implementing __next__ that produces successive values and raises StopIteration when exhausted
  3. C.iterator — a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
  4. D.iterator — a brace-delimited expression of the form key:value that builds a mapping from an iterable
Reveal the answer + AI explanation — free account

13. What is iterable?

Mid
  1. A.a bracketed expression that builds a new list eagerly by iterating over a source
  2. B.a parenthesized comprehension that yields items lazily one at a time without building the whole sequence in memory
  3. C.an object that can return a fresh iterator via __iter__, such as a list or string
  4. D.a brace-delimited expression of the form key:value that builds a mapping from an iterable
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Mid
  1. A.iterable — a bracketed expression that builds a new list eagerly by iterating over a source
  2. B.iterable — an object implementing __next__ that produces successive values and raises StopIteration when exhausted
  3. C.iterable — an object that can return a fresh iterator via __iter__, such as a list or string
  4. D.iterable — a brace-delimited expression of the form key:value that builds a mapping from an iterable
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 Comprehensions & Iterators free