Exam practice

Natural Language Processing — Practice

Past-exam questions, filterable by chapter, year and difficulty. Answer for instant grading, reveal the worked solution, and watch your accuracy climb.

Seen 0 / 142 · 0 correct · 0% accuracy

Chapter
Year
Difficulty
  1. agent-tool-count2025Agentseasy1 pt
    According to the LLM agent prompt below, how many different tools are available for the agent to use?
    Here are the names and descriptions for each tool:
      exponentiate(base, power)          - computes base raised to the power
      compound_interest(principal, rate, years) - applies interest to principal
      play_radio_tool()                  - starts the radio
      pause_radio_tool()                 - pauses the radio if it is playing
      increase_radio_volume_tool()       - increases the volume
      decrease_radio_volume_tool()       - decreases the volume
      search_tool5(query)                - performs a web search
      translate_tool6(input, language)   - translates input into the language
    
  2. anthropomorphism2025Dialogueeasy1 pt
    The act of attributing human emotions and intentions to a computer program (such as a chatbot) is referred to as:
  3. bert-reduce-burden2025Retrievalmedium1 pt
    You are building a document-search system and train a BERT model to determine whether a document is relevant to a query. How might you reduce the computational burden when deploying this system without greatly degrading its performance?
  4. bidirectional-transformer-model2025BERTeasy1 pt
    Which of the following machine-learning models makes use of a bidirectional Transformer architecture to extract a feature representation of text?
  5. bio-tagging2025Sequence labellingeasy1 pt
    Begin-Inside-Outside (BIO) tagging is often used for:
  6. bow-correct2025Bag-of-Wordsmedium1 pt
    Which of the following statements about the Bag-of-Words (BOW) representation of a document is correct?
  7. bpe-definition2025Byte-pair encodingeasy1 pt
    A byte-pair encoding:
  8. chatbot-dialog-eval2025Dialogueeasy1 pt
    When evaluating dialogue produced by a chatbot, ideally we would rate performance based on:
  9. clip-definition2025Multi-modal retrievalmedium1 pt
    CLIP is a model primarily used for:
  10. confusion-matrix-precision2025Classification metricsmedium1 pt
    A text classifier produces the following confusion matrix on the test set: | | Pred + | Pred − | |----------|--------|--------| | Actual + | 95 | 25 | | Actual − | 5 | 75 | What is the precision of the classifier?
  11. embedding-memory-w2v2025Word embeddingsmedium1 pt
    You learn Word2Vec embeddings of size 512 over a vocabulary of four hundred thousand tokens. Roughly how much memory (in GB) is needed to store all the vectors using double-precision (64-bit) floats? (1 byte = 8 bits.)
  12. few-shot-jokes2025Promptingmedium1 pt
    Imagine providing the prompt below to a large language model. What type of learning is the model doing in this case?
    "I'm afraid for the calendar. Its days are numbered. => not funny
     I only know 25 letters of the alphabet. I don't know y. => not funny
     What do you call a fish wearing a bowtie? SoFISHticated. => funny
     What do you call a factory that makes okay products? A satisfactory. => funny
     I asked my dog what's two minus two. He said nothing. =>"
    
  13. glove-embeddings2025Distributional semanticseasy1 pt
    GloVe embeddings:
  14. gpt-not-true2025GPTeasy1 pt
    Which statement about GPT (GPT-2, GPT-3, etc.) models is NOT true?
  15. gpt3-4-autoregressive2025GPTmedium1 pt
    While we don't know the details of the GPT-3.5 and GPT-4 models on which ChatGPT is built, it is highly likely — given their names (Generative Pre-trained Transformer) — that:
  16. jailbreaking2025LLM safetyeasy1 pt
    Prompting a chatbot in a certain way so as to cause it to respond in an unintended manner and operate outside of its intended operating conditions — e.g. so that it tells the user how to do something dangerous — is usually called:
  17. langchain-purpose2025Agentseasy1 pt
    The LangChain software library is primarily used to build what type of applications?
  18. lda-usage2025Topic modellingeasy1 pt
    Latent Dirichlet Allocation (LDA) is usually used to:
  19. lora-purpose2025LoRAmedium1 pt
    Low-Rank Adaptation (LoRA) is a technique in which we:
  20. lstm-not-true2025LSTMsmedium1 pt
    Which statement about a Long Short-Term Memory (LSTM) network is NOT true?
  21. mel-spectrogram-axes2025Speech featuresmedium1 pt
    The Mel spectrogram is just a spectrogram which has:
  22. mt-problem-type2025Seq2seq & translationeasy1 pt
    Machine translation is an example of what type of problem?
  23. multilingual-bert-poor2025BERTmedium1 pt
    You train a multilingual-BERT-based classifier and find that it performs particularly poorly, with accuracy far below that of a linear classifier. What might you do to try to improve the model?
  24. nb-prior-spam2025Naive Bayeseasy1 pt
    A spam filter is built from 2,000 spam emails and 8,000 non-spam emails. In this collection, what is the prior probability of seeing a spam email?
  25. ngram-improve-estimates2025N-gram language modelsmedium1 pt
    To improve the probability estimates of an n-gram language model, we could:
  26. ngram-limitation-false2025N-gram language modelshard1 pt
    Which statement about the limitations of n-gram language models is FALSE?
  27. not-a-ranking-function-ndcg2025TF-IDF & rankingmedium1 pt
    Which of the following is NOT a common ranking function used in term-based information retrieval?
  28. one-shot-learning-example2025Promptingmedium1 pt
    Which of the following prompts to a language model would be considered an example of one-shot learning?
  29. opensource-llm-not-true2025LLM scalemedium1 pt
    Which of the following statements about current open-source LLM technology (in 2024) is NOT true?
  30. parse-tree-not-correct2025Parsingeasy1 pt
    In NLP, which of the following statements regarding a parse tree is NOT correct?
  31. perplexity-we-really-like-nlp2025N-gram language modelsmedium1 pt
    The probability of the sequence "we really like NLP" is exactly 1/16. Assuming word-level tokenisation, what is the perplexity of the sentence?
  32. post-attention-layernorm2025Transformer architecturehard1 pt
    In a Llama-style Transformer block, what is the "post_attention_layernorm" doing?
  33. posting-list2025Inverted indexeasy1 pt
    In a traditional (lexical/term-based) search engine, a posting list contains:
  34. prefer-perplexity2025N-gram language modelseasy1 pt
    Do we prefer language models with higher perplexity or lower perplexity?
  35. preprocessing-common-step2025Text normalisationeasy1 pt
    Which of the following is a common text pre-processing step in an NLP application?
  36. pronoun-reference-task2025Sequence labellingeasy1 pt
    The task of determining who or what is referred to by a pronoun in a sentence is called:
  37. quantisation-mistral-vram2025Quantisationmedium1 pt
    If we apply 4-bit quantisation when loading a Mistral-7B LLM on a GPU, approximately how much video RAM would be needed just to hold the weights?
  38. rag-best-prompt2025RAGhard1 pt
    Which of the following system prompts would be the best if you are building a RAG (Retrieval-Augmented Generation) application?
  39. rank-learning-signals2025TF-IDF & rankingeasy1 pt
    In a web search engine, rank-learning algorithms combine many signals to rank webpages for a query. Which of the following could provide useful features to the rank learner?
  40. regex-emoticons2025Regular expressionsmedium1 pt
    Which of the following regular expressions matches emoticons (e.g. :-), :3, <3)?
  41. rlhf-usage2025RLHFeasy1 pt
    In NLP, Reinforcement Learning from Human Feedback is usually used to do what?
  42. seq2seq-attention-not-true2025Seq2seq & translationmedium1 pt
    Which statement about sequence-to-sequence models with attention is NOT true?
  43. seq2seq-technique2025Seq2seq & translationeasy1 pt
    Which of the following techniques is often used for learning sequence-to-sequence models in NLP?
  44. seq2seq-true2025Seq2seq & translationmedium1 pt
    Which statement about sequence-to-sequence models is true?
  45. spectrogram-technique-not-used2025Speech featuresmedium1 pt
    Which, if any, of the following techniques is NOT used to produce a spectrogram for analysing audio signals to understand spoken language?
  46. speech-act-directive2025Dialoguemedium1 pt
    In the taxonomy of speech acts defined by Bach and Harnish (1979), when someone advises / asks / orders / requests somebody, they are performing which type of speech act?
  47. spoken-agents-harder2025Dialogueeasy1 pt
    Building spoken interface agents is much harder than building chatbots because:
  48. statistical-lm-computes2025N-gram language modelseasy1 pt
    A statistical language model computes:
  49. stemming-reason2025Text normalisationmedium1 pt
    The main reason for performing stemming before building a text classifier is to:
  50. stemming-vs-lemmatization2025Text normalisationmedium1 pt
    What is the difference between stemming and lemmatization?
  51. subword-embeddings2025Tokenizationmedium1 pt
    Which of the following statements about sub-word embeddings is NOT usually true?
  52. t5-not-true-distilled2025Transformersmedium1 pt
    Which statement about the T5 (Text-To-Text Transfer Transformer) model is NOT true?
  53. test-time-compute2025LLM reasoningmedium1 pt
    In the context of LLMs, test-time compute scaling usually refers to the process of:
  54. tfidf-cosine-ranking2025TF-IDF & rankinghard2 pts
    Given the normalised tf-idf document vectors (dimensions 1..14, all other components zero): ``` A = [0, 0, 0.1, 0.1, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0 ] B = [0.1, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0.4, 0, 0, 0.3] C = [0, 0, 0.1, 0, 0.3, 0, 0.1, 0, 0, 0, 0.3, 0, 0, 0 ] D = [0, 0.1, 0, 0.2, 0, 0, 0, 0, 0, 0.3, 0, 0, 0, 0.1] E = [0.4, 0, 0.1, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0 ] ``` and the query q = [0, 0.25, 0.25, 0.25, 0.25, 0, …], rank the documents from most to least similar to the query using cosine similarity.
  55. top-k-vocab-random2025N-gram language modelseasy1 pt
    When generating text with top-k sampling, setting k to the size of the vocabulary is equivalent to performing:
  56. transformer-removed-recurrence2025Transformer architectureeasy1 pt
    In order to speed up model training, the Transformer model REMOVED what part of the sequence-to-sequence-with-attention model architecture?
  57. tts-normalisation-extended2025Text normalisationmedium1 pt
    Text normalisation is needed for a text-to-speech system in order to:
  58. vector-db-nn-search2025Vector databaseseasy1 pt
    Providing fast nearest-neighbour search in a document-embedding space is the task of what technology?
  59. w2v-not-property2025Word embeddingsmedium1 pt
    Which of the following is NOT a property of Word2Vec word embeddings?
  60. w2v-true2025Word embeddingseasy1 pt
    Which statement about Word2Vec is true?
  61. word-embedding-uses-true2025Word embeddingseasy1 pt
    Which of the following statements about the uses of word embeddings is generally true?
  62. zero-one-few-shot-definition2025Promptingeasy1 pt
    Zero-, one- and few-shot learning involves:
  63. ascii-utf82024Text normalisationeasy1 pt
    What are ASCII and UTF-8, and what is the difference between them?
  64. attention-coreference2024Attentionmedium1 pt
    In the classic visualisation where the word "it" attends strongly to "animal" or to "street" in "The animal didn't cross the street because it was too tired / too wide", which NLP task is the self-attention mechanism implicitly performing?
  65. bert-not-true2024BERTmedium1 pt
    Which statement about the BERT model is NOT true?
  66. bert-pairwise-tokens2024BERTmedium1 pt
    What special tokens are often used to fine-tune a BERT model for pairwise text-classification tasks?
  67. bm25-property2024TF-IDF & rankingmedium1 pt
    A particularly useful property of the BM25 ranking function is that:
  68. bow-not-correct2024Bag-of-Wordseasy1 pt
    Which of the following statements about a Bag-of-Words (BOW) representation of a document is NOT correct?
  69. bpe-transformer-effect2024Byte-pair encodingmedium1 pt
    What effect does Byte-Pair Encoding (BPE) achieve in Transformer models?
  70. chain-of-thought2024Promptingmedium1 pt
    Chain-of-thought prompting of an LLM involves:
  71. clip-multimodal2024Multi-modal retrievalmedium1 pt
    For multi-modal retrieval, which type of model can be used to first align the embedding spaces of text and images?
  72. clustering-task-type2024Clusteringeasy1 pt
    What type of task is text clustering?
  73. confusion-matrix-accuracy2024Classification metricsmedium1 pt
    A text classifier produces the following confusion matrix on the test set: | | Pred + | Pred − | |----------|--------|--------| | Actual + | 95 | 15 | | Actual − | 5 | 85 | What is the accuracy of the classifier?
  74. coref-resolution2024Sequence labellingeasy1 pt
    Co-reference resolution is the task of:
  75. entity-linkage2024Sequence labellingmedium1 pt
    Entity linkage is the task of:
  76. gpt-stands-for2024GPTeasy1 pt
    In NLP, the acronym GPT usually stands for:
  77. gpt-without-finetuning2024Promptingeasy1 pt
    How might a GPT model best be used without fine-tuning?
  78. gpt2-translate-emergent2024LLM capabilitiesmedium1 pt
    How was it possible for a GPT-2 model to learn to translate text from English to French if it was trained on a corpus of (predominantly) English documents?
  79. hac-complete-linkage2024Clusteringmedium1 pt
    In hierarchical agglomerative clustering, if complete-linkage is used, what does that tell you about the clusters that will be found?
  80. heaps-law2024Distributional semanticsmedium1 pt
    Heaps' law states that:
  81. lexical-search-before-reranking2024Retrievalmedium1 pt
    What is the primary advantage of using a lexical search engine before reranking with BERT?
  82. llm-7b-12gb-gpu2024Quantisationhard1 pt
    Is it possible to generate text from a 7-billion-parameter LLM on a computer with a 12 GB GPU card?
  83. llm-content-false2024LLM limitationseasy1 pt
    Which of the following statements about content generated by an LLM is obviously FALSE?
  84. llm-to-chatbot2024RLHFeasy1 pt
    Turning an LLM into a chatbot usually involves:
  85. llm-training-tokens2024LLM scaleeasy1 pt
    State-of-the-art LLMs (in 2024) have typically been trained on how much text?
  86. logistic-regression-true2024Logistic regressionmedium1 pt
    Which of the following statements about the Logistic Regression (LR) classifier is true?
  87. mt-true-20242024Seq2seq & translationmedium1 pt
    Which statement about machine-translation systems is TRUE (as of 2024)?
  88. nb-cheap-conditional2024Naive Bayesmedium1 pt
    A spam filter is built from 1,000 spam emails and 10,000 non-spam emails. The word "cheap" appears in 54 of the spam emails. Using a document-frequency estimate with no smoothing, what is P("cheap" given spam)?
  89. not-a-ranking-function-bce2024TF-IDF & rankingeasy1 pt
    Which of the following is NOT a common ranking function used in term-based information retrieval?
  90. parse-tree-correct2024Parsingeasy1 pt
    In NLP, which of the following statements regarding a parse tree is correct?
  91. preprocessing-not-a-step2024Text normalisationeasy1 pt
    Which of the following is NOT a text pre-processing step in an NLP application?
  92. qa-self-consistency2024LLM reasoningmedium1 pt
    The robustness (and hence performance) of an LLM-based question-answering system would likely be improved by:
  93. rag-not-true2024RAGmedium1 pt
    Which statement about Retrieval-Augmented Generation (RAG) models is NOT TRUE?
  94. regex-email2024Regular expressionsmedium1 pt
    Which one of the following regular expressions would match a student email of the form "first.lastname@mail.polimi.it"?
  95. rnn-not-true2024RNNsmedium1 pt
    Which of the following statements about Recurrent Neural Networks (RNNs) is NOT true?
  96. self-attention-update2024Attentionmedium1 pt
    How does a self-attention mechanism update the embedding vector at a position?
  97. seq2seq-attention-translation2024Seq2seq & translationmedium1 pt
    When used to build translation systems, sequence-to-sequence models with attention:
  98. seq2seq-long-text-problem2024Seq2seq & translationmedium1 pt
    What is the main problem with a simple sequence-to-sequence architecture when translating long texts?
  99. stopwords2024Text normalisationeasy1 pt
    Stopwords are:
  100. stt-eval-measure2024Speech recognitionmedium1 pt
    Which of the following measures would NOT be appropriate for evaluating a speech-to-text system?
  101. symmetry-positional-embeddings2024Transformer architecturemedium1 pt
    What technique is used to break the symmetry with respect to the input token positions within a Transformer model?
  102. tokenization-definition2024Tokenizationeasy1 pt
    In NLP, what is tokenization?
  103. tts-homograph2024Text-to-speechmedium1 pt
    In text-to-speech systems, certain words like "bass" can be problematic. Why?
  104. tts-normalisation2024Text normalisationeasy1 pt
    Text normalisation is needed for a text-to-speech system in order to:
  105. variance-ratio-criterion2024Clusteringmedium1 pt
    The Variance Ratio Criterion (a.k.a. the Calinski–Harabasz index) is an example of:
  106. vector-db-rag-application2024Vector databaseseasy1 pt
    What is the primary application of vector databases in the context of RAG models?
  107. word-embedding-not-property2024Word embeddingshard1 pt
    Which of the following is NOT usually a property of word embeddings?
  108. word-normalisation2024Text normalisationmedium1 pt
    Word normalisation is the process of:
  109. activation-not-used2023Neural networkseasy1 pt
    Which of the following functions is NOT commonly used as an activation function in neural networks?
  110. clustering-news-aggregator2023Clusteringeasy1 pt
    News aggregators (sites that gather headlines from many sources) can use clustering to:
  111. confusion-matrix-counts2023Classifier evaluationeasy1 pt
    After training a text classifier and running it on the test set, we get the confusion matrix below. What are the true-positive (TP), true-negative (TN), false-positive (FP) and false-negative (FN) counts, taking "+" as the positive class?
    Rows = actual class, columns = predicted class
                  Pred +    Pred -
    Actual +       2401       103
    Actual -        142      3071
    
  112. crf-task2023Sequence labellingeasy1 pt
    Traditionally, Conditional Random Fields (CRFs) were used in NLP to solve which of the following tasks?
  113. dnn-not-true2023Neural networkseasy1 pt
    Which of the following statements about Deep Neural Networks (DNNs) is NOT generally true?
  114. eliza-rogerian2023Dialoguemedium1 pt
    What trick did ELIZA (the chatbot) use to create meaningful conversations in an open domain with little or no domain knowledge?
  115. embedding-memory-glove2023Word embeddingsmedium1 pt
    You learn GloVe embeddings of size 512 over a vocabulary of one million tokens. Roughly how much memory (in GB) is needed to store all the vectors using double-precision (64-bit) floats? (1 byte = 8 bits.)
  116. few-shot-learning-example2023Promptingmedium1 pt
    Imagine the following prompts to a language model that all try to redefine addition in an Orwellian dystopia. Which of them is an example of few-shot learning?
  117. hac-single-linkage2023Clusteringmedium1 pt
    In hierarchical agglomerative clustering, if single-linkage (minimum distance) is used, what does that tell you about the clusters that could be found?
  118. idf-interpretation2023TF-IDF & rankinghard1 pt
    Assuming terms occur approximately independently within documents, when we apply IDF term weighting to rank documents for a query, we effectively score each document by:
  119. info-theory-information2023Naive Bayeseasy1 pt
    In information theory, the amount of information learnt from an event is equal to:
  120. kmedoids-disadvantage2023Clusteringmedium1 pt
    The main disadvantage of the k-Medoids algorithm with respect to k-Means is:
  121. multitask-finetuning-benefit2023Multi-task learningmedium1 pt
    In multi-task learning we fine-tune a language model to perform many different tasks (with different prompts) at the same time. The aim/benefit of doing this is to get the model to:
  122. nb-good-grade2023Naive Bayesmedium1 pt
    A Naive Bayes model predicts whether a student gets a "good" or "bad" grade from the fact that she described the exam as "easy" but "long". Given P(easy|good)=2/3, P(long|good)=1/3, P(easy|bad)=1/3, P(long|bad)=2/3, P(good)=3/4, what is P(good | easy, long)? (Recall P(y|x) is proportional to P(y)·∏ P(xᵢ|y).)
  123. ner-paris-hilton2023Named entitieseasy1 pt
    "Paris Hilton was photographed leaving the Paris Hilton" is an example of a sentence containing:
  124. ngram-not-a-technique2023N-gram language modelsmedium1 pt
    A number of techniques improve the next-word probability estimates of a Markov (n-gram) language model. Which of the following is NOT one of those techniques?
  125. perplexity-i-love-nlp2023N-gram language modelsmedium1 pt
    If the probability of the sequence "I love NLP" is exactly 1/64 (word-level tokenisation), what is the perplexity of the sentence?
  126. phoneme-speaking-rate2023Speech recognitionhard1 pt
    Some people speak faster than others, so a phoneme detector tuned to fast speakers will observe many repeated phonemes for slower speakers. How might we BEST overcome this when building a speech-transcription system?
  127. prosody-definition2023Speecheasy1 pt
    In NLP, prosody refers to:
  128. regex-count-funny2023Regular expressionshard1 pt
    How many (non-overlapping) times would the regular expression "f\w*ny?" match the string "While I get how you feel, I don't find this exam either fun or funny."?
  129. regex-count-the2023Regular expressionshard1 pt
    How many (non-overlapping) times would the regular expression ".*th?e" match the string "In the tree, there were three extraterrestrials with no teeth"?
  130. regex-license-plate2023Regular expressionsmedium1 pt
    Which, if any, of the following strings would the regular expression "[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]" match?
  131. regex-not-a-limitation2023Regular expressionseasy1 pt
    Regular expressions provide a powerful language for writing rules to extract content from text documents, but have various limitations. Which of the following would NOT be considered a limitation of regular-expression-based text extraction?
  132. regex-phone2023Regular expressionshard1 pt
    Which one of the following regular expressions would match the telephone number "+69 403 992 010"?
  133. seq2seq-not-possible-task2023Seq2seq & translationmedium1 pt
    Which of the following tasks could NOT be modelled as a sequence-to-sequence problem?
  134. speech-act-backchannel2023Dialoguemedium1 pt
    In terms of speech acts and discourse analysis, when someone repeats back to the speaker part of what they have just said, what is usually the purpose of doing this?
  135. t5-not-true-encoder-decoder2023Transformershard1 pt
    Which statement about the T5 (Text-To-Text Transfer Transformer) model is NOT true?
  136. top-k-1-greedy2023N-gram language modelseasy1 pt
    When generating text with top-k sampling, setting k to 1 is equivalent to performing:
  137. topic-discovery-lda2023Topic modellingeasy1 pt
    Which of the following techniques might be used to discover the topics discussed in a collection of documents?
  138. topk-renormalize-exam2023N-gram language modelshard1 pt
    A bigram model gives these next-token probabilities after "amazing" (highest to lowest): grace 4%, food 3%, location 2%, experience 2%, people 2%, place 2%, minds 2%, experiences 1%, places 1%, exam 1%, … Using top-k sampling with k = 10, what is the chance the model produces "exam" as the next token?
  139. topk-renormalize-fun2023N-gram language modelshard1 pt
    A trigram model gives these next-token probabilities after "too much" (highest to lowest): work 3%, effort 2.5%, fun 2%, food 1.5%, time 1%, money 0.5%, … Using top-k sampling with k = 5, what is the chance the model produces "fun" as the next token?
  140. wav2vec-whisper-true2023Speech recognitionmedium1 pt
    Which of the following statements about Wav2vec (2020) and Whisper (2022) is true?
  141. word-embedding-uses-not-true2023Word embeddingsmedium1 pt
    Which statement about the uses of word embeddings is NOT generally true?
  142. word-level-label-task2023Sequence labellingeasy1 pt
    Which of the following tasks involves assigning a categorical label to every word in a piece of text?