Quiz: Document Processing
Test your knowledge about document loaders, text splitting, and file handling.
30 questions - Click on each question to reveal the correct answer.
Question 1
What is the primary purpose of document loaders in RAG?
a) To compress documents
b) To extract text content from various file formats
c) To encrypt documents
d) To translate documents
Show Answer
Correct Answer: b
Document loaders extract text content from various file formats (PDFs, Word, HTML, etc.) and prepare it for further processing in the RAG pipeline.
Question 2
Which LangChain loader is best for PDFs with tables?
a) PyPDFLoader
b) PDFPlumberLoader
c) TextLoader
d) WebBaseLoader
Show Answer
Correct Answer: b
PDFPlumberLoader provides better table extraction capabilities compared to basic PDF loaders.
Question 3
What does OCR stand for?
a) Optical Character Recognition
b) Online Content Reader
c) Optimized Chunk Retrieval
d) Output Compression Routine
Show Answer
Correct Answer: a
OCR stands for Optical Character Recognition - technology that converts images of text into machine-readable text.
Question 4
What is chunk overlap and why is it important?
a) Duplicate chunks for backup
b) Shared text between chunks to preserve context
c) Encryption padding
d) Compression ratio
Show Answer
Correct Answer: b
Chunk overlap is shared text between consecutive chunks that prevents information loss at chunk boundaries and preserves context.
Question 5
What is a typical chunk size for RAG systems?
a) 50-100 characters
b) 500-1500 characters
c) 10000+ characters
d) 5-10 characters
Show Answer
Correct Answer: b
Typical chunk sizes range from 500-1500 characters, balancing retrieval precision with sufficient context.
Question 6
Which splitter is best for maintaining document structure in Markdown files?
a) RecursiveCharacterTextSplitter
b) TokenTextSplitter
c) MarkdownHeaderTextSplitter
d) SentenceTransformersTokenTextSplitter
Show Answer
Correct Answer: c
MarkdownHeaderTextSplitter respects Markdown heading structure and creates chunks based on document sections.
Question 7
What is the recommended overlap percentage relative to chunk size?
a) 50-60%
b) 1-5%
c) 10-20%
d) 80-90%
Show Answer
Correct Answer: c
A typical overlap is 10-20% of the chunk size (e.g., 200 character overlap for 1000 character chunks).
Question 8
Which loader would you use for scanned PDF documents?
a) PyPDFLoader
b) UnstructuredPDFLoader with OCR strategy
c) TextLoader
d) CSVLoader
Show Answer
Correct Answer: b
UnstructuredPDFLoader with strategy="ocr_only" or "hi_res" can process scanned PDFs using OCR.
Question 9
What does RecursiveCharacterTextSplitter do?
a) Splits only by characters
b) Splits by a hierarchy of separators
c) Splits randomly
d) Never splits text
Show Answer
Correct Answer: b
RecursiveCharacterTextSplitter tries to split by paragraphs first, then sentences, then words, then characters.
Question 10
What information does the Document metadata typically contain?
a) Only the file name
b) Source, page number, and other contextual information
c) Just the creation date
d) No metadata is stored
Show Answer
Correct Answer: b
Document metadata typically includes source file, page number, author, dates, and other relevant contextual information.
Question 11
Which LlamaIndex component loads multiple files from a directory?
a) SingleFileReader
b) SimpleDirectoryReader
c) BatchLoader
d) FolderProcessor
Show Answer
Correct Answer: b
SimpleDirectoryReader can recursively load multiple files from a directory with filtering options.
Question 12
Why might smaller chunks be problematic?
a) They use too much storage
b) They may lose important context
c) They are too slow to process
d) They cannot be embedded
Show Answer
Correct Answer: b
Smaller chunks may lose important context, making it harder for the LLM to understand and answer questions.
Question 13
What is the purpose of add_start_index in text splitters?
a) To number pages
b) To track the position of each chunk in the original document
c) To sort chunks alphabetically
d) To compress chunks
Show Answer
Correct Answer: b
add_start_index tracks where each chunk originated in the source document, useful for citations and debugging.
Question 14
How should tables in documents be handled during chunking?
a) Split them across multiple chunks
b) Keep them as single chunks
c) Remove them entirely
d) Convert to images
Show Answer
Correct Answer: b
Tables should be kept as single chunks to preserve their structure and meaning.
Question 15
Which Python library is commonly used for extracting tables from PDFs?
a) requests
b) Camelot
c) numpy
d) flask
Show Answer
Correct Answer: b
Camelot is a popular library specifically designed for extracting tables from PDF files.
Question 16
What is semantic chunking?
a) Chunking by file size
b) Chunking based on meaning/similarity
c) Chunking alphabetically
d) Random chunking
Show Answer
Correct Answer: b
Semantic chunking splits text based on semantic similarity, keeping related content together.
Question 17
Which encoding should typically be specified for TextLoader?
a) ASCII
b) UTF-8
c) Base64
d) Binary
Show Answer
Correct Answer: b
UTF-8 is the standard encoding that supports most characters across different languages.
Question 18
What does TokenTextSplitter use to count chunk size?
a) Characters
b) Words
c) Tokens (as counted by LLM tokenizers)
d) Bytes
Show Answer
Correct Answer: c
TokenTextSplitter counts actual tokens as they would be counted by the LLM's tokenizer, important for context limits.
Question 19
What is the main challenge with multi-column PDFs?
a) Colors are lost
b) Reading order may be incorrect
c) File size increases
d) Cannot be opened
Show Answer
Correct Answer: b
Multi-column layouts can confuse extractors, causing text from different columns to be merged incorrectly.
Question 20
How can images embedded in documents be made searchable?
a) Convert to PDF
b) Use vision models to generate descriptions
c) Delete them
d) Compress them
Show Answer
Correct Answer: b
Vision models (like GPT-4 Vision) can describe images, making their content searchable through text.
Question 21
What is the separator hierarchy in RecursiveCharacterTextSplitter by default?
a) Characters, words, sentences, paragraphs
b) Paragraphs, newlines, sentences, spaces, characters
c) Random order
d) Only by periods
Show Answer
Correct Answer: b
The default hierarchy is: double newlines (paragraphs), single newlines, periods (sentences), spaces, characters.
Question 22
Which loader would you use for JSONL files?
a) TextLoader
b) JSONLoader with appropriate jq_schema
c) PDFLoader
d) ImageLoader
Show Answer
Correct Answer: b
JSONLoader can handle JSONL files with the appropriate jq_schema to extract content.
Question 23
What happens if chunk_size is larger than the document?
a) An error is thrown
b) The document becomes a single chunk
c) The document is duplicated
d) The document is compressed
Show Answer
Correct Answer: b
If the document is smaller than chunk_size, it remains as a single chunk without splitting.
Question 24
Why is batch processing important for large CSV files?
a) To increase file size
b) To prevent memory issues
c) To encrypt data
d) To compress data
Show Answer
Correct Answer: b
Batch processing prevents loading entire large files into memory, avoiding memory issues.
Question 25
What is the purpose of the 'mode' parameter in UnstructuredPDFLoader?
a) To set encryption level
b) To control how document structure is preserved
c) To choose color mode
d) To set file permissions
Show Answer
Correct Answer: b
The 'mode' parameter (single, elements, paged) controls how document structure is preserved during extraction.
Question 26
Which strategy provides the best quality extraction in UnstructuredPDFLoader?
a) fast
b) auto
c) hi_res
d) low_res
Show Answer
Correct Answer: c
The "hi_res" strategy provides the highest quality extraction but requires more processing time.
Question 27
What should be done with headers and footers in PDFs?
a) Emphasize them
b) Filter them out to remove noise
c) Duplicate them
d) Encrypt them
Show Answer
Correct Answer: b
Headers and footers often contain repeated, non-informative content and should be filtered out.
Question 28
How can you track which file a chunk came from?
a) By chunk size
b) Through metadata
c) By chunk color
d) Through compression ratio
Show Answer
Correct Answer: b
Metadata fields like 'source' or 'file_name' track the origin of each chunk.
Question 29
What is the benefit of using SQLDatabaseLoader?
a) It only works with SQLite
b) It can query and load data directly from databases
c) It compresses SQL files
d) It encrypts databases
Show Answer
Correct Answer: b
SQLDatabaseLoader allows you to query databases directly and load results as documents.
Question 30
When chunking, what should be avoided?
a) Preserving metadata
b) Cutting sentences mid-thought
c) Using overlap
d) Tracking source
Show Answer
Correct Answer: b
Cutting sentences or concepts mid-thought can result in incomplete or confusing chunks that hurt retrieval quality.
Results
| Score | Level |
|---|---|
| 27-30 | Excellent - Strong understanding of document processing |
| 21-26 | Good - Some review recommended |
| 15-20 | Average - Review the chapters again |
| Below 15 | Needs comprehensive review |