🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: How LLMs Work: all 10 questions

Quiz: How LLMs Work · Question 6 of 10

What does this print? (code)

What does this print?

from collections import Counter, defaultdict
words = "the exam is easy . the exam is long . the result is out".split()
following = defaultdict(Counter)
for current, nxt in zip(words, words[1:]):
    following[current][nxt] += 1
print(following["the"].most_common(1)[0])
  1. A.('result', 1)
  2. B.('exam', 2)
  3. C.('is', 3)
  4. D.('the', 3)
Answer & explanation

Correct answer: ('exam', 2)

"exam" follows "the" twice and "result" once.

Can you get the rest right without peeking?

Take the timed Quiz: How LLMs Work quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →