RAG & Embeddings Questions with Answers

8 practice questions on RAG & Embeddings (Generative AI & LLMs) with answers and step-by-step solutions. Try 8 samples below, then practise all 8 free in the AptiNest app.

Sample questions

Question 1Easy

What is the main job of a vector database in a RAG system?

  1. Training the embedding model on new documents as they arrive
  2. Generating the final answer text from the retrieved chunks
  3. Tokenizing user prompts
  4. Storing embeddings and finding the nearest ones to a query

Answer: D. Storing embeddings and finding the nearest ones to a query

Explanation

Vector stores use approximate nearest neighbour (ANN) indexes such as HNSW to search millions of vectors quickly.

Step-by-step solution

  1. Documents are embedded and stored as vectors with their text and metadata.
  2. At query time the query is embedded too.
  3. The vector database finds the nearest stored vectors quickly, usually with an approximate nearest neighbour index.

Why the other options are wrong

  • A. Training embedding models is separate from storing and searching vectors.
  • B. The LLM writes the answer; the database only supplies chunks.
  • C. Tokenization happens inside the model pipeline, not the vector store.

Tip: Vector DB: store embeddings, return nearest neighbours.

Question 2Easy

What is an embedding?

  1. The first sentence of a document, used as a short summary of what it contains
  2. A list of keywords chosen by hand for each document
  3. A compressed zip file of the original document's text
  4. A numeric vector representing the meaning of text (or other data)

Answer: D. A numeric vector representing the meaning of text (or other data)

Explanation

Similar meanings map to nearby vectors, enabling semantic search.

Step-by-step solution

  1. An embedding model turns text into a list of numbers (a vector).
  2. Texts with similar meaning get vectors that are close together.
  3. This lets software compare meaning by measuring distance.

Why the other options are wrong

  • A. A first sentence is text, not a numeric representation.
  • B. Hand-picked keywords are manual tags, not learned vectors.
  • C. Zip compression preserves the bytes, not the meaning.

Tip: Similar meaning, nearby vectors.

Question 3Easy

What is Retrieval-Augmented Generation (RAG)?

  1. Compressing a model by pruning weights so it can run on smaller devices
  2. Generating synthetic documents to enlarge the pre-training set
  3. Fetching relevant documents and adding them to the prompt as context
  4. Retraining the model every time a source document changes

Answer: C. Fetching relevant documents and adding them to the prompt as context

Explanation

RAG grounds answers in up-to-date or private data without changing model weights.

Step-by-step solution

  1. The user's question is used to search a document store.
  2. The most relevant passages are fetched.
  3. They are added to the prompt so the model answers from them.

Why the other options are wrong

  • A. That describes model pruning.
  • B. Generating synthetic data is a training technique, not RAG.
  • D. RAG avoids retraining; only the index is updated.

Tip: RAG = search first, then answer with what you found.

Question 4Medium

Why are documents split into chunks before embedding in RAG?

  1. Embedding models cannot process punctuation, so chunks are split at every full stop
  2. Chunking makes the LLM's weights smaller and faster to load
  3. Focused chunks retrieve more precisely and fit the context window
  4. Chunking encrypts the documents so they can be stored safely

Answer: C. Focused chunks retrieve more precisely and fit the context window

Explanation

Very large chunks dilute meaning and waste context; very small chunks lose surrounding context. Overlap helps keep related sentences together.

Step-by-step solution

  1. A whole document is too long for one focused embedding and may not fit the prompt.
  2. Smaller chunks each cover one idea, so a query matches the right part.
  3. Only the relevant chunks go into the context window.

Why the other options are wrong

  • A. Embedding models handle punctuation fine; chunking is about size and focus.
  • B. Chunking affects the documents, not the model's weights.
  • D. Chunking does not encrypt anything.

Tip: Chunk for precision, overlap for continuity.

Question 5Medium

What is the cosine similarity between the vectors (1, 0, 1) and (1, 1, 0)?

  1. 1
  2. 0
  3. 0.71
  4. 0.5

Answer: D. 0.5

Explanation

Dot product = 1 x 1 + 0 x 1 + 1 x 0
= 1.
Each vector's length is sqrt(2).
Cosine = 1 / (sqrt(2) x sqrt(2))
= 1 / 2
= 0.5.

Step-by-step solution

  1. Dot product: 1x1 + 0x1 + 1x0 = 1.
  2. Length of each vector: sqrt(1 + 0 + 1) = sqrt(2).
  3. Cosine = 1 / (sqrt(2) x sqrt(2)) = 1/2 = 0.5.

Why the other options are wrong

  • A. 1 would mean the vectors point the same way, which they do not.
  • B. 0 would need a zero dot product, but it is 1.
  • C. 0.71 is 1/sqrt(2): it divides by only one vector length.

Tip: cos = (a.b) / (|a| |b|); cosine 0.5 means a 60-degree angle.

Question 6Medium

What is the purpose of a re-ranker in a retrieval pipeline?

  1. Re-training the embedding model on each incoming query
  2. Deleting duplicate documents from storage to keep the vector index small and fast
  3. Re-scoring top retrieved candidates with a more accurate model
  4. Changing the order of words in the generated answer

Answer: C. Re-scoring top retrieved candidates with a more accurate model

Explanation

A first-stage retriever fetches many candidates cheaply; a cross-encoder re-ranker then orders the best few for the prompt.

Step-by-step solution

  1. A fast first-stage retriever returns many candidates (say 50).
  2. A re-ranker, often a cross-encoder, reads the query and each candidate together.
  3. It re-scores them so the best few go into the prompt.

Why the other options are wrong

  • A. Re-rankers score results; they do not retrain the embedding model.
  • B. Removing duplicates is index maintenance, not re-ranking.
  • D. Re-ranking orders retrieved documents, not words in the answer.

Tip: Retrieve wide and cheap, then re-rank narrow and precise.

Question 7Hard

What does hybrid search in a RAG pipeline usually combine?

  1. Images and text together in the same prompt
  2. Keyword-based search (e.g. BM25) with dense vector (semantic) search
  3. Two different LLMs answering the same question and voting
  4. Fine-tuning and prompting

Answer: B. Keyword-based search (e.g. BM25) with dense vector (semantic) search

Explanation

Keyword search catches exact terms like product codes, while vector search catches paraphrases; results are merged or re-ranked.

Step-by-step solution

  1. Keyword search (e.g. BM25) matches exact terms such as product codes.
  2. Dense vector search matches meaning and paraphrases.
  3. Hybrid search runs both and merges the results.

Why the other options are wrong

  • A. Mixing images and text is multimodal input, not hybrid search.
  • C. Model voting is an ensemble, not a retrieval method.
  • D. Fine-tuning and prompting are ways to adapt a model, not to search.

Tip: Codes and names: keywords. Paraphrases: vectors. Both: hybrid.

Question 8Hard

A 2,000-token document is split into chunks of 500 tokens with an overlap of 100 tokens between consecutive chunks. How many chunks are produced?

  1. 20
  2. 5
  3. 4
  4. 6

Answer: B. 5

Explanation

Each new chunk starts 500 - 100 = 400 tokens after the previous one: starts at 0, 400, 800, 1200, 1600. The chunk starting at 1600 reaches 2000, so there are 5 chunks.

Step-by-step solution

  1. Stride = chunk size - overlap = 500 - 100 = 400 tokens.
  2. Chunks start at 0, 400, 800, 1200, 1600.
  3. The chunk starting at 1600 reaches token 2000, the end.
  4. So 5 chunks.

Why the other options are wrong

  • A. 20 would come from dividing by 100, the overlap.
  • C. 4 ignores overlap: 2000 / 500.
  • D. 6 adds an extra chunk past the end of the document.

Tip: Chunks = ceil((L - C) / (C - O)) + 1.

Practise all 8 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 Generative AI & LLMs topics · All topics