Sample questions
Question 1Easy
- A Python library that trains new embedding models from scratch on your data
- A file format for storing vectors on disk
- An extension that adds vector types and similarity search to PostgreSQL
- A cloud service for GPU rentals
Answer: C. An extension that adds vector types and similarity search to PostgreSQL
Explanation
It lets teams keep vectors next to relational data and query them with SQL.
Step-by-step solution
- Pgvector is an extension for PostgreSQL.
- It adds a vector column type and similarity search.
- Teams can keep embeddings next to relational data and query them with SQL.
- So option C, an extension that adds vector types and similarity search to PostgreSQL, is correct.
Why the other options are wrong
- A. Pgvector stores and searches vectors; it does not train embedding models.
- B. Pgvector is not a file format for vectors on disk.
- D. Pgvector is not a GPU rental or cloud service.
Tip: Pgvector means vectors inside PostgreSQL.
Question 2Easy
Which similarity metric should a vector index be configured with?
- The one the embedding model was trained for
- Whichever metric is fastest, regardless of the model
- Manhattan distance, since it suits every embedding
- A different metric for queries than for documents
Answer: A. The one the embedding model was trained for
Explanation
Embedding models are trained with a particular similarity (often cosine or dot product); using another can degrade ranking.
Step-by-step solution
- Embedding models use specific similarity metrics like cosine or dot product.
- Changing the metric may reduce model effectiveness.
- Using the training metric ensures best results.
- So, choose the metric the embedding model was trained for.
- Final answer: The one the embedding model was trained for.
Why the other options are wrong
- B. The fastest metric may not match how the vectors were trained, so search quality can get worse.
- C. Manhattan distance does not suit every embedding; most models are trained for cosine or dot product.
- D. Queries and documents must use the same metric, or their scores cannot be compared fairly.
Tip: Match metric with model training for best performance.
Question 3Easy
Which is an example of a dedicated open-source ANN library rather than a database?
- FAISS
- Redis Streams
- PostgreSQL
- Apache Kafka
Answer: A. FAISS
Explanation
FAISS is a library of index types (flat, IVF, PQ, HNSW); databases add storage, filtering and APIs around such indexes.
Step-by-step solution
- FAISS is an open-source library of index types such as flat, IVF, PQ and HNSW.
- A library provides index code; a database adds storage, filtering and APIs around it.
- Redis Streams, PostgreSQL and Apache Kafka are not ANN libraries.
- So option A, FAISS, is the dedicated ANN library.
Why the other options are wrong
- B. Redis Streams is a stream feature inside Redis, not an ANN library.
- C. PostgreSQL is a database, not an ANN library.
- D. Apache Kafka is a messaging system, not an ANN library.
Tip: A library is index code; a database is storage plus queries around it.
Question 4Medium
Applying a strict metadata filter (for example tenant_id = 42) after ANN search can return too few results because:
- ANN indexes cannot store any metadata alongside the vectors at all
- Most of the top candidates may be filtered out afterwards
- Filters change the embedding of the query
- Metadata filters always crash vector indexes
Answer: B. Most of the top candidates may be filtered out afterwards
Explanation
Post-filtering discards candidates after retrieval; pre-filtering or filter-aware search avoids empty results.
Step-by-step solution
- Post-filtering applies after top-k.
- Many top results may belong to other tenants.
- Few remain.
Why the other options are wrong
- A. ANN can store metadata.
- C. Filters don't change embeddings.
- D. They don't crash.
Question 5Medium
Deleting vectors from an HNSW graph is often handled by:
- Deleting the whole index each time
- Marking them deleted and rebuilding or compacting later
- Re-embedding every remaining document after each single deletion
- Shrinking the embedding dimension
Answer: B. Marking them deleted and rebuilding or compacting later
Explanation
Removing graph nodes in place can hurt connectivity, so many systems use tombstones plus periodic rebuilds.
Step-by-step solution
- HNSW graphs link nodes; removing one breaks paths.
- Common practice is to mark vectors as deleted.
- Rebuild or compact periodically.
Why the other options are wrong
- A. Deleting the index each time is wasteful.
- C. Re-embedding is unnecessary.
- D. Dimension is unrelated.
Question 6Medium
Locality-sensitive hashing (LSH) for vector search relies on:
- Exact comparison of the query against every single stored vector in the whole collection
- Hash functions that put similar vectors in the same bucket with high probability
- Sorting vectors by their L2 norm
- Cryptographic hashes that never collide
Answer: B. Hash functions that put similar vectors in the same bucket with high probability
Explanation
LSH deliberately makes close vectors collide, so only matching buckets are scanned.
Step-by-step solution
- LSH uses hash functions designed so that similar vectors tend to fall in the same bucket.
- A query only compares against vectors in matching buckets.
- This avoids comparing the query with every stored vector.
- So option B, hash functions that put similar vectors in the same bucket, is correct.
Why the other options are wrong
- A. Exact comparison with every vector is brute force, which LSH is designed to avoid.
- C. Sorting by L2 norm is not what LSH relies on.
- D. Cryptographic hashes avoid collisions, the opposite of what LSH needs.
Tip: In LSH, close vectors collide on purpose, so only matching buckets are scanned.
Question 7Medium
Recall@10 of an ANN index (compared with exact search) is 0.95. This means:
- 10% of results are wrong 95% of the time
- On average 95% of the true top-10 neighbours are returned
- The index uses 95% less memory than an exact brute-force search would
- 95% of queries take under 10 milliseconds
Answer: B. On average 95% of the true top-10 neighbours are returned
Explanation
ANN recall measures overlap with the exact top-k.
Step-by-step solution
- Recall@10 compares the approximate index results with the exact top 10.
- Recall 0.95 means about 95 of every 100 true neighbours are returned, on average.
- Recall measures overlap in results, not speed or memory.
- So option B is correct.
Why the other options are wrong
- A. Recall 0.95 means about 5% of true neighbours are missed, not 10% of results being wrong.
- C. Memory use is not what recall measures.
- D. Query latency is not what recall measures.
Tip: Recall@k is the share of the exact top-k that the approximate index finds.
Question 8Medium
An IVF index has nlist = 1,000 clusters of roughly equal size, and queries use nprobe = 10. About what fraction of vectors does each query scan?
- 0.1%
- 1%
- 100%
- 10%
Answer: B. 1%
Explanation
10 of 1,000 lists are scanned: 10/1000 = 1% of the vectors, assuming balanced clusters.
Step-by-step solution
- nprobe = 10 means 10 clusters are checked.
- Total clusters = 1,000 so fraction scanned is 10/1000.
- 10 divided by 1000 equals 0.01.
- Convert to percentage: 0.01 * 100 = 1%.
- Each query scans about 1% of the vectors.
Why the other options are wrong
- A. 0.1% would need nprobe of 1 out of 1,000; with 10 probes the fraction is 10 out of 1,000, which is 1%.
- C. 100% would mean a full scan; nprobe of 10 out of 1,000 clusters only checks about 1% of vectors.
- D. 10% would need 100 probes out of 1,000; with nprobe 10 the fraction is 10 out of 1,000, so 1%.
Tip: Use nprobe / total clusters * 100 for quick percentage calculation.
Question 9Hard
Vector search over a corpus that grows by 1% per day uses IVF with centroids trained once at launch. After a year, quality drops. The most likely cause is:
- nprobe automatically resets to 1 over time
- IVF indexes are designed to expire automatically 365 days after they were first built
- Embeddings lose precision as they age
- The data distribution drifted, leaving clusters unbalanced; retrain centroids
Answer: D. The data distribution drifted, leaving clusters unbalanced; retrain centroids
Explanation
Centroids fitted on old data no longer partition new data well, so lists become skewed and recall falls.
Step-by-step solution
- Centroids are trained once at launch.
- New data grows by 1% daily.
- Old centroids fail to capture new data distribution.
- Clusters become unbalanced with time.
- Recall drops due to poor partitioning of new data.
- The data distribution drifted, leaving clusters unbalanced; retrain centroids.
Why the other options are wrong
- A. nprobe is a query setting that stays fixed unless someone changes it; it does not reset itself over time.
- B. IVF indexes have no built-in expiry; nothing deletes them after 365 days.
- C. Embeddings do not lose precision with age; the problem is that the old centroids no longer fit the data.
Tip: Retrain models when data evolves to maintain accuracy.
Question 10Hard
Two HNSW configurations on the same data give: A recall@10 0.99 at 9 ms, B recall@10 0.93 at 2 ms. The app's SLA is p95 under 5 ms. Which is the right next step?
- Lower embedding dimension to 2 and retest
- Switch to brute force for guaranteed recall
- Choose B and tune ef upward until latency nears the SLA
- Choose A, because recall always matters more than any latency SLA
Answer: C. Choose B and tune ef upward until latency nears the SLA
Explanation
A breaks the latency budget; raising ef on B buys recall while staying under 5 ms.
Step-by-step solution
- A misses the SLA (9 ms > 5 ms).
- B meets latency but has lower recall.
- Increase ef gradually to trade latency for recall.
Why the other options are wrong
- A. Dimension 2 destroys quality.
- B. Brute force is slower.
- D. SLA is a requirement.
Practise all 19 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 →