🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Design a News Feed: all 10 questions

Quiz: Design a News Feed · Question 4 of 10

What does this print? (code)

What does this print?

pushed = [(5, "a"), (2, "b")]
pulled = [(4, "c"), (1, "d")]
feed = sorted(pushed + pulled, reverse=True)[:3]
print([x for t, x in feed])
  1. A.['a', 'b', 'c']
  2. B.['a', 'c', 'b']
  3. C.['c', 'a', 'b']
  4. D.['a', 'c', 'd']
Answer & explanation

Correct answer: ['a', 'c', 'b']

Merged by time, newest first: 5, 4, 2.

Can you get the rest right without peeking?

Take the timed Quiz: Design a News Feed quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →