🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Comprehensions and Lambda: questions with answers

15 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does [x 2 for x in range(4)] give?
  2. Q2. What does [c for c in "hello" if c not in "aeiou"] give?
  3. Q3. What does list(map(len, ["a", "bb", "ccc"])) return?
  4. Q4. What is max(["kiwi", "banana", "fig"], key=len)?
  5. Q5. What is missing from a recursive function that causes a RecursionError?
  6. Q6. What does this print? (code)
  7. Q7. What does this print? (code)
  8. Q8. What does this print? (code)
  9. Q9. What does this print? (code)
  10. Q10. What does this print? (code)
  11. Q11. What does this print? (code)
  12. Q12. What does this print? (code)
  13. Q13. What does this print? (code)
  14. Q14. What does this print? (code)
  15. Q15. Why does the plain recursive Fibonacci become very slow for large n, and what fixes it?