Embeddings & Similarity Questions with Answers

20 practice questions on Embeddings & Similarity (AI & Machine Learning) with answers and step-by-step solutions. Try 10 samples below, then practise all 20 free in the AptiNest app.

Sample questions

Question 1Easy

For vectors normalised to unit length, the dot product equals:

  1. The sum of their elements
  2. Their Euclidean distance
  3. Zero always
  4. Their cosine similarity

Answer: D. Their cosine similarity

Explanation

cos = a.b / (|a||b|) and the norms are 1.

Step-by-step solution

  1. cos(a, b) = a.b / (|a| |b|).
  2. For unit vectors |a| = |b| = 1.
  3. So cos(a, b) = a.b.

Why the other options are wrong

  • A. Summing elements is not a dot product of two vectors.
  • B. Distance decreases as the dot product increases; they are not equal.
  • C. The dot product is zero only for perpendicular vectors.

Question 2Easy

A sentence embedding model maps each sentence to:

  1. A single integer ID
  2. A fixed-length vector
  3. An image
  4. A variable-length list of words

Answer: B. A fixed-length vector

Explanation

Fixed-size vectors make similarity search and clustering of sentences possible.

Step-by-step solution

  1. A sentence embedding model reads a sentence of any length.
  2. It outputs one vector of fixed size (e.g. 384 or 768 numbers).
  3. Fixed size lets any two sentences be compared directly.

Why the other options are wrong

  • A. An ID carries no meaning for similarity.
  • C. Text models output vectors, not images.
  • D. A list of words is the input, not the embedding.

Question 3Easy

An embedding is:

  1. A dense vector
  2. A label for a class
  3. A compressed ZIP file
  4. A database index on text

Answer: A. A dense vector

Explanation

Embeddings capture meaning so similar items are close in vector space.

Step-by-step solution

  1. An embedding maps an item (word, image, user) to numbers.
  2. It is a dense vector, usually of a few hundred dimensions.
  3. Similar items get similar vectors.

Why the other options are wrong

  • B. A label is a category, not a vector.
  • C. ZIP files are byte compression.
  • D. A database index is a lookup structure.

Question 4Easy

Which is the best use of embeddings in a recommendation system?

  1. Finding similar items
  2. Encrypting user IDs
  3. Sorting items alphabetically
  4. Compressing images losslessly

Answer: A. Finding similar items

Explanation

Users and items embedded in the same space can be matched by similarity.

Step-by-step solution

  1. Embed items so that similar items have nearby vectors.
  2. Find nearest neighbours of an item the user liked.
  3. Recommend those similar items.

Why the other options are wrong

  • B. Encryption is unrelated to embeddings.
  • C. Alphabetical sorting needs no learning.
  • D. Embeddings are lossy summaries, not lossless compression.

Question 5Medium

In classic word embeddings, vector("king") - vector("man") + vector("woman") is closest to:

  1. vector("queen")
  2. vector("kingdom")
  3. vector("woman") only by chance
  4. vector("man")

Answer: A. vector("queen")

Explanation

Embedding arithmetic can capture relationships such as gender as consistent directions.

Step-by-step solution

  1. king - man removes a 'male' direction, roughly leaving 'royalty'.
  2. Adding woman adds a 'female' direction.
  3. The nearest word to the result is typically queen.

Why the other options are wrong

  • B. Kingdom is related to king but not a gendered counterpart.
  • C. The result is reliably near queen, not woman by chance.
  • D. The man direction was subtracted.

Question 6Medium

What is the cosine similarity between (1, 1) and (1, 0), to three decimals?

  1. 0.500
  2. 1.000
  3. 0.866
  4. 0.707

Answer: D. 0.707

Explanation

1 / (sqrt(2) x 1) = 0.707.

Step-by-step solution

  1. Dot = 1 x 1 + 1 x 0 = 1.
  2. Lengths: sqrt(2) and 1.
  3. cos = 1 / sqrt(2) = 0.707.

Why the other options are wrong

  • A. 0.5 is cos 60 degrees.
  • B. 1.000 would need the same direction.
  • C. 0.866 is cos 30 degrees.

Question 7Medium

Reducing high-dimensional embeddings to 2-D for plotting is often done with:

  1. Gradient clipping
  2. One-hot encoding
  3. t-SNE, UMAP or PCA
  4. Max pooling

Answer: C. t-SNE, UMAP or PCA

Explanation

These techniques help visualise clusters, though distances in the plot are approximate.

Step-by-step solution

  1. Embeddings have hundreds of dimensions; plots need 2.
  2. PCA keeps the directions of greatest variance.
  3. t-SNE and UMAP preserve local neighbourhoods, showing clusters well.

Why the other options are wrong

  • A. Gradient clipping is a training safeguard.
  • B. One-hot encoding increases dimensions.
  • D. Max pooling shrinks image feature maps.

Question 8Medium

Approximate nearest-neighbour (ANN) indexes such as HNSW are used because:

  1. They work only with images
  2. Exact search is slow
  3. They always return exact results
  4. They need no memory

Answer: B. Exact search is slow

Explanation

ANN trades a little recall for large speed-ups in vector search.

Step-by-step solution

  1. Exact nearest-neighbour search compares the query with every vector.
  2. With millions of vectors, that is too slow.
  3. ANN indexes like HNSW find almost the best matches far faster.

Why the other options are wrong

  • A. ANN indexes work for any vectors, text included.
  • C. Approximate means results may occasionally miss the true nearest neighbour.
  • D. ANN indexes use extra memory for their structure.

Question 9Hard

Normalising (2, 3, 6) to unit length gives:

  1. (0.2, 0.3, 0.6)
  2. (2/7, 3/7, 6/7)
  3. (1, 1, 1)
  4. (2/11, 3/11, 6/11)

Answer: B. (2/7, 3/7, 6/7)

Explanation

Divide each component by the norm 7.

Step-by-step solution

  1. Length = sqrt(4 + 9 + 36) = 7.
  2. Divide each entry by 7.
  3. (2/7, 3/7, 6/7).

Why the other options are wrong

  • A. Dividing by 10 does not give length 1.
  • C. (1, 1, 1) changes the direction.
  • D. Dividing by 11 uses the L1 norm.

Question 10Hard

Embeddings for search are compared with cosine similarity. A document vector is accidentally scaled by 10. How does its cosine score change?

  1. It becomes 10 times larger
  2. It becomes 0
  3. It becomes negative
  4. It does not change

Answer: D. It does not change

Explanation

Cosine depends only on direction, not magnitude; a raw dot product would change.

Step-by-step solution

  1. cos = a.b / (|a| |b|).
  2. Scaling b by 10 multiplies a.b by 10 and |b| by 10.
  3. The factors cancel, so cosine is unchanged.

Why the other options are wrong

  • A. The dot product grows tenfold, but cosine does not.
  • B. Only a zero vector would break the score.
  • C. A positive scale cannot flip direction.

Practise all 20 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all AI & Machine Learning topics · All topics