uiz Space

September 2025 term · Computational Thinking · BSCS1001

Computational Thinking Quiz 2: 23 November 2025 (September 2025 term)

The IIT Madras BS Computational Thinking (Computational Thinking (CT)) Quiz 2 paper sat on 23 Nov 2025, in the September 2025 term: 12 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
12
Marks
50
Duration
120 min
MCQ
7
MSQ
4
Numerical
1

Updated

Official paper: IIT M DIPLOMA AN EXAM QDD2 23 Nov 2025 NEW · No negative marking.

Question 1

+4 marksOne correct option

Consider the procedure given below.

text
1 Procedure eliminate(L1, L2)
2 L3 = [], Found = False
3 foreach i in L1{
4 foreach j in L2{
5 if(i == j){
6 Found == True
7 }
8 }
9 if(not Found){
10 L3 = L3 ++ [i]
11 }
12 Found = False
13 }
14 return(L3)
15 End eliminate

If L1 and L2 are two lists, and L = eliminate(L1, L2), choose the correct option.

  1. A

    L contains all the elements of L2 that are not present in L1

  2. B

    L contains all the elements of L1 that are not present in L2

  3. C

    L contains all the elements common to L1 and L2

  4. D

    L contains the unique elements present in L1 or L2

Show answer

Correct answer

  • B

    L contains all the elements of L1 that are not present in L2

Question 2

+4 marksOne correct option

Consider the following pseudocode:

text
1 aList = [2, 6, 7, 2, 8, 7, 6, 2, 3]
2 bDict = {}
3 bList = []
4 foreach a in aList{
5 if(not isKey(bDict, a)){
6 bDict[a] = True
7 bList = [a] ++ bList
8 }
9 }

At the end of execution of the pseudocode, which of the following is correct?

  1. A

    bList = [2, 6, 7, 8, 3]

  2. B

    bList = [3, 8, 7, 6, 2]

  3. C

    bList = [28]

  4. D

    bList = [2, 6, 7, 2, 8, 7, 6, 2, 3]

Show answer

Correct answer

  • B

    bList = [3, 8, 7, 6, 2]

Question 3

+4 marksOne or more correct options

The following pseudocode is executed using "Scores" dataset. Let M, P, and C be the lists of the sequence numbers of the students who have scored more than 75 marks in Mathematics, Physics, and Chemistry respectively. At the end of the execution, dict stores a dictionary with the sequence number of student mapped to the number of subjects in which the student has scored more than 75 marks. Choose the correct implementation(s) of nSub.

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • A
  • C

Question 4

+4 marksOne or more correct options

The following pseudocode is executed using the "Words" dataset. Let X.Word and Y.Word be "engineering" and "analysis" respectively.

text
1 firstDict = {}, secondDict = {}, commonDict = {}
2 firstDict = updateDict(X, commonDict)
3 secondDict = updateDict(Y, commonDict)
4 foreach key in keys(firstDict){
5 if(isKey(secondDict, key)){
6 if(firstDict[key] > secondDict[key]){
7 commonDict[key] = firstDict[key]
8 }
9 else{
10 commonDict[key] = secondDict[key]
11 }
12 }
13 }
14
15 Procedure updateDict(Z, Dict)
16 i = 1, x = ''
17 while(i <= Z.LetterCount){
18 x = ith letter of Z.Word
19 if(not isKey(Dict, x)){
20 Dict[x] = 1
21 }
22 else{
23 Dict[x] = Dict[x] + 1
24 }
25 i = i + 1
26 }
27 return(Dict)
28 End updateDict

At the end of the execution of the pseudocode shown below, which of the following statements is/are correct?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • A
  • C

Question 5

+4 marksOne correct option

The following pseudocode is executed using the "Scores" dataset. What will the value of B represent at the end of execution?

