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

Quiz: Embeddings and Search · Question 6 of 10

What does this print? (code)

What does this print?

import math
a, b = [1, 0], [0, 1]
dot = sum(x * y for x, y in zip(a, b))
cos = dot / (math.hypot(*a) * math.hypot(*b))
print(cos)
  1. A.0.0
  2. B.1.0
  3. C.-1.0
  4. D.0.5
Answer & explanation

Correct answer: 0.0

The vectors are at right angles, so they are unrelated: cosine similarity 0.

Can you get the rest right without peeking?

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

Start the quiz →