🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Hybrid Search and BM25: all 10 questions

Quiz: Hybrid Search and BM25 · Question 6 of 10

What does this print? (code)

What does this print?

def rrf(rankings, k=60):
    scores = {}
    for ranking in rankings:
        for rank, doc in enumerate(ranking, start=1):
            scores[doc] = scores.get(doc, 0) + 1 / (k + rank)
    return max(scores, key=scores.get)

print(rrf([["a", "b", "c"], ["c", "b", "a"], ["b", "c", "a"]]))
  1. A.a
  2. B.b
  3. C.c
  4. D.a tie error
Answer & explanation

Correct answer: b

b has ranks 2, 2, 1 (sum of 1/62 + 1/62 + 1/61), slightly ahead of c with ranks 3, 1, 2.

Can you get the rest right without peeking?

Take the timed Quiz: Hybrid Search and BM25 quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →