WorksheetsNatural Language Processing Quiz
Total questions: 126
Worksheet time: 1hrs 3mins
Identify an application of Natural Language Processing (NLP).
Voice assistant
Image segmentation
Circuit simulation
Network routing
Distinguish between natural language and formal language in terms of their typical use.
Natural language is used for human communication, while formal language is used in mathematics and programming.
Both natural and formal languages are only used by computers.
Formal language includes spoken and written communication between humans.
Natural language is used for creating algorithms and data structures.
A student is building a smart reply feature for an email application. The model needs to predict the next word by analyzing the current and previous word in the sentence. Choose the appropriate N-Gram model to meet this requirement.
Bigram Model
Unigram Model
Decision Tree Classifier
Support Vector Machine
A language model developed for autocomplete is producing incomplete or blank suggestions because certain n-gram combinations are missing from the training data. Choose the appropriate technique that assigns non-zero probabilities to these unseen word sequences.
Add-One (Laplace) Smoothing
Data Normalization
One-Hot Encoding
TF-IDF Weighting
A developer is evaluating the poor performance of a transformer model fine-tuned for next sentence prediction. On inspecting the input encoding, they discover that Type IDs for both sentences are incorrectly set to 1: Input: [CLS] The weather is nice today. [SEP] Let’s go for a walk. [SEP] Type IDs: 1 1 1 1 1 1 1 1 1 1 1 1 1 Analyse the impact of this Type ID configuration on model behavior.
The model may incorrectly treat both sentences as part of the same segment, making it difficult to learn inter-sentence relationships.
The model will apply a bidirectional attention mask, causing generation errors.
The positional embeddings will overwrite the segment embeddings during fine-tuning.
The model will use zero padding instead of segment embeddings, resulting in loss of context.
A developer is preparing input for a transformer model to perform a next sentence prediction task. The input contains two sentences: Input: [CLS] AI is evolving fast [SEP] It impacts many industries [SEP] Calculate the token structure and identify the correct Position IDs and Type IDs for this sequence.
Position IDs: 0 1 2 3 4 5 6 7 8 9; Type IDs: 0 0 0 0 0 1 1 1 1 1
Position IDs: 1 2 3 4 5 6 7 8 9 10; Type IDs: all 0
Position IDs: 0 1 2 3 4 5 6 7 8 9; Type IDs: 1 1 1 1 1 0 0 0 0 0
Position IDs: 0 1 2 3 4 5 6 7 8 9; Type IDs: 0 0 0 0 0 0 1 1 1 0
A student applies a 1-skip-2-gram model to the sentence: "Transformers understand complex patterns" They generate the following skip-gram pairs: (Transformers, understand), (understand, complex), (complex, patterns) Select the skip-gram output and identify the error in the student's approach.
The student missed valid skip pairs like (Transformers, complex) and (understand, patterns), which should be included in a 1-skip model.
The student incorrectly included pairs more than 2 positions apart, violating the n-gram rule.
The student included punctuation tokens that should have been filtered out.
The student used a bidirectional model instead of a unidirectional skip-gram model.
Name the category of models that integrate NLP methods with a structured knowledge base to perform reasoning in specialized domains like medicine or law.
Knowledge-based models
Statistical models
N-Gram models
Recurrent neural networks
Identify the programming language most commonly used for Natural Language Processing (NLP) tasks.
Python
Java
C++
R
Recall the deep learning libraries commonly used for developing NLP models.
TensorFlow and PyTorch
NumPy and SciPy
Hadoop and Spark
Eclipse and NetBeans
Differentiate between a feedforward neural language model and an RNN-based language model.
Feedforward models accept fixed input size; RNNs handle variable-length input sequences.
Both feedforward and RNN models process input with backward connections.
RNNs use one-hot vectors, while feedforward models use continuous vectors only.
Feedforward models are bidirectional by design, while RNNs are not.
Identify the reason that causes a neural language model using only one preceding word as input to have limited accuracy.
It lacks broader context to understand relationships among multiple words.
It processes tokens in reverse order, leading to confusion.
It randomly selects the next word, reducing prediction confidence.
It requires recurrent feedback to work, which is unavailable.
A student is tasked with developing a chatbot that can remember context across several messages. Choose the neural model architecture that would be most appropriate for this.
Recurrent Neural Network
N-Gram Model
Feedforward Network
Naive Bayes
A data scientist wants to analyze and tokenize raw text data for further processing in a deep learning pipeline. Choose the NLP toolkit that should be used to handle pre-processing tasks.
NLTK
Scikit-learn
NumPy
Matplotlib
During evaluation, a poor performance is obtained when the model processes longer sequences. Select the option that mitigates this.
Switch to an RNN or LSTM architecture
Apply dropout regularization
Reduce training epochs
Increase vocabulary size
A user finds that a model trained on GPT generates off-topic text. Select the method that helps to improve its performance.
Better prompt engineering
Increasing hidden layers
Using a smaller training set
Switching to a rule-based system
State the acronym of BERT.
Bidirectional Encoder Representations from Transformers
Basic Encoder Representations from Transformers
Binary Encoding for Recurrent Transformers
Bi-layered Encoder with Recurrent Transformers
Differentiate the transformer model from previous models like LSTM.
It uses attention mechanisms to analyze all words simultaneously
It only works with labeled datasets
It ignores the relationship between words
It depends on hand-crafted features
A developer wants to classify sentiment from customer reviews. Predict the model that would be most appropriate for understanding full sentence context.
BERT
GPT
Naive Bayes
Unigram
Identify the reason that makes BERT generally more effective than GPT for sentiment classification tasks.
BERT is bidirectional, allowing better understanding of sentence context.
GPT uses outdated attention mechanisms.
GPT lacks pre-training capabilities.
BERT generates longer sequences, improving accuracy.
State the AI model referred by Sam Altman when discussing about prompt engineering.
ChatGPT
Siri
Bixby
Alexa
Identify the reason that makes prompt engineering to be considered as an essential skill in working with AI models like GPT-4.
It allows for more relevant and coherent model outputs
It helps reduce the size of language models
It avoids the need for training data
It eliminates human supervision completely
A developer wants to guide DALL-E to create a futuristic cityscape. Choose the approach that should be taken by them.
Provide clear, detailed prompt instructions specifying the desired elements
Use generic phrases like "draw something"
Rely on default generation without any input
Ask the model to fetch training data
A prompt engineer tests the same instruction across GPT-4 and PaLM but gets varied results. Select the reason for this variation.
Different models interpret prompts based on their own training and architecture
Prompt engineers must train each model manually
All models share a fixed response library
GPT-4 does not support prompt engineering
A student wants to guide a language model to give answers in a political tone. Choose the LangChain class that should be used.
SystemMessage
HumanMessage
PromptTemplate
ChatOpenAI
A student debugs a response issue in LangChain where user context is ignored. Incorrect message sequencing is suspected. Select the template that is most likely misconfigured.
ChatPromptTemplate
PromptTemplate
JinjaTemplate
OpenAIChain
A developer notices repeated variable prompts during a session. They suspect poor prompt composition. Select the LangChain strategy that could improve this.
Use a PipelinePromptTemplate to modularize prompt creation
Replace LLM with a faster model
Disable token streaming
Use default temperature settings
Identify the method that is used in LangChain to return a message after processing a list of messages.
predict_messages
process_input
generate_message
message_prompt
Name the library that should be installed to use Jinja2 templates in LangChain.
Jinja2
Flask
React
Django
State the primary cognitive mechanism in an LLMChain.
LLM
PromptTemplate
OutputParser
Tokenizer
Select the role of PromptTemplate.from_template() function in LangChain.
It creates a formatted prompt using a predefined structure.
It evaluates model performance.
It visualizes LLM output.
It generates a new model.
Identify the role of partial prompting in supporting LangChain workflows.
It allows developers to fill in variables step-by-step before execution.
It reduces the size of the final response.
It encrypts prompts before sending them to the model.
It limits token generation by default.
A student is building a chatbot that replies with customized information based on user roles, instructions, and examples. Choose the most suitable template type.
PipelinePromptTemplate
SystemMessage
PromptTemplate
PartialPrompt
Choose the class used to build an LLMChain that mimics Morpheus' responses using examples.
FewShotPromptTemplate
StaticPromptTemplate
JSONPromptBuilder
MessageFormatter
A model's output is logical but lacks the conversational flow seen in earlier chats. Select a solution for this.
Check whether ChatPromptTemplate is being used correctly
Check if the OpenAI key is expired
Check the number of function arguments in the script
Check if the prompt ends with a period
A developer's LLMChain outputs inconsistent answers despite a consistent prompt. Select the appropriate reason for this.
The temperature parameter might be too high
The chat model isn’t installed correctly
The output parser is malfunctioning
The prompt lacks placeholders
Name the prompt class that defines a fixed string format in LangChain.
StringPromptTemplate
TextPrompt
StaticPromptBuilder
BasePromptFormat
Identify the role of prefix in a FewShotPromptTemplate.
It provides introductory context before examples
It separates each example
It finalizes the question-answer sequence
It defines user input schema
Choose the appropriate message format to create an interactive chatbot using ChatPromptTemplate.
System and Human messages
User and Assistant labels
Input/output transformers
DynamicPromptText
Identify the use of .run() method of an LLMChain.
Executes the model with the provided inputs and returns a response
Trains the model with fine-tuning data
Initializes all components in memory
Parses the raw tokens from the user prompt
What does BERT stand for?
Bidirectional Encoder Representations from Transformers
Basic Encoder Representations from Transformers
Binary Encoding for Recurrent Transformers
Bi-layered Encoder with Recurrent Transformers
How does a transformer differ from LSTM?
It uses attention mechanisms to analyze all words simultaneously.
It only works with labeled datasets.
It ignores word relationships.
It depends on hand-crafted features.
Why is BERT more effective than GPT for sentiment classification?
BERT is bidirectional, allowing better understanding of context.
GPT uses outdated attention mechanisms.
GPT lacks pre-training.
BERT generates longer sequences.
Why is prompt engineering an essential skill in GPT-4?
It allows for more relevant and coherent outputs.
It reduces model size.
It avoids training data.
It eliminates supervision.
A prompt engineer tests the same instruction across GPT-4 and PaLM but gets varied results. Why?
Different models interpret prompts based on training and architecture.
Prompt engineers must train each manually.
All models share a fixed response library.
GPT-4 doesn't support prompt engineering.
Which statistical model predicts a continuous value such as salary from years of experience?
Logistic Regression
Linear Regression
Naive Bayes
Decision Tree
Which of the following is an example of a unigram model?
Predicting a word using the previous two words
Predicting a word using only itself (current word)
Predicting a word using the last three words
Predicting a word with embeddings
In an N-Gram model, what assumption allows prediction of the next word?
Independence assumption
Maximum likelihood assumption
Markov assumption (limited history)
Gradient assumption
Which smoothing technique adds 1 to every count to avoid zero probability?
Good-Turing
Backoff
Add-One (Laplace)
Kneser-Ney
Which smoothing redistributes probability mass from frequent to unseen n-grams?
Add-k
Good-Turing Discounting
Laplace
One-hot
What is the advantage of N-Gram models?
They capture deep semantics
They handle long dependencies
They are simple and fast to implement
They require no training corpus
What is the limitation of N-Gram models?
Too easy to train
They suffer from data sparsity
They always overfit
They ignore frequencies
Which corpus is an example of data source for training NLP models?
A random generator
A large structured set of texts stored electronically
Image dataset
Audio recordings only
In contextual models, which ID helps understand the order of tokens?
Position ID
Type ID
Class ID
Mask ID
In contextual models, which ID distinguishes between different sentences?
Position ID
Type ID (Segment ID)
Word ID
Context ID
Which contextual model developed by OpenAI uses a unidirectional transformer?
GPT
BERT
RoBERTa
ELMo
Which model was trained on BooksCorpus and Wikipedia?
GPT
BERT
Word2Vec
TF-IDF
Which contextual model uses BiLSTM architecture?
BERT
GPT
ELMo
RoBERTa
Which contextual model is known as "Robust BERT"?
ELMo
GPT
RoBERTa
Word2Vec
Which is an advantage of contextual models?
They require little data
They capture long-range dependencies
They ignore polysemy
They rely only on n-gram counts
Which is a limitation of contextual models?
Cannot handle polysemy
Work only with small datasets
Require large training data and compute resources
Cannot be fine-tuned
What is the key difference between static embeddings and contextual embeddings?
Contextual embeddings ignore word order
Static embeddings capture polysemy
Contextual embeddings change meaning based on sentence context
Static embeddings are always dense
Which neural model represents the simplest neural language model?
RNN
Feedforward Neural Network
Transformer
Naive Bayes
Which neural model can handle variable-length sequences effectively?
RNN
Feedforward
Logistic Regression
Decision Tree
What improvement do feedforward models gain when using multiple input words?
They become similar to fixed-size N-Gram models
They capture infinite context
They lose sequence meaning
They ignore embeddings
Which is a key limitation of feedforward networks in NLP?
They always overfit
They cannot accept variable-length inputs
They cannot use embeddings
They require convolutional filters
Which language is most popular for NLP implementations?
Java
R
C++
Python
Which library was one of the first NLP libraries written in Python?
PyTorch
TensorFlow
NLTK
Hugging Face
Which platform provides 135+ state-of-the-art open-source NLP models?
Scikit-learn
Hugging Face
Spark
Eclipse
Which deep learning libraries are most commonly used for building NLP models?
TensorFlow and PyTorch
NumPy and SciPy
Hadoop and Spark
MATLAB and R
Which vectorization method represents each word as a binary sparse vector?
One-hot encoding
Word2Vec
TF-IDF
Embeddings
What is the main disadvantage of one-hot encoding?
It captures semantics
It is low-dimensional
It produces very high-dimensional sparse vectors
It requires embeddings
Which technique maps words into dense, low-dimensional vectors?
TF-IDF
Word Embeddings (Word2Vec, GloVe)
One-hot encoding
Bag-of-Words
Which property makes embeddings superior to one-hot vectors?
They are sparse
They capture semantic similarity
They ignore meaning
They require no training
Which vectorization method would place "king" and "queen" close in vector space?
One-hot encoding
Bag-of-Words
Word Embedding
TF-IDF
Which is an example of tokenization?
Assigning probabilities to words
Splitting text into words like "Natural language processing is fun" → ["Natural", "language", ...]
Creating embeddings
Removing stop words
Which library is best suited for preprocessing tasks like stemming and parsing?
NumPy
NLTK
Matplotlib
Spark
Which model produces probabilities that sum to 1 across classes?
Word2Vec
One-hot
Softmax
LSTM
Why is the Softmax function widely used in NLP classifiers?
It tokenizes text
It normalizes embeddings
It converts logits into probability distributions
It removes stop words
Which statement best summarizes LSTM compared to RNNs?
Both forget equally fast
LSTM remembers important details longer than RNNs
RNNs remember better
LSTM is simpler than RNN
Which mechanism enables Transformers to replace RNNs in NLP?
Pooling
Self-Attention
Dropout
Convolution
Why are transformers better than RNNs for parallelization?
They ignore context
They process all tokens simultaneously
They need fewer layers
They use embeddings incorrectly
Which embedding method is dynamic and changes depending on sentence meaning?
Word2Vec
Contextual embeddings (BERT, ELMo)
One-hot encoding
Bag-of-Words
Why are contextual embeddings considered more powerful than static ones?
They ignore context
They require fewer parameters
They reflect meaning changes depending on context
They are always sparse
Which technique reduces zero-probability issues in unseen N-Grams?
Tokenization
Smoothing
Dropout
Padding
Which smoothing method adds a small constant instead of 1?
Add-k Smoothing
Laplace Smoothing
Good-Turing
Backoff
Which advanced smoothing technique adjusts both counts and context diversity?
Kneser-Ney Smoothing
Add-One Smoothing
Backoff
Good-Turing
Which model backs off to lower-order n-grams when higher ones are missing?
Backoff Models
Laplace Models
Decision Trees
Word2Vec
What is a disadvantage of N-Gram models when n is large?
They ignore context
They require exponential memory growth
They train too fast
They never smooth
Which is an example of a corpus in NLP?
ImageNet
Wikipedia Text Dump
CIFAR-10
MNIST
What does a contextual model use to understand polysemy?
Fixed embeddings
Dynamic embeddings based on context
Sparse vectors
TF-IDF
Which model first introduced the concept of contextual embeddings?
GPT
ELMo
Word2Vec
Logistic Regression
Which model uses masked language modeling as a pretraining objective?
GPT
BERT
Naive Bayes
RNN
Which model uses next-token prediction as its main training method?
GPT
BERT
RoBERTa
ELMo
Which contextual model was trained on larger and more diverse corpora than BERT?
RoBERTa
Word2Vec
N-Gram
TF-IDF
What is the primary limitation of contextual models like BERT?
They ignore word order
They cannot handle polysemy
They are slower to train and require large data
They rely only on frequency counts
Which advantage do contextual models have over N-Gram models?
Faster computation
Ability to capture full-sentence meaning
Require smaller data
Rely only on counts
Which component of a Transformer allows it to capture relationships between all tokens?
Pooling
Self-Attention
One-hot encoding
Dropout
What is the role of positional encoding in Transformers?
Reduces vocabulary size
Normalizes embeddings
Adds sequence order information
Converts to probability
Which type of embedding is static and does not change with context?
Word2Vec
BERT
ELMo
RoBERTa
Which type of embedding changes with sentence usage?
Word2Vec
Contextual embeddings
One-hot vectors
Bag-of-Words
Which challenge do RNNs face with long-term dependencies?
Large memory usage
Vanishing gradients
Too many embeddings
No activation functions
What mechanism in LSTMs allows remembering information for longer?
Softmax
Memory cell with gates
One-hot vectors
Dropout
Which gate in LSTMs prevents irrelevant information from being stored?
Forget gate
Output gate
Input gate
Embedding gate
Which is a benefit of using LSTMs for sequence tasks?
They ignore context
They retain order and context in long sequences
They require no embeddings
They train without labels
Which is an example where LSTM outperforms simple RNN?
Sorting arrays
Language translation
Tokenization
Word segmentation
What is an example of an application using LSTM in text generation?
Predicting the next word in a sentence
Image segmentation
Data compression
Speech-to-text alignment
Which advantage do LSTMs have in speech recognition?
Faster inference
Ability to remember context over time
No need for training
No embeddings required
Which model architecture is designed to handle sequential dependencies more effectively than RNNs?
CNN
LSTM
Logistic Regression
Naive Bayes
Identify which probability-based model is commonly used for text classification like spam filtering.
Logistic Regression
Naive Bayes
Decision Trees
KNN
Compare Bag-of-Words with Word Embeddings. Which is true?
Both preserve word order
Bag-of-Words ignores semantics; embeddings capture meaning
Embeddings are always sparse
Bag-of-Words reduces dimensions
Explain why TF-IDF is often preferred over raw frequency counts.
It ignores rare words
It reduces weight of common words and emphasizes important ones
It produces dense vectors
It uses contextual embeddings
Apply the concept of trigram modeling. Which sequence represents a trigram?
("The", "sky")
("The", "sky", "is")
("blue")
("sky", "blue", "river")
Analyse why smoothing is crucial in N-Gram models.
It increases sequence length
It removes tokens
It avoids assigning zero probability to unseen n-grams
It normalizes embeddings
Identify which model is pre-trained on Common Crawl data.
GPT
BERT
ELMo
Naive Bayes
Explain why contextual embeddings are useful for polysemous words.
They ignore meaning
They assign different vectors based on context
They reduce vocabulary size
They always use static vectors
Apply positional encoding in Transformers. What does it achieve?
Introduces order information into input tokens
Normalizes embeddings
Reduces computation
Performs classification
Compare GPT and BERT. Which is true?
GPT is bidirectional; BERT is unidirectional
Both are unidirectional
GPT is unidirectional; BERT is bidirectional
Both use CNNs
Identify which model uses BiLSTMs to generate embeddings.
GPT
BERT
ELMo
RoBERTa
Analyse the key reason why transformers outperform RNNs in scalability.
They ignore dependencies
They allow parallel processing of tokens
They always train faster
They use smaller datasets
Apply the concept of attention. What does self-attention calculate?
Dropout rates
Relationships between each token and all others in the sequence
Padding lengths
Output probabilities only
Evaluate why RoBERTa improves over BERT.
It ignores embeddings
It is trained on larger and more diverse corpora
It eliminates attention layers
It uses unigram probabilities
Identify the main drawback of feedforward neural language models.
They require embeddings
They cannot handle variable sequence lengths
They always overfit
They ignore context
Explain why RNNs are better than feedforward networks for sequences.
They use convolution
They can process variable-length inputs
They always use embeddings
They remove context
Apply embeddings: which method ensures "Paris -- France + Italy ≈ Rome"?
One-hot
TF-IDF
Word2Vec
Bag-of-Words
Compare one-hot encoding with embeddings. Which is correct?
Both are dense
One-hot captures semantics
Embeddings capture semantic similarity; one-hot does not
Both are sparse
