MauryaHub PYQ Practice

Computational Thinking · Quiz 2 · Jan 2026

Computational Thinking · Quiz 2 · Jan 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.

12 / 13 published solutions

Question 2 MCQ · 0.0 marks

Source diagram or notation
6406536625244.
Useful Data has been mentioned above.
6406536625245.
This data attachment is just for a reference & not for an evaluation.

Published solution

This is a reference card showing the schemas and sample rows of Scores, Words, Library, Olympics and Shopping Bills. It supplies context for later pseudocode questions rather than asking for a computed result. Use the field names and row meanings when tracing the later algorithms; the displayed ellipses indicate omitted rows, not a complete dataset. **Answer: A.** A: **Correct:** The source selects the acknowledgement that useful dataset information is supplied. B: **Incorrect:** This describes its reference role too, but is not the source's selected administrative acknowledgement; these are not competing computational answers.

Report a correction for Q2

Question 3 MCQ · 4.0 marks

What will be the value of **outList** at the end of execution of the given pseudocode?
Source diagram or notation
6406536625246.Source diagram or notation
6406536625247.Source diagram or notation
6406536625248.Source diagram or notation
6406536625249.Source diagram or notation

Published solution

process returns the last element of each inner list, giving Z, then Y, then X. The statement outList=[Z]+outList prepends each new result rather than appending it. Successive outList values are [Z], [Y,Z], and [X,Y,Z]. Hence the final order is ['X','Y','Z']. **Answer: B.** A: **Incorrect:** Would result from appending each value rather than prepending it. B: **Correct:** Correctly reverses the sequence of last elements by repeated prepending. C: **Incorrect:** Does not match any step of the prepend trace. D: **Incorrect:** Does not match the order produced by repeated prepending.

Report a correction for Q3

Question 4 MCQ · 4.0 marks

The following pseudocode is executed using the "Words" dataset and **explode**(**X**) returns the list of letters in the word **X**. For example **explode**("apple") will return ['a', 'p', 'p', 'l', 'e']. What will **cnt** represent at the end of the execution? Note: isVowel(c) returns True if c is a vowel, False otherwise. isConsonant(c) returns True if c is a consonant, False otherwise.
Source diagram or notation
6406536625250.
Number of words with at least one vowel followed immediately by another vowel.
6406536625251.
Number of words with at least one consonant followed immediately by a vowel.
6406536625252.
Number of words with at least one vowel followed immediately by a consonant.
6406536625253.
Number of words where the first letter is a vowel and the last is a consonant.

Published solution

checkPattern keeps the preceding character in prev and visits each following character as curr. It returns True when prev is a vowel and curr is a consonant, so it detects an adjacent vowel-consonant pair anywhere in a word. The outer cnt increases once per qualifying word, because the procedure returns immediately after the first match. Words shorter than two letters cannot qualify. **Answer: C.** A: **Incorrect:** The second member must be a consonant, not a vowel. B: **Incorrect:** Reverses the required order of the two character types. C: **Correct:** Precisely describes an adjacent vowel followed by a consonant. D: **Incorrect:** The search is over every adjacent pair, not just the two ends.

Report a correction for Q4

Question 5 MCQ · 4.0 marks

The following pseudocode is executed using the "Scores" dataset. What will the values of **A** and **B** represent at the end of the execution?
Source diagram or notation
6406536625258.
A = Cities where students score the highest marks in Mathematics B = The highest marks in Mathematics
6406536625259.
A = Number of cities where students score the highest marks in Mathematics B = The highest marks in Mathematics
6406536625260.
A = Number of cities where students score the lowest marks in Mathematics B = The lowest marks in Mathematics
6406536625261.
A = Always more than one B = The highest marks in Mathematics

Published solution

The first pass stores each city's minimum Mathematics score: replace D[city] only when a smaller score is found. The second pass finds the minimum among these city minima. When a smaller value is found, B becomes that value and A resets to 1; when a city equals the current B, A increases. Thus B is the global lowest score and A counts the cities containing at least one student with that score. The initial B=100 assumes marks are at most 100, as in this dataset. **Answer: C.** A: **Incorrect:** The comparisons track minima, and A is a count rather than a list of cities. B: **Incorrect:** The comparisons find the lowest, not highest, marks. C: **Correct:** Correctly identifies the minimum score and the number of cities attaining it. D: **Incorrect:** A can be one; neither claimed property is ensured.

Report a correction for Q5

Question 6 MCQ · 5.0 marks

Use the procedure **doSomething** given below.
Source diagram or notation
The following pseudocode is executed using the **Words** dataset and the procedure **doSomething** mentioned above. What will **sList** store at the end of the execution?
Source diagram or notation
6406536625254.
List of words from the "Words" dataset.
6406536625255.
List of unique words from the "Words" dataset.
6406536625256.
List of lists of words of each sentence from the "Words" dataset.
6406536625257.
List of lists of unique words of each sentence from the "Words" dataset

Published solution

doSomething builds a list of first occurrences, using a dictionary to prevent duplicate words. The outer code collects words until a full stop, removes duplicates within that sentence, appends the resulting list as one element of sList, and resets wList. Therefore sList is a list of per-sentence unique-word lists, preserving first occurrence order within each. It assumes sentences end with the specified full-stop marker. **Answer: D.** A: **Incorrect:** sList contains nested lists rather than one flat word list. B: **Incorrect:** Duplicates are removed per sentence, not globally into one flat list. C: **Incorrect:** The per-sentence words are deduplicated by doSomething. D: **Correct:** Matches both the sentence grouping and within-sentence deduplication.

Report a correction for Q6

Question 7 MCQ · 5.0 marks

The following pseudocode is executed on the "Shopping Bills" dataset. What will **Val** represent at the end of the execution?
Source diagram or notation
6406536625262.
Number of customers whose total spending is greater than the average bill value.
6406536625263.
Number of bills that are strictly greater than the average bill value.
6406536625264.
Total amount spent by customers who spent more than the average bill value.
6406536625265.
Number of customers whose single highest bill is greater than the average bill value.

Published solution

Each bill's item prices are summed into billTotal. globalSum/billCount computes the average bill value. Separately, CustomerTotal adds all bill totals for each customer. The final loop increments Val once for each customer whose accumulated spending exceeds the average single-bill value. These are different aggregation levels: customer totals are compared with a bill-level average. **Answer: A.** A: **Correct:** Exactly matches the final loop over customer names. B: **Incorrect:** The final loop visits customers, not individual bills. C: **Incorrect:** Val increments by 1, so it counts people rather than summing their expenditure. D: **Incorrect:** CustomerTotal sums bills; it does not keep a customer's maximum bill.

Report a correction for Q7

Question 8 MSQ · 4.0 marks

We have a dictionary **Registration** where the keys are student names and the values are lists of courses they have registered for. We want to create a new dictionary **CourseRoll** where the keys are course names and the values are lists of students registered for each course. For example, if **Registration** is:
Source diagram or notation
Identify the correct implementation(s).
6406536625266.Source diagram or notation
6406536625267.Source diagram or notation
6406536625268.Source diagram or notation
6406536625269.Source diagram or notation

Published solution

Invert the registration relation: for every student, visit every course in that student's list and append that student's name to the course's roster. Initialise a new roster once, then append for later students. A and C differ only in which branch handles the first occurrence. For example Math receives Rahul and Amar, while Physics receives Rahul and Sita. **Answer: A, C.** A: **Correct:** Initialises a course once and accumulates every registered student. B: **Incorrect:** Overwrites the roster on every visit, losing earlier students. C: **Correct:** Uses the same correct logic with the new-course case first. D: **Incorrect:** Treats Registration's student-name keys as course names and its course lists as student lists, reversing their actual meanings.

Report a correction for Q8

Question 9 MSQ · 4.0 marks

