Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is Question Answering (QA) in AI?
Question Answering is a task where a computer program reads a question and finds the best answer from a given text or knowledge source, just like how you ask a friend and they reply with the right information.
Click to reveal answer
beginner
What are the two main types of Question Answering systems?
The two main types are: 1) Closed-domain QA, which answers questions about a specific topic, and 2) Open-domain QA, which can answer questions about any topic using large knowledge sources.
Click to reveal answer
intermediate
How does a machine learning model find answers in text for QA?
The model reads the question and the text, then learns to spot the exact part of the text that answers the question, similar to how you scan a book to find a sentence that answers your question.
Click to reveal answer
beginner
What is the role of 'context' in Question Answering?
Context is the text or information where the answer is found. The QA system uses this context to understand the question better and find the right answer inside it.
Click to reveal answer
intermediate
Name a popular dataset used to train and test Question Answering models.
SQuAD (Stanford Question Answering Dataset) is a popular dataset where models learn to answer questions by reading paragraphs from Wikipedia.
Click to reveal answer
What does a Question Answering system primarily do?
ADetects objects in images
BGenerates random text
CTranslates languages
DFinds answers to questions from text or knowledge
✗ Incorrect
QA systems focus on finding answers to questions using text or knowledge sources.
Which type of QA system answers questions about any topic?
AOpen-domain QA
BClosed-domain QA
CImage QA
DSpeech QA
✗ Incorrect
Open-domain QA can answer questions on any topic using large knowledge bases.
In QA, what is 'context'?
AThe question itself
BThe text where the answer is found
CThe model architecture
DThe answer only
✗ Incorrect
Context is the text or information where the answer is located.
Which dataset is commonly used to train QA models?
AMNIST
BImageNet
CSQuAD
DCOCO
✗ Incorrect
SQuAD is a popular dataset for training and testing QA models.
How does a QA model find the answer in the text?
ABy scanning the text to locate the answer span
BBy translating the question
CBy guessing randomly
DBy summarizing the text
✗ Incorrect
QA models scan the text to find the exact part that answers the question.
Explain what Question Answering is and how it works in simple terms.
Think about how you ask a friend a question and they find the answer in a book.
You got /3 concepts.
Describe the difference between closed-domain and open-domain Question Answering systems.
One is about specific topics, the other covers any topic.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of question answering in AI?
easy
A. To find answers from given text or context
B. To generate random text without context
C. To translate languages automatically
D. To create images from descriptions
Solution
Step 1: Understand the goal of question answering
Question answering systems are designed to find specific answers from a given text or context.
Step 2: Compare options with the goal
Only To find answers from given text or context describes finding answers from text, which matches the purpose.
Final Answer:
To find answers from given text or context -> Option A
Quick Check:
Question answering = find answers [OK]
Hint: Focus on 'answer from text' meaning [OK]
Common Mistakes:
Confusing question answering with translation
Thinking it generates random text
Mixing it with image generation
2. Which input is essential for a question answering model to work?
easy
A. Only a context without a question
B. Only a question without any context
C. A question and a related context or passage
D. Random text unrelated to the question
Solution
Step 1: Identify inputs needed for question answering
Question answering requires both a question and some context to find the answer.
Step 2: Match options with required inputs
Only A question and a related context or passage provides both question and related context, which is necessary.
Final Answer:
A question and a related context or passage -> Option C
Quick Check:
Question + context = answer [OK]
Hint: Remember: question needs context to answer [OK]
Common Mistakes:
Assuming question alone is enough
Ignoring the need for context
Choosing unrelated text as input
3. Given this Python code using a question answering model:
from transformers import pipeline
qa = pipeline('question-answering')
context = "The Eiffel Tower is in Paris."
question = "Where is the Eiffel Tower located?"
result = qa(question=question, context=context)
print(result['answer'])
What will be printed?
medium
A. Location unknown
B. Eiffel Tower
C. The Eiffel Tower is in Paris
D. Paris
Solution
Step 1: Understand the code's purpose
The code uses a question answering pipeline to find the answer to the question from the context.
Step 2: Identify the answer in the context
The question asks for location; the context says "The Eiffel Tower is in Paris." So the answer is "Paris".
Final Answer:
Paris -> Option D
Quick Check:
Answer extracted = Paris [OK]
Hint: Look for direct answer in context matching question [OK]
Common Mistakes:
Printing the whole context instead of answer
Confusing object with location
Assuming no answer found
4. This code snippet tries to answer a question but raises an error:
from transformers import pipeline
qa = pipeline('question-answering')
context = "Python is a programming language."
question = "What is Python?"
result = qa(question, context)
print(result['answer'])
What is the error and how to fix it?
medium
A. Error: question is invalid; fix by changing question text
B. Error: missing keyword arguments; fix by using qa(question=question, context=context)
C. Error: context is empty; fix by adding text to context
D. No error; code runs fine
Solution
Step 1: Identify the function call error
The pipeline expects keyword arguments question= and context=, but code passes positional arguments.
Step 2: Fix the call with correct keywords
Change to qa(question=question, context=context) to fix the error.
Final Answer:
Error: missing keyword arguments; fix by using qa(question=question, context=context) -> Option B
Quick Check:
Use keywords for qa() args [OK]
Hint: Use keyword arguments for question and context [OK]
Common Mistakes:
Passing positional args instead of keywords
Assuming empty context causes error
Changing question text unnecessarily
5. You want to build a question answering system that can handle multiple paragraphs and find the best answer. Which approach is best?
hard
A. Split text into paragraphs, run QA on each, then pick highest confidence answer
B. Combine all paragraphs into one string and run QA once
C. Only use the first paragraph for QA
D. Ignore paragraphs and guess answer randomly
Solution
Step 1: Understand handling multiple paragraphs
QA models usually work best on smaller text chunks, so splitting helps.
Step 2: Choose method to find best answer
Running QA on each paragraph separately and selecting the answer with highest confidence ensures accuracy.
Final Answer:
Split text into paragraphs, run QA on each, then pick highest confidence answer -> Option A
Quick Check:
Split + score answers = best result [OK]
Hint: Split text, run QA per part, pick best answer [OK]