Which of the following is the correct order of steps in a typical NLP pipeline?
Answer: A
A standard NLP pipeline begins with Tokenization (splitting text into tokens), followed by POS Tagging (assigning grammatical tags), then Parsing (analyzing grammatical structure), and finally Named Entity Recognition (identifying entities like names and places). This sequential order ensures each step builds on the output of the previous one.
Q.2Medium
In the context of language models, what does 'perplexity' measure?
Answer: B
Perplexity is a standard metric for evaluating language models. It measures how well a probability distribution predicts a sample. Mathematically, it is the exponentiated average negative log-likelihood of the test data. A lower perplexity indicates a better model, as the model is less 'surprised' by the test data.
Q.3Medium
Which technique is used by Word2Vec to learn word embeddings by predicting the surrounding context words given a center word?
Answer: B
Word2Vec offers two architectures. The Skip-gram model takes a center (target) word as input and tries to predict the surrounding context words. Conversely, the CBOW model takes the surrounding context words as input and predicts the center word. GloVe and FastText are separate embedding techniques altogether.
Q.4Medium
What is the primary purpose of the attention mechanism introduced in the 'Attention is All You Need' paper?
Answer: B
The attention mechanism, as described in 'Attention is All You Need' (Vaswani et al., 2017), enables the model to dynamically focus on different parts of the input sequence when generating each token of the output. This allows the model to capture long-range dependencies effectively, unlike RNNs which struggle with distant context. The Transformer architecture built on this mechanism replaced recurrence entirely.
Q.5Medium
Which of the following best describes the difference between stemming and lemmatization in NLP?
Answer: B
Stemming is a crude heuristic process that chops off word endings to approximate a root (e.g., 'running' → 'run', 'studies' → 'studi'). The result may not be a real word. Lemmatization, on the other hand, uses vocabulary and morphological analysis to return the proper base or dictionary form (lemma) of a word (e.g., 'studies' → 'study'). Lemmatization is more accurate but computationally more expensive.
Q.6Medium
In TF-IDF, what does a high IDF score for a term indicate?
Answer: B
IDF (Inverse Document Frequency) is computed as the logarithm of the ratio of total documents to the number of documents containing the term. A high IDF score means the term appears in very few documents, indicating it is rare and potentially carries significant discriminative information. Common words like 'the' or 'is' appear in almost every document, resulting in a very low IDF score.
Q.7Medium
Which of the following NLP tasks is an example of a sequence-to-sequence (Seq2Seq) problem?
Answer: C
A sequence-to-sequence (Seq2Seq) model maps an input sequence to an output sequence, where both sequences can have different lengths. Machine Translation (e.g., translating an English sentence to French) is a classic Seq2Seq task. Sentiment Analysis and Text Classification map a sequence to a single label, while Named Entity Recognition maps each token to a label (sequence labeling), not a new sequence.
Q.8Medium
In the context of BERT (Bidirectional Encoder Representations from Transformers), what is the 'Masked Language Model' (MLM) pre-training objective?
Answer: B
BERT uses the Masked Language Model (MLM) objective as one of its two pre-training tasks. A random 15% of input tokens are masked (replaced with a [MASK] token), and the model is trained to predict the original identity of these masked words using the bidirectional context from all surrounding tokens. This forces the model to learn deep bidirectional representations. The other pre-training task is Next Sentence Prediction (NSP).
Q.9Medium
Which parsing technique builds a parse tree from the bottom (leaves) up to the root, using a stack and an input buffer?
Answer: C
Shift-Reduce parsing is a bottom-up parsing technique. It uses a stack and an input buffer. In the 'shift' operation, the next input token is pushed onto the stack. In the 'reduce' operation, a sequence of tokens on the stack that matches the right-hand side of a grammar rule is replaced by the rule's left-hand side symbol. This continues until the entire input is reduced to the start symbol. Top-Down and Recursive Descent parsers begin from the root and work downward.
Q.10Medium
Which of the following is a key limitation of the Bag-of-Words (BoW) model for text representation?
Answer: C
The Bag-of-Words model represents a document as a vector of word frequencies, completely disregarding word order and grammatical context. For example, 'dog bites man' and 'man bites dog' would have identical BoW representations. This loss of sequential and semantic information is a fundamental limitation. It also suffers from high dimensionality and sparsity. Dense embeddings like Word2Vec address the semantic relationship limitation.