Two players play a game with dice. The results are stored in **dieRolls**, a list of pairs where each pair
Source diagram or notation
represents a roll:
Source diagram or notation
is Player 1's roll and
Source diagram or notation
is Player 2's roll. A player gets 1 point if their roll is higher than the other's. If both roll the same, no one gets a point. The procedure **getWinner** should return 1 if Player 1 wins, 2 if Player 2 wins, and 0 for a tie. Which of the following procedure(s) is/are correct?
6406536625270.
Procedure getWinner(dieRolls) pl = 0, p2=0 foreach r in dieRolls{ if(first(r) > last(r)){ pi = pi +1 } elsef{ if(last(r) > first(r)){ p2=p2+i1 } if(pl > p2) { return(1) } if(p2 > p1) { return(2) } return(0) End getWinner
6406536625271.
* Procedure getWinner(dieRolls) pl = 0, p2=0 foreach r in dieRolls{ if(first(r) >= last(r)){ pl = pi+1 } if(last(r) >= first(r)){ p2 = p2+1 } } if(p1 > p2) { return(1) } if(p2 > p1) { return(2) } return(0) End getWinner Procedure getWinner(dieRolls) diff = 0 foreach r in dieRolls{ if(first(r) > last(r)){ diff = diff +1 } if(last(r) > first(r)){ diff = diff - 1 } if(diff > 0) { return(1) } if(diff < 0) { return(2) } return(0) End getWinner
6406536625272.
¥
6406536625273.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q9

Question 10 MSQ · 5.0 marks

Let **SortedL** be a list of integers sorted in ascending order. The procedure **deleteVal(SortedL, X)** is supposed to delete first instance of **X** from **SortedL** (if it exists) while maintaining the sorted order. Identify the correct implementation(s). Note: Assume member function checks existence and remove function removes first occurrence in-place
6406536625274.Source diagram or notation
6406536625275.Source diagram or notation
6406536625276.Source diagram or notation
6406536625277.Source diagram or notation

Published solution

Deleting the first instance requires remembering whether a deletion has already happened, or using the stated remove operation that deletes only the first occurrence. A skips the first X and then preserves everything else. C likewise skips the first X, retaining subsequent copies. D checks existence and calls remove once. These operations preserve the relative order of all retained values, hence preserve sorted order. **Answer: A, C, D.** A: **Correct:** The found flag ensures exactly one X is skipped. B: **Incorrect:** Drops every X rather than only the first. C: **Correct:** The first X sets found without appending; subsequent X values are retained. D: **Correct:** The stipulated remove deletes one first occurrence and the membership test makes absence safe.

Report a correction for Q10

Question 11 NAT · 3.0 marks

Let **Z** be a row in the **Words** table such that **Z**.Word = "reluctant". What will be the value of **alphaDict['t']** at the end of the execution of the following pseudocode?
Source diagram or notation

Published solution

The starting dictionary already has alphaDict['t']=2. The word 'reluctant' contains t twice: at positions 6 and 9 when counted from 1. Each occurrence increments the existing t value by one. Therefore the final value is 2+2=4. The procedure adds to initial counts rather than resetting them for the new word. **Answer: 4.**

Report a correction for Q11

Question 12 NAT · 4.0 marks

The following procedure is executed on dictionary **D**: **D** = { 'A': 10, 'B': 25, 'C': 30, 'D': 40, 'E': 18 }
Source diagram or notation
What is the final value of **val**?

Published solution

Trace each value using its updated D[k] for the final threshold test. A:10 adds 10, halves to 5, then subtracts 5, net +5. B:25 subtracts 25, updates to 30, then adds 10, net -15. C:30 adds 30, halves to 15, then adds 10, net +40. D:40 adds 40, halves to 20, then adds 10, net +50. E:18 subtracts 18, updates to 23, then adds 10, net -8. Total=5-15+40+50-8=72. Each key is processed once. **Answer: 72.**

Report a correction for Q12

Question 13 MCQ · 4.0 marks

The following pseudocode is executed using the "Olympics" dataset. **TeamDict** is a dictionary accumulating player names for each country.
Source diagram or notation
Answer the given subquestions.
What does the variable **count** represent at the end of execution?
6406536625280.
Total number of rows processed.
6406536625281.
Total number of unique country-player pairs.
6406536625282.
Total number of unique countries.
6406536625283.
Total number of medals won.

Published solution

For a new country the algorithm creates an empty player list. It increments count only when the current player is not yet in that country's list, then adds that player. Repeated medals or years for the same country-player pair do not increment it again. The same name under a different country would be a distinct pair. Thus count measures unique country-player pairs. **Answer: B.** A: **Incorrect:** Repeated rows for an existing pair do not increment count. B: **Correct:** Counts one first occurrence of each country-player pair. C: **Incorrect:** A country can contribute several different players, so this is not merely a country count. D: **Incorrect:** Repeated medals for one player-country pair are deduplicated.

Report a correction for Q13

Question 14 MCQ · 4.0 marks

The following pseudocode is executed using the "Olympics" dataset. **TeamDict** is a dictionary accumulating player names for each country.
Source diagram or notation
Answer the given subquestions.
If we modify the code to remove this membership check:
Source diagram or notation
and always append the player instead, what would **TeamDict[country]** contain?
6406536625284.
A list of unique players for that country.
6406536625285.
A list of all players for that country, including duplicates for multiple medals/years.
6406536625286.
A single player name (the last one read).
6406536625287.
The count of players for that country.

Published solution

Removing the membership test means every row appends its player name to the country's list. A player appearing in several event or year rows is therefore appended several times. The dictionary still groups by country, but its lists no longer deduplicate players. **Answer: B.** A: **Incorrect:** Uniqueness depended on the removed membership check. B: **Correct:** Every matching row contributes a name, including repeated player names. C: **Incorrect:** Appending extends the list rather than replacing it with a single name. D: **Incorrect:** The stored values remain lists of names, not numeric counts.

Report a correction for Q14