MauryaHub PYQ Practice

Quiz1

Computational Thinking · Quiz 1 · 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 MCQ · 0.0 marks

[[IMAGE:c400f0f09057b613_2_2]] [[IMAGE:c400f0f09057b613_3_3]]
Source diagram or notationSource diagram or notation
  1. Useful Data has been mentioned above.
  2. This data attachment is just for a reference & not for an evaluation.

Published solution

**1. Understand:** This is an instruction item (0 marks). It only shows the sample datasets (Scores, Words, Library, Olympics and Shopping Bills) that later questions use. **2. Conclude:** The statement that useful data has been mentioned above is the correct one. The data is needed to solve the later questions, so it is not just a reference. Answer: A — Useful Data has been mentioned above.. A: **Correct:** The tables shown are used by the questions that follow. B: **Incorrect:** The datasets are needed to answer later questions, so they are not only a reference.

Question 3 MCQ · 5.0 marks

The following pseudocode is executed using the **Word** dataset. What will count represent at the end of the execution? [[IMAGE:c400f0f09057b613_4_4]]
Source diagram or notation
  1. Number of words which are nouns and have at most four letters
  2. Number of words which are either not nouns or have at least four letters but not both
  3. Number of words which are either nouns or have at most four letters or both
  4. Number of words which are nouns and have at least four letters

Published solution

**1. Understand:** The code reads each row X of the Words table. It sets flag1 when the word is a noun and flag2 when LetterCount is at least 4. **2. Analyze:** count increases only when `flag1 and flag2` is True. That means both conditions hold together: the word is a noun AND it has 4 or more letters. **3. Conclude:** count is the number of words that are nouns and have at least four letters. Answer: D — Number of words which are nouns and have at least four letters. A: **Incorrect:** The code tests LetterCount >= 4 (at least four), not at most four. B: **Incorrect:** The code uses AND, not 'exactly one of the two'. C: **Incorrect:** The code uses AND, not OR. D: **Correct:** count increases only when the word is a noun and LetterCount >= 4.

Question 4 MCQ · 5.0 marks

The following pseudocode is executed on the **"Library"** dataset. What will **count** represent after the pseudocode below is executed? [[IMAGE:c400f0f09057b613_5_5]]
Source diagram or notation
  1. Number of book pairs that have different authors but are written in the same language
  2. Number of book pairs that have different authors and languages
  3. Number of book pairs that have the same author but are in different languages
  4. Number of book pairs that have same author and are in the same language

Published solution

**1. Understand:** The outer loop takes a book X. The inner loop compares X with every remaining book Y. Each pair is checked once because X is moved to Table 2 and never compared again. **2. Apply verifyPair:** It returns True when `X.Author != Y.Author` and `X.Language == Y.Language`. **3. Conclude:** count is the number of book pairs with different authors but the same language. Answer: A — Number of book pairs that have different authors but are written in the same language. A: **Correct:** verifyPair checks different authors AND the same language. B: **Incorrect:** The code requires the same language, not different languages. C: **Incorrect:** The code requires different authors, not the same author. D: **Incorrect:** The code requires different authors, not the same author.

Question 5 MCQ · 5.0 marks

**Statement** The following pseudocode is executed using the "Words" dataset. At the end of the execution, **count** stores the number of pairs of verbs such that both verbs have either different letter counts or both end with a full stop. Choose the correct code fragment to complete the pseudocode. [[IMAGE:c400f0f09057b613_6_6]]
Source diagram or notation
  1. Statement 1: **X**.PartOfSpeech == "Verb" Statement 2: **X**.PartOfSpeech == **Y**.PartOfSpeech Statement 3: **X**.Word and **Y**.Word end with a full stop
  2. Statement 1: **X**.PartOfSpeech == **Y**.PartOfSpeech Statement 2: **X**.PartOfSpeech == "Verb" Statement 3: **X**.Word and **Y**.Word end with a full stop
  3. Statement 1: **X**.PartOfSpeech == "Verb" Statement 2: **X**.Word and **Y**.Word end with a full stop Statement 3: **X**.PartOfSpeech == **Y**.PartOfSpeech
  4. Statement 1: **X**.Word and **Y**.Word end with a full stop Statement 2: **X**.PartOfSpeech == **Y**.PartOfSpeech Statement 3: **X**.PartOfSpeech == "Verb"

