MauryaHub PYQ Practice

da4001_2026T2_Q2_NA.pdf

Data Science and AI Lab · Quiz 2 · May 2026

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

Question 2 NAT · 2.0 marks

Given the following code snippet, how many **unique values** will be present in the column (Z) of the resulting DataFrame (df)? [[IMAGE:1b2b0a0d096d7b2f_2_2]]
Source diagram or notation

    A published solution is not available for this question yet.

    Question 3 NAT · 2.0 marks

    What will be the output of the following code? [[IMAGE:1b2b0a0d096d7b2f_3_3]]
    Source diagram or notation

      A published solution is not available for this question yet.

      Question 4 NAT · 2.0 marks

      A binary classification model is evaluated on a test set of 10 images, classifying each as either Horse ('H') or Zebra ('Z'). The true labels and the predicted labels are provided below: [[IMAGE:1b2b0a0d096d7b2f_3_4]] What is the precision of the model for the "Horse" class?
      Source diagram or notation

        A published solution is not available for this question yet.

        Question 5 NAT · 2.0 marks

        An agent's ReAct loop performs 1 initial reasoning step, then 3 more reasoning steps (one after each of 3 tool calls) — 4 reasoning steps total for one query. Each reasoning step consumes 250 input tokens + 150 output tokens. What is the **total number of tokens** consumed by reasoning alone for one query?

          A published solution is not available for this question yet.

          Question 6 MCQ · 2.0 marks

          What will be the output of the following code? [[IMAGE:1b2b0a0d096d7b2f_4_5]]
          Source diagram or notation
          1. [8.0, np.nan]
          2. [3.0, 8.0]
          3. [7.0, 6.0]
          4. [8.0, 6.0]
          5. Code will throw an Error

          A published solution is not available for this question yet.

          Question 7 MCQ · 2.0 marks

          An ML practitioner is evaluating a classification model by plotting its training and validation loss over 100 epochs. Which of the following statements regarding model evaluation and overfitting is true?
          1. Overfitting is occurring if the validation loss strictly decreases alongside the training loss.
          2. An overfitted model typically exhibits high bias and low variance.
          3. Early stopping can mitigate overfitting by halting the training process before the model begins to memorize noise.
          4. Duplicating the training data points is an effective way to reduce model variance and improve generalization.

          A published solution is not available for this question yet.

          Question 8 MCQ · 2.0 marks

          Which of the following describes the behavior of [[IMAGE:1b2b0a0d096d7b2f_5_6]] in PyTorch regarding the input activation function?
          Source diagram or notation
          1. It expects raw logits.
          2. It requires a Sigmoid output.
          3. It requires a Tanh output.
          4. It requires a Softmax output.

          A published solution is not available for this question yet.

          Question 9 MCQ · 2.0 marks

          When defining a custom layer by subclassing [[IMAGE:1b2b0a0d096d7b2f_5_7]] , which method MUST be implemented to define the computation?
          Source diagram or notation
          1. step
          2. train
          3. forward
          4. backward

          A published solution is not available for this question yet.

          Question 10 MCQ · 2.0 marks

          What is the effect of calling [[IMAGE:1b2b0a0d096d7b2f_6_8]] on a network containing [[IMAGE:1b2b0a0d096d7b2f_6_9]] layers?
          Source diagram or notationSource diagram or notation
          1. Clears the gradient buffer.
          2. Freezes all model weights.
          3. Disables the dropout layers.
          4. Increases dropout probability.

          A published solution is not available for this question yet.

          Question 11 MCQ · 2.0 marks

          What is the primary function of the learnable [[IMAGE:1b2b0a0d096d7b2f_6_10]] token prepended to the input sequence in the original Vision Transformer architecture?
          Source diagram or notation
          1. Its final hidden state at the output of the transformer encoder serves as the global aggregate representation of the image for the classification task.
          2. It provides spatial coordinate data to allow the model to capture the relative distances and positions of the different image patches.
          3. It acts as a boundary separator to explicitly distinguish where one flattened 2D image patch ends and the next begins.
          4. It serves as a padding token to maintain a uniform sequence length when the model processes images of varying resolutions in a single batch.

          A published solution is not available for this question yet.

          Question 12 MCQ · 2.0 marks

          Which LangChain component is responsible for converting raw LLM responses into structured Python objects?
          1. [[IMAGE:1b2b0a0d096d7b2f_6_11]]
            Source diagram or notation
          2. [[IMAGE:1b2b0a0d096d7b2f_6_12]]
            Source diagram or notation
          3. [[IMAGE:1b2b0a0d096d7b2f_6_13]]
            Source diagram or notation
          4. [[IMAGE:1b2b0a0d096d7b2f_6_14]]
            Source diagram or notation

          A published solution is not available for this question yet.

          Question 13 MCQ · 2.0 marks

          [[IMAGE:1b2b0a0d096d7b2f_7_15]] With the above configuration, how does the conversation history returned by [[IMAGE:1b2b0a0d096d7b2f_7_16]] get stored in [[IMAGE:1b2b0a0d096d7b2f_7_17]] variable?
          Source diagram or notationSource diagram or notationSource diagram or notation
          1. A summarized conversation as a string
          2. A summarized conversation as a list
          3. The complete conversation history as a formatted string
          4. The complete conversation history as a list of message objects

          A published solution is not available for this question yet.

          Question 14 MCQ · 2.0 marks

          Choose the correct option with respect to the following code snippet: [[IMAGE:1b2b0a0d096d7b2f_7_18]]
          Source diagram or notation
          1. [[IMAGE:1b2b0a0d096d7b2f_7_19]] should be [[IMAGE:1b2b0a0d096d7b2f_7_20]] .
            Source diagram or notationSource diagram or notation
          2. [[IMAGE:1b2b0a0d096d7b2f_7_21]] should be [[IMAGE:1b2b0a0d096d7b2f_7_22]] .
            Source diagram or notationSource diagram or notation
          3. [[IMAGE:1b2b0a0d096d7b2f_7_23]] is a list, so this should be [[IMAGE:1b2b0a0d096d7b2f_7_24]] .
            Source diagram or notationSource diagram or notation
          4. There is no issue. This code runs correctly.

          A published solution is not available for this question yet.

          Question 15 MCQ · 2.0 marks

          Fix the broken chain: [[IMAGE:1b2b0a0d096d7b2f_8_25]] This throws a [[IMAGE:1b2b0a0d096d7b2f_8_26]] at runtime. What is the correct fix? ( [[IMAGE:1b2b0a0d096d7b2f_8_27]] is a helper function to format documents.)
          Source diagram or notationSource diagram or notationSource diagram or notation
          1. The pipe order is reversed - it should be [[IMAGE:1b2b0a0d096d7b2f_8_28]] , since the retriever must run first (query → docs) before formatting (docs → string).
            Source diagram or notation
          2. [[IMAGE:1b2b0a0d096d7b2f_8_29]] should be removed entirely as the context is directly going to come from retriever.
            Source diagram or notation
          3. [[IMAGE:1b2b0a0d096d7b2f_8_30]] should be replaced with [[IMAGE:1b2b0a0d096d7b2f_8_31]] .
            Source diagram or notationSource diagram or notation
          4. [[IMAGE:1b2b0a0d096d7b2f_8_32]] should come before [[IMAGE:1b2b0a0d096d7b2f_8_33]] .
            Source diagram or notationSource diagram or notation

          A published solution is not available for this question yet.

          Question 16 MCQ · 2.0 marks

          A legal-tech startup is building a tool that must always draft contracts using the firm's exact house style - specific clause phrasing, tone, and formatting conventions that must appear identically in every document, regardless of the underlying facts. The firm's knowledge (case law, templates) rarely changes. Which approach is the better primary fit, and why?
          1. RAG, because contracts count as "documents" and RAG works with any document type.
          2. Fine-tuning, because the requirement is about consistently reproducing a specific style/behavior in every output, not about injecting frequently-changing factual knowledge.
          3. RAG, because retrieving the firm's past contracts as context at generation time will reliably force the LLM to match their exact phrasing and formatting every time.
          4. Since the knowledge is mainly static, the team should skip both RAG and fine- tuning and just use a long, detailed system prompt with the house style rules.

          A published solution is not available for this question yet.

          Question 17 NAT · 3.0 marks

          Consider the following Python code snippet that defines the true class labels and the predicted probabilities for a batch of four data points: [[IMAGE:1b2b0a0d096d7b2f_9_34]] What will be the output of the code snippet? (Round your answer to two decimal places)
          Source diagram or notation

            A published solution is not available for this question yet.

            Question 18 NAT · 3.0 marks

            An RGB image of size [[IMAGE:1b2b0a0d096d7b2f_9_35]] is fed into a standard Vision Transformer (ViT). The image is divided into non-overlapping square patches with a side length of [[IMAGE:1b2b0a0d096d7b2f_9_36]] . Enter the final sequence length [[IMAGE:1b2b0a0d096d7b2f_10_37]] of the token embeddings that is input into the transformer encoder.
            Source diagram or notationSource diagram or notationSource diagram or notation

              A published solution is not available for this question yet.

              Question 19 NAT · 3.0 marks

              Consider the following code: [[IMAGE:1b2b0a0d096d7b2f_10_38]] The training dataset contains 960 samples, and there is one GPU. How many optimizer update steps are performed during training (ignore gradient accumulation and assume [[IMAGE:1b2b0a0d096d7b2f_10_39]] )?
              Source diagram or notationSource diagram or notation

                A published solution is not available for this question yet.

                Question 20 MCQ · 3.0 marks

                You run the following code using huggingface: [[IMAGE:1b2b0a0d096d7b2f_11_40]] What is the structure of the variable [[IMAGE:1b2b0a0d096d7b2f_11_41]] ?
                Source diagram or notationSource diagram or notation
                1. A single dictionary containing overall sentiment for both sentences.
                2. A list of tupples containing the label and sentiment score for both sentences.
                3. A single list containing the final labels for both sentences.
                4. A list of dictionaries, one for each input sentence, each containing a label and a score.

                A published solution is not available for this question yet.

                Question 21 MCQ · 3.0 marks

                What is the output of the following code? [[IMAGE:1b2b0a0d096d7b2f_12_42]]
                Source diagram or notation
                1. The code Raises an error
                2. [1,2,3,4,2,4,6,8]
                3. [2,4,6,8]
                4. [1,2,3,4]

                A published solution is not available for this question yet.

                Question 22 MCQ · 3.0 marks

                [[IMAGE:1b2b0a0d096d7b2f_12_43]] Using the default f-string template formatter shown above, what happens if the following line is executed? [[IMAGE:1b2b0a0d096d7b2f_13_44]]
                Source diagram or notationSource diagram or notation
                1. It prompts the user to enter the missing value.
                2. It substitutes an empty string.
                3. It returns the template with [[IMAGE:1b2b0a0d096d7b2f_13_45]] unchanged.
                  Source diagram or notation
                4. It raises a [[IMAGE:1b2b0a0d096d7b2f_13_46]]
                  Source diagram or notation

                A published solution is not available for this question yet.

                Question 23 MCQ · 3.0 marks

                Consider the following LangGraph router for an email assistant. The graph should: • Send **high priority** emails to [[IMAGE:1b2b0a0d096d7b2f_13_47]] • Send **low priority** emails to [[IMAGE:1b2b0a0d096d7b2f_13_48]] • Send all other emails to [[IMAGE:1b2b0a0d096d7b2f_13_49]] [[IMAGE:1b2b0a0d096d7b2f_14_50]] Which of the following options correctly fills **all six blanks**?
                Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
                1. (1) [[IMAGE:1b2b0a0d096d7b2f_14_51]] (2) [[IMAGE:1b2b0a0d096d7b2f_14_52]] (3) [[IMAGE:1b2b0a0d096d7b2f_14_53]] (4) [[IMAGE:1b2b0a0d096d7b2f_14_54]] (5) [[IMAGE:1b2b0a0d096d7b2f_14_55]] (6) [[IMAGE:1b2b0a0d096d7b2f_14_56]]
                  Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
                2. (1) [[IMAGE:1b2b0a0d096d7b2f_14_57]] (2) [[IMAGE:1b2b0a0d096d7b2f_14_58]] (3) [[IMAGE:1b2b0a0d096d7b2f_14_59]] (4) [[IMAGE:1b2b0a0d096d7b2f_14_60]] (5) [[IMAGE:1b2b0a0d096d7b2f_14_61]] (6) [[IMAGE:1b2b0a0d096d7b2f_14_62]]
                  Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
                3. (1) [[IMAGE:1b2b0a0d096d7b2f_14_63]] (2) [[IMAGE:1b2b0a0d096d7b2f_14_64]] (3) [[IMAGE:1b2b0a0d096d7b2f_14_65]] (4) [[IMAGE:1b2b0a0d096d7b2f_14_66]] (5) [[IMAGE:1b2b0a0d096d7b2f_14_67]] (6) [[IMAGE:1b2b0a0d096d7b2f_14_68]]
                  Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
                4. (1) [[IMAGE:1b2b0a0d096d7b2f_14_69]] (2) [[IMAGE:1b2b0a0d096d7b2f_14_70]] (3) [[IMAGE:1b2b0a0d096d7b2f_14_71]] (4) [[IMAGE:1b2b0a0d096d7b2f_14_72]] (5) [[IMAGE:1b2b0a0d096d7b2f_14_73]] (6) [[IMAGE:1b2b0a0d096d7b2f_14_74]]
                  Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation

                A published solution is not available for this question yet.

                Question 24 MSQ · 2.0 marks

                Consider the following code and select the correct statement: [[IMAGE:1b2b0a0d096d7b2f_15_75]] Which of the following will be contained in [[IMAGE:1b2b0a0d096d7b2f_15_76]] ?
                Source diagram or notationSource diagram or notation
                1. input_ids
                2. attention_mask
                3. token_type_ids
                4. padding_id

                A published solution is not available for this question yet.

                Question 25 MSQ · 3.0 marks

                A student justifies their chunking choice like this: "I will set [[IMAGE:1b2b0a0d096d7b2f_15_77]] and [[IMAGE:1b2b0a0d096d7b2f_15_78]] so I get fewer, bigger chunks - that way retrieval is faster since there's less to search through, and I never lose any context since overlap does not matter if chunks are big enough." What is wrong with this reasoning? (Select all that apply)
                Source diagram or notationSource diagram or notation
                1. Nothing is wrong - this is a sound strategy
                2. Bigger chunks reduce the number of vectors to compare, but at that size a chunk likely mixes multiple unrelated topics, hurting the precision of what gets retrieved.
                3. [[IMAGE:1b2b0a0d096d7b2f_15_79]] risks splitting a relevant idea exactly at a chunk boundary
                  Source diagram or notation
                4. [[IMAGE:1b2b0a0d096d7b2f_15_80]] is invalid and will throw an error
                  Source diagram or notation

                A published solution is not available for this question yet.

                Question 26 MSQ · 4.0 marks

                Examine the code below, which is meant to build a LangGraph agent: the [[IMAGE:1b2b0a0d096d7b2f_16_81]] node decides whether to call a [[IMAGE:1b2b0a0d096d7b2f_16_82]] or finish, based on [[IMAGE:1b2b0a0d096d7b2f_16_83]] . [[IMAGE:1b2b0a0d096d7b2f_17_84]] Which of the following statements about this code are **correct**? (Select all that apply)
                Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
                1. Replacing [[IMAGE:1b2b0a0d096d7b2f_17_85]] with the string [[IMAGE:1b2b0a0d096d7b2f_17_86]] in the conditional edge mapping would still terminate the graph correctly.
                  Source diagram or notationSource diagram or notation
                2. Replacing [[IMAGE:1b2b0a0d096d7b2f_17_87]] with [[IMAGE:1b2b0a0d096d7b2f_17_88]] would preserve the same behavior.
                  Source diagram or notationSource diagram or notation
                3. If [[IMAGE:1b2b0a0d096d7b2f_18_89]] returned [[IMAGE:1b2b0a0d096d7b2f_18_90]] instead of [[IMAGE:1b2b0a0d096d7b2f_18_91]] without changing the mapping, execution would fail at runtime.
                  Source diagram or notationSource diagram or notationSource diagram or notation
                4. [[IMAGE:1b2b0a0d096d7b2f_18_92]] is called incorrectly because the mapping dictionary should come before the routing function.
                  Source diagram or notation
                5. The graph would behave the same if [[IMAGE:1b2b0a0d096d7b2f_18_93]] were replaced with [[IMAGE:1b2b0a0d096d7b2f_18_94]] .
                  Source diagram or notationSource diagram or notation
                6. The graph correctly loops between [[IMAGE:1b2b0a0d096d7b2f_18_95]] and [[IMAGE:1b2b0a0d096d7b2f_18_96]] until [[IMAGE:1b2b0a0d096d7b2f_18_97]] returns [[IMAGE:1b2b0a0d096d7b2f_18_98]] .
                  Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation

                A published solution is not available for this question yet.