text
1 D = {}, B = 0
2 while(Table 1 has more rows){
3 Read the first row X in Table 1
4 D = updateDictByField(D, X.Physics)
5 Move X to Table 2
6 }
7 B = findAKey(D)
8
9 Procedure updateDictByField(D, Value)
10 if(isKey(D, Value)){
11 D[Value] = D[Value] + 1
12 }
13 else{
14 D[Value] = 1
15 }
16 return(D)
17 End updateDictByField
18
19 Procedure findAKey(D)
20 Key = -1, Value = 0
21 foreach A in keys(D){
22 if(D[A] > Value){
23 Value = D[A]
24 Key = A
25 }
26 }
27 return(Key)
28 End findAKey
  1. A

    Number of repeated marks in Physics

  2. B

    Minimum marks in Physics

  3. C

    Maximum marks in Physics

  4. D

    Most frequent marks in Physics

Show answer

Correct answer

  • D

    Most frequent marks in Physics

Question 6

+5 marksOne correct option

The following pseudocode is executed using the "Shopping bills" dataset. What will D represent at the end of the execution?

text
1 D = {}
2 while(Pile 1 has more cards){
3 Read the top card X in Pile 1
4 D = updateDictionary(D, X)
5 Move X to Pile 2
6 }
7
8 Procedure updateDictionary(D, Y)
9 foreach A in Y.ItemList{
10 C = A.ItemName
11 if(isKey(D, C)){
12 if(isKey(D[C], Y.ShopName)){
13 if(D[C][Y.ShopName]["Price"] != A.Price){
14 D[C][Y.ShopName]["Flag"] = True
15 }
16 }
17 else{
18 D[C][Y.ShopName] = {"Price": A.Price, "Flag" : False}
19 }
20 }
21 else{
22 D[C] = {}
23 D[C][Y.ShopName] = {"Price": A.Price, "Flag" : False}
24 }
25 }
26 return (D)
27 End updateDictionary
  1. A

    For an item C, and a shop S, D[C] [S] ["Flag"] is set to True if and only if the item is sold for a constant price, by the shop.

  2. B

    For an item C, and a shop S, D[C] [S] ["Flag"] is set to True if and only if the item is billed in more than one bill, by the shop.

  3. C

    For an item C, and a shop S, D[C] [S] ["Flag"] is set to True if and only if the item is sold for variable price, by the shop.

  4. D

    For an item C, and a shop S, D[C] [S] ["Flag"] is set to True if and only if the item is billed exactly one bill, by the shop.

Show answer

Correct answer

  • C

    For an item C, and a shop S, D[C] [S] ["Flag"] is set to True if and only if the item is sold for variable price, by the shop.

Question 7

+4 marksOne correct option

What is the value of L at the end of the execution of the following pseudocode?

text
1 Procedure getTwo(A, B)
2 result = []
3
4 max1A = -1
5 max2A = -1
6 foreach x in A{
7 if(x > max1A){
8 max2A = max1A
9 max1A = x
10 }
11 else if(x > max2A){
12 max2A = x
13 }
14 }
15
16 max1B = -1
17 max2B = -1
18 foreach y in B{
19 if(y > max1B){
20 max2B = max1B
21 max1B = y
22 }
23 else if(y > max2B){
24 max2B = y
25 }
26 }
27
28 result = [max2A, max1A, max1B]
29 return(result)
30 End getTwo
31
32 L1 = [3, 4, 7, 8, 1]
33 L2 = [2, 6, 8, 9, 1]
34 L = getTwo(L1, L2)
35
  1. A

    [7, 8, 9]

  2. B

    [8, 7, 9]

  3. C

    [8, 9, 7]

  4. D

    [9, 8, 7]

Show answer

Correct answer

  • A

    [7, 8, 9]

Question 8

+4 marksOne or more correct options

The following pseudocode is executed on the "Scores" dataset. Which of the following statements is/are true at the end of the execution?

text
1 A = []
2 B = []
3 while (Table 1 has more rows){
4 Read the top row X from Table 1
5 if(X.Total > 200){
6 A = A ++ [X.SeqNo]
7 if(X.CityTown == "Chennai"){
8 B = B ++ [X.SeqNo]
9 }
10 }
11 }

Select all that apply.

  1. A

    A represents the sequence numbers of students with a total score greater than 200.

  2. B

    Length(B) >= Length(A) will always be true.

  3. C

    B represents the sequence numbers of all students from Chennai in the dataset.

  4. D

    Length(A) >= Length(B) will always be true.

Show answer

Correct answers

  • A

    A represents the sequence numbers of students with a total score greater than 200.

  • D

    Length(A) >= Length(B) will always be true.

Question 9

+5 marksOne or more correct options

The following pseudocode is executed using the "Shopping Bills" dataset. At the end of the execution, the variable D captures the following information: for each customer Z, D[Z] ["Shop"] stores the shops visited by Z, and D[Z] ["Category"] stores the categories of the items purchased by Z. But the pseudocode may have mistakes. Identify all such mistakes (if any). It is a Multiple Select Question (MSQ).

text
1 D = {}
2 while(Pile 1 has more cards){
3 Read the top card X in Pile 1
4 D = updateDictionary(D, X)
5 Move X to Pile 2
6 }
7
8 Procedure updateDictionary(D, Y)
9 if(not isKey(D, Y.CustomerName)){
10 D[Y.CustomerName] = {"Shop": [], "Category": []}
11 }
12 D[Y.CustomerName]["Shop"][Y.ShopName] = True
13 foreach A in Y.ItemList{
14 D[Y.CustomerName]["Shop"][A.Category] = True
15 }
16 return(D)
17 End updateDictionary

Select all that apply.

  1. A

    Error in Line 1

  2. B

    Error in Line 10

  3. C

    Error in Line 13

  4. D

    Error in Line 14

Show answer

Correct answers

  • B

    Error in Line 10

  • D

    Error in Line 14

Question 10

+4 marksNumerical answer

What will the value of length(B) be at the end of the execution of the following pseudocode?

text
1 Procedure processList(numList)
2 tempDict = {}
3 result = []
4 foreach x in numList{
5 if(x % 2 == 0){
6 if(not isKey(tempDict, x)){
7 tempDict[x] = True
8 result = result ++ [x]
9 }
10 }
11 }
12 return(result)
13 End processList
14
15 A = [4, 3, 2, 4, 3, 5, 6, 7, 8, 6, 2]
16 B = processList(A)
Show answer

Correct answer: 4

Question 11

+4 marksOne correct option

The following pseudocode is executed using the "Words" dataset.

[unreadable]

text
1 count = 0, flag = True
2 while(Table 1 has more rows){
3 Read the first row X in Table 1
4 *******************
5 ** Fill the code **
6 *******************
7 Move X to Table 2
8 }

Answer the given subquestions.

What will count represent at the end of the execution if the missing code is filled by below code?

  1. A

    Total number of verbs in the dataset

  2. B

    Number of sentences that end with a non-verb

  3. C

    Number of sentences with at least one verb

  4. D

    Number of sentences that end with a verb

Show answer

Correct answer

  • B

    Number of sentences that end with a non-verb

Question 12

+4 marksOne correct option

The following pseudocode is executed using the "Words" dataset.

[unreadable]

text
1 count = 0, flag = True
2 while(Table 1 has more rows){
3 Read the first row X in Table 1
4 *******************
5 ** Fill the code **
6 *******************
7 Move X to Table 2
8 }

Answer the given subquestions.

What will count represent at the end of the execution if the missing code is filled by below code?

  1. A

    Total number of verbs in the dataset

  2. B

    Number of sentences that start with a verb

  3. C

    Number of sentences that do not start with a verb

  4. D

    Number of sentences that end with a verb

Show answer

Correct answer

  • C

    Number of sentences that do not start with a verb