Published solution

**1. Understand:** We count pairs of verbs where the letter counts differ, or (when letter counts are equal) both words end with a full stop. **2. Statement 1:** It sits in the outer loop, so it must check that X is a verb: `X.PartOfSpeech == "Verb"`. **3. Statement 2:** Inside the inner loop, X is already a verb. So `X.PartOfSpeech == Y.PartOfSpeech` makes sure Y is also a verb. **4. Statement 3:** It is in the else branch (letter counts equal). It must check that both words end with a full stop. **5. Conclude:** The only matching combination is the first option. Answer: A — Statement 1: **X**.PartOfSpeech == "Verb" Statement 2: **X**.PartOfSpeech == **Y**.PartOfSpeech Statement 3: **X**.Word and **Y**.Word end with a full stop. A: **Correct:** Outer check is X is a verb, inner check is Y is also a verb, and the else branch checks full stops. B: **Incorrect:** Statement 1 would not force X to be a verb, so non-verb pairs would be counted. C: **Incorrect:** Statement 2 would test full stops before checking letter counts, which breaks the logic. D: **Incorrect:** Statement 1 would not force X to be a verb and the order is wrong.

Question 6 MCQ · 3.0 marks

Match the following expressions in the **Column 1** with the appropriate values in **Column 2**. [[IMAGE:c400f0f09057b613_7_7]]
Source diagram or notation
  1. a - (3), b - (2), c - (2), d - (5), e - (3)
  2. a - (1), b - (3), c - (2), d - (1), e - (2)
  3. a - (3), b - (2), c - (1), d - (3), e - (2)
  4. a - (1), b - (3), c - (2), d - (1), e - (1)

Published solution

**1. Evaluate each expression:** - a. `3 = 3 and 3 > 4` uses a single `=` (assignment) in a condition, so it is an invalid expression → 3. - b. `3 == 3 or 2 > 3` is True or False = True → 2. - c. `2 == 2 and 2 > 3` is True and False = False → 1. - d. `3 + '3'` adds a number and a string, which is invalid → 3. - e. `2 >= 2` is True → 2. **2. Match:** a-3, b-2, c-1, d-3, e-2. **3. Conclude:** This is the third option. Answer: C — a - (3), b - (2), c - (1), d - (3), e - (2). A: **Incorrect:** Wrong for c and d: c is False (1) and d is invalid (3). B: **Incorrect:** Wrong for a: it uses `=`, so it is invalid (3), not False. C: **Correct:** Matches all five evaluations. D: **Incorrect:** Wrong for a, b and e.

Question 7 MCQ · 3.0 marks

The following pseudocode is executed using the **“Scores”** dataset. [[IMAGE:c400f0f09057b613_7_8]] Which of the following statements is correct?
Source diagram or notation
  1. **A** represents the number of female students whose total marks are at least 250.
  2. **B** represents the number of female students whose total marks are less than 250.
  3. **B** represents the number of students whose total marks are less than 250.
  4. **A** represents number of male students whose total marks are at most 250..

Published solution

**1. Understand:** Flag is True only for males with Total < 250. **2. Analyze A:** A increases when Flag is False. So A counts everyone except males with Total < 250, that is all females plus males with Total >= 250. **3. Analyze B:** Inside that group, B increases when Total < 250. Males with Total < 250 are already excluded, so B counts only females with Total < 250. **4. Conclude:** B is the number of female students whose total marks are less than 250. Answer: B — **B** represents the number of female students whose total marks are less than 250.. A: **Incorrect:** A also counts all males with Total >= 250, and it counts every female, not just those with at least 250. B: **Correct:** B counts females with Total < 250 because males with Total < 250 are excluded. C: **Incorrect:** B excludes males with Total < 250, so it is not all students. D: **Incorrect:** A counts females and males with Total >= 250; it is not males with at most 250.

Question 8 MSQ · 5.0 marks

The following pseudocode is executed using the **Shopping Bills** dataset. At the end of the execution, **A** captures the lowest price across all items purchased from **Big Bazaar**. But the pseudocode may have mistakes in one or more lines. Identify all such lines (if any). Assume that all statements not listed in the options below are free of errors. [[IMAGE:c400f0f09057b613_8_9]]
Source diagram or notation
  1. Line 1: Incorrect initialization of ***A***
  2. Line 6: Incorrect conditional statement
  3. Line 14: Incorrect initialization of ***minPrice***
  4. Line 17: Incorrect conditional statement

Published solution

**1. Goal:** A must hold the lowest price over all Big Bazaar items. So for each Big Bazaar card we find its minimum price, and A keeps the smallest of these. **2. Line 6:** We should update A when the new value is smaller: `if(temp < A)`. The code uses `>`, which finds the maximum. **Error.** **3. Line 14:** minPrice starts at 0, and no price is smaller than 0, so the line 17 test never updates it. It must start with a large value (or the first item's price). **Error.** **4. Line 17:** `minPrice > Z.Price` is the correct test for a minimum. **No error.** **5. Line 1:** A starts at 100, which is above the lowest Big Bazaar price (32 in the sample card), so it works for this dataset. **Treated as no error.** **Convention note:** The key treats line 1 as correct. This assumes at least one Big Bazaar price is below 100; a safer start would be a much larger number. Answer: B, C — Line 6 and Line 14 have errors. A: **Incorrect:** A = 100 works here because the lowest Big Bazaar price is below 100. B: **Correct:** It should be `temp < A` to find the minimum. C: **Correct:** minPrice = 0 can never be reduced; it needs a large starting value. D: **Incorrect:** `minPrice > Z.Price` is the right test for a minimum.

Question 9 NAT · 4.0 marks

**Statement** The following pseudocode is executed using a dataset similar to the "Words" dataset, based on the following paragraph. "Mountains often appear calm from a distance, hiding their rugged terrain. Moments of reflection help people understand themselves better. The evening breeze carried the scent of flowers across the valley. Morning walks encouraged Rahul to maintain a healthy routine. Birds chirped softly as the sun rose above the horizon." [[IMAGE:c400f0f09057b613_9_10]] What would be the value of **count** at the end of the execution of the pseudocode above ? Assume that upper case and lower case are ignored during comparison of letters.
Source diagram or notation

    Published solution

    **1. Understand:** `flag` is True for the very first word and for any word that comes right after a word ending with a full stop. So the 'm' and 'o' test is applied only to the first word of each sentence. **2. List the sentence-starting words:** - Sentence 1: **Mountains** → starts with 'mo' ✓ - Sentence 2: **Moments** → 'mo' ✓ - Sentence 3: **The** → 'th' ✗ - Sentence 4: **Morning** → 'mo' ✓ - Sentence 5: **Birds** → 'bi' ✗ **3. Count:** Three words pass (Mountains, Moments, Morning). Other words such as 'distance' or 'help' are skipped because flag is False for them. Answer: 3.

    Question 10 MCQ · 4.0 marks

    **Statement** The following pseudocode is executed using the “Scores” dataset. What will **A** represent at the end of the execution? [[IMAGE:c400f0f09057b613_10_11]]
    Source diagram or notation
    1. Number of students with highest marks in Physics among the three subjects
    2. Number of students with highest marks in Physics and lowest marks in Mathematics
    3. Number of students with highest marks in Chemistry among the three subjects
    4. Number of students with lowest marks in Mathematics among the three subjects

    Published solution

    **1. Understand:** isInSeq(X) returns 1 only if X.Physics > X.Mathematics and X.Chemistry < X.Physics. Otherwise it returns 0. **2. Analyze:** Both conditions together mean Physics is larger than both Mathematics and Chemistry. So Physics is the highest of the three. **3. Conclude:** A counts students with the highest marks in Physics among the three subjects. Answer: A — Number of students with highest marks in Physics among the three subjects. A: **Correct:** Physics is greater than both other subjects, so it is the highest. B: **Incorrect:** The code does not check that Mathematics is the lowest; it only compares Physics with each. C: **Incorrect:** Chemistry is only compared as being less than Physics, so it cannot be the highest. D: **Incorrect:** Mathematics is not checked to be the lowest.

    Question 11 MCQ · 4.0 marks

    **Statement** The following pseudocode is executed using the “Olympics” dataset. Procedure **doSomething** accepts a table where all rows belong to the same player. Assume that the player has won at least two medals and only one medal in any year. At the end of the execution, if (**B - A**) represents year the gap between first and second medals won by a player then, choose the correct code fragment to complete the pseudocode. [[IMAGE:c400f0f09057b613_11_12]]
    Source diagram or notation
    1. [[IMAGE:c400f0f09057b613_11_13]]
      Source diagram or notation
    2. [[IMAGE:c400f0f09057b613_11_14]]
      Source diagram or notation
    3. [[IMAGE:c400f0f09057b613_11_15]]
      Source diagram or notation
    4. [[IMAGE:c400f0f09057b613_12_16]]
      Source diagram or notation

    Published solution

    **1. Goal:** After the loop, A should be the earlier medal year and B the later one (the two smallest years). Both start at 2030. **2. Check the first option:** - If a year is smaller than A: the old A moves to B and A becomes the new year. - Else if the year is between A and B: B becomes that year. - Larger years are ignored. So A is always the smallest year and B the second smallest, and B - A is the gap between the first and second medals. **3. Check the others:** The second option updates B but never updates A. The third option has a condition that cannot give the second smallest year. The fourth option makes B the largest year. **4. Conclude:** The first code fragment is correct. Answer: A — the first code fragment (shifts A to B when a smaller year is found). A: **Correct:** It keeps A as the smallest year and B as the second smallest. B: **Incorrect:** It sets B = A but never updates A, so A stays 2030. C: **Incorrect:** Its second condition (year < A and year > B) is wrong for finding the second smallest year. D: **Incorrect:** It makes A the smallest and B the largest, so B - A is not the gap between the first two medals.

    Question 12 MCQ · 4.0 marks

    **Statement** The following procedure is executed using "Words" dataset. What will **A** represent at the end of the execution? Step 1. Arrange all cards in a single pile called Pile 1 Step 2. Maintain two variables **A**, **B** and initialize them to 0 Step 3. If Pile 1 is empty then stop the iteration Step 4. Read the top card in Pile 1 Step 5. Increment variable **B** Step 6. If Word does not end with a full stop then execute step 9 Step 7. If Word ends with a full stop and **B > A** then store **B** in **A** Step 8. Re-initialize the variable **B** to 0 Step 9. Move the current card to another pile called Pile 2 and repeat from step 3
    1. Length of the shortest sentence based on the number of words
    2. Length of the longest sentence based on the number of words
    3. Length of the longest sentence based on the number of letters
    4. Length of the shortest sentence based on the number of letters

    Published solution

    **1. Understand:** B is increased for every word read. When a word ends with a full stop, it ends a sentence. At that point, if B > A, A stores B. Then B is reset to 0. **2. Analyze:** So B counts the words in the current sentence. A keeps the largest B seen so far. **3. Conclude:** A is the length of the longest sentence based on the number of words. Letters are never counted. Answer: B — Length of the longest sentence based on the number of words. A: **Incorrect:** A keeps the maximum, not the minimum. B: **Correct:** B counts words in a sentence, and A keeps the largest. C: **Incorrect:** The procedure counts words, not letters. D: **Incorrect:** The procedure counts words, not letters, and keeps the maximum.

    Question 13 MCQ · 4.0 marks

    **Statement** A pair of words is said to be special if it fulfills following conditions: The number of vowels are the same in both words and the number of consonants are not the same in both words. The given pseudocode is executed using the “**Words**” dataset. The variable **count** in the given pseudocode counts the number of special pairs. Choose the correct code fragment to complete the pseudocode. [[IMAGE:c400f0f09057b613_13_17]]
    Source diagram or notation
    1. [[IMAGE:c400f0f09057b613_13_18]]
      Source diagram or notation
    2. [[IMAGE:c400f0f09057b613_13_19]]
      Source diagram or notation
    3. [[IMAGE:c400f0f09057b613_14_20]]
      Source diagram or notation
    4. [[IMAGE:c400f0f09057b613_14_21]]
      Source diagram or notation

    Published solution

    **1. Understand:** A special pair has the same number of vowels but a different number of consonants. **2. Idea:** LetterCount = vowels + consonants. If the vowel counts are equal, then the consonant counts differ exactly when the LetterCounts differ. **3. Apply:** So the test is `X.LetterCount != Y.LetterCount` and `vCount(X) == vCount(Y)`. **4. Conclude:** The second code fragment is correct. Answer: B — the second code fragment (different LetterCount and equal vCount). A: **Incorrect:** It requires equal letter counts and equal vowels, which makes consonants equal too. B: **Correct:** Different letter counts with equal vowel counts means different consonant counts. C: **Incorrect:** It requires equal letter counts but different vowel counts, which is not special. D: **Incorrect:** It requires different vowel counts, but special pairs need equal vowel counts.

    Question 14 MSQ · 4.0 marks

    **Statement** A student proposed a hypothesis that fewer students are born in the first half of the year than the second half of the year. She wrote the following procedure which uses the “Scores” dataset to verify the hypothesis. However, the procedure may contain some errors. Find out the errors if present. Step 1: Arrange all cards in a single pile called Pile 1 Step 2: Maintain two variables **A** and **B** and initialize them to 0 Step 3: If Pile 1 is empty then stop the iteration and start from Step 8 Step 4: Read the top card in Pile 1 Step 5: If the Date of Birth is from 1st January to 30th June then increment **A** Step 6: If the Date of Birth is from 1st July to 31st December then increment **B** Step 7: Move the current card to another pile called Pile 2 and repeat from Step 3 Step 8: If **A > B** then declare the hypothesis to be True Step 9: If **A ≤ B** then declare the hypothesis to be False
    1. Step 5 to increment A is incorrect
    2. Step 6 to increment B is incorrect
    3. Step 8 to declare the hypothesis as True is incorrect
    4. Step 9 to declare the hypothesis as False is incorrect
    5. The procedure is free of errors

    Published solution

    **1. Hypothesis:** Fewer students are born in the first half than in the second half. So the hypothesis is True when A < B (A counts first-half births, B counts second-half births). **2. Check Steps 5 and 6:** The date ranges 1 Jan to 30 June (A) and 1 July to 31 Dec (B) cover the whole year, so both are correct. **3. Check Step 8:** It says True when A > B, which is the opposite. **Incorrect.** **4. Check Step 9:** It says False when A <= B. But if A < B the hypothesis is True, so this is wrong. False should be declared when A >= B. **Incorrect.** Answer: C, D — Steps 8 and 9 are incorrect. A: **Incorrect:** The date range for A is correct. B: **Incorrect:** The date range for B is correct. C: **Correct:** True should be declared when A < B, not A > B. D: **Correct:** False should be declared when A >= B, not A <= B. E: **Incorrect:** Steps 8 and 9 contain errors.