uiz Space

September 2024 term · Computational Thinking · BSCS1001

Computational Thinking Qualifier: 22 December 2024 (September 2024 term)

The IIT Madras BS Computational Thinking (Computational Thinking (CT)) Qualifier paper sat on 22 Dec 2024, in the September 2024 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
9
MSQ
2
Numerical
1

Updated

Official paper: IIT M DS REATTEMPT AN EXAM QDQ1 22 Dec 2024 · No negative marking.

Question 1

+4 marksOne correct option

The given pseudocode is executed using the "Shopping Bills" dataset. frac stores the ratio of the number of customers who purchased both "Bread" and "Milk" to the number of customers who purchased "Milk". Choose the correct code fragment to complete the pseudocode. (Assume there is at least one customer who has purchased "Milk").

text
1 mCount = 0, bCount = 0
2 while(Pile 1 has more cards){
3 Read the top card X in Pile 1
4 ********************
5 **Code Fragment**
6 *******************
7 Move X to Pile 2.
8 }
9 frac = bCount / mCount
10
11 Procedure hasItem (Y, A)
12 C = False
13 while(Card Y has more items){
14 Read an item Z from ItemList of card Y
15 if(Z.Item == A){
16 C = True
17 }
18 Remove Z from ItemList of Y
19 }
20 return(C)
21 End hasItem
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 2

+4 marksOne correct option

The following pseudocode is executed using the "Scores" dataset. At the end of the execution of below pseudocode, if count2 represents the number of male students whose Physics marks are less than or equal to Mathematics marks, then select the correct code fragment for A and B.

text
1 count1 = 0, count2 = 0
2 while(Table 1 has more rows){
3 Read the first row X in Table 1
4 if(....A.... or ....B....){
5 count1 = count1 + 1
6 }
7 else{
8 count2 = count2 + 1
9 }
10 Move X to Table 2
11 }
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 3

+4 marksOne correct option

The following pseudocode is executed using the "Words" dataset. At the end of the execution, count stores the number of pairs of nouns such that both nouns have either the same letter count or both end with a full stop. Choose the correct code fragment to complete the pseudocode.

text
1 count = 0
2 while(Table 1 has more rows){
3 Read the first row X in Table 1
4 Move X to Table 2
5 if(***Statement 1***){
6 while(Table 1 has more rows){
7 Read the first row Y in Table 1
8 Move Y to Table 3
9 if(***Statement 2***){
10 if(X.LetterCount == Y.LetterCount){
11 count = count + 1
12 }
13 else{
14 if(***Statement 3***){
15 count = count + 1
16 }
17 }
18 }
19 }
20 Move all rows from Table 3 to Table 1
21 }
22 }
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 4

+4 marksOne correct option

The following pseudocode is executed using the "Scores" dataset. Assume that the variable AvgT holds the value of the average total marks. Similarly, the variables AvgP, AvgC and AvgM hold the value of the average marks of Physics, Chemistry and Mathematics respectively. What will Count represent at the end of execution?

text
1 Count = 0
2 while(Table 1 has more rows){
3 Read the first row X from Table 1
4 A = False, B = False, C = False, D = False
5 if(X.Total > AvgT){
6 A = True
7 }
8 if(X.Mathematics < AvgM){
9 B = True
10 }
11 if(X.Physics < AvgP){
12 C = True
13 }
14 if(X.Chemistry < AvgC){
15 D = True
16 }
17 if(A and (B or C or D)){
18 Count = Count + 1
19 }
20 Move X to Table 2
21 }
  1. A

    Count represent the number of students whose total marks are more than the class average (of total marks) but have scored above the subject average in at least one subject

  2. B

    Count represent the number of students whose total marks are more than the class average (of total marks) but have scored below the subject average in at least one subject

  3. C

    Count represent the number of students whose total marks are less than the class average (of total marks) but have scored below the subject average in at least one subject

  4. D

    Count represent the number of students whose total marks are more than the class average (of total marks) but have scored below the subject average in all three subjects

Show answer

Correct answer

  • B

    Count represent the number of students whose total marks are more than the class average (of total marks) but have scored below the subject average in at least one subject

Question 5

+4 marksOne correct option

Procedure miniSum accepts three numbers as parameters and returns the sum of two smallest numbers.
Choose the correct code fragment to complete the procedure.

text
1 Procedure miniSum(A, B, C)
2 Sum = 0
3 ********************
4 * Fill the code *
5 ********************
6 else{
7 if(B > C and B > A){
8 Sum = A + C
9 }
10 else{
11 Sum = A + B
12 }
13 }
14 return(Sum)
15 End miniSum
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 6

+4 marksOne correct option

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

text
1 count = 0
2 while(Table 1 has more rows){
3 Read the first row X in Table 1
4 Move X to Table 2
5 while(Table 1 has more rows){
6 Read the first row Y in Table 1
7 Move Y to Table 3
8 count = count + findPair(X, Y)
9 }
10 Move all rows from Table 3 to Table 1
11 }
12 Procedure findPair(X, Y)
13 A = False, B = False
14 if(X.Gender == Y.Gender){
15 A = True
16 }
17 if(X.CityTown == Y.CityTown){
18 B = True
19 }
20 if((A and not B) or (not A and B)){
21 return(1)
22 }
23 return(0)
24 End findPair
  1. A

    count represents the number of pairs of students having either the same gender or from the same city or both.

  2. B

    count represents the number of pairs of students having the same gender and from the same city.

  3. C

    count represents the number of pairs of students having either the same gender or from the same city but not both.

  4. D

    count represents the number of pairs of students having the same gender but not from the same city.

Show answer

Correct answer

  • C

    count represents the number of pairs of students having either the same gender or from the same city but not both.

Question 7

+4 marksOne correct option

The following pseudocode is executed using the “Scores” dataset. What will A represent at the end of the execution?

text
A = 0
while(Pile 1 has more cards){
Read the top card X from Pile 1
A = A + isInSeq(X)
Move X to Pile 2
}
Procedure isInSeq(X)
if(X.Mathematics > X.Physics){
if(X.Chemistry < X.Mathematics){
return(1)
}
}
return(0)
End isInSeq
  1. A

    Number of students with highest marks in Mathematics among the three subjects

  2. B

    Number of students with highest marks in Mathematics and lowest marks in Physics

  3. C

    Number of students with highest marks in Chemistry among the three subjects

  4. D

    Number of students with lowest marks in Physics among the three subjects

Show answer

Correct answer

  • A

    Number of students with highest marks in Mathematics among the three subjects

Question 8

+4 marksOne correct option

The following pseudocode is executed using the “Olympics” dataset. Procedure doSomething accepts a table of rows that contains rows of 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 the year gap between first and second medals won by a player then, choose the correct code fragment to complete the pseudocode.

text
Procedure doSomething(Table T1)
A = 2030, B = 2030
while(Table T1 has more rows){
Read the first row Z from Table T1
****************************
***Fill the code****
****************************
Move the row Z to Table T2
}
return((B - A))
End doSomething
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 9

+4 marksOne correct option

The given pseudocode is executed using the “Olympics” table. At the end of execution, count represent the number of pairs of players having the same nationality and same medal. Choose the correct code fragment to complete the pseudocode. Assume all players have distinct names.

text
count = 0
while(Table 1 has more rows){
Read the first row X in Table 1
Move X to Table 2
while(Table 1 has more rows){
Read the first row Y in Table 1
Move Y to Table 3
*******************
***Fill the code***
*******************
}
Move all rows from Table 3 to Table 1
}
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 10

+5 marksOne or more correct options

The following pseudocode is executed using the "Scores" dataset. At the end of the execution of the below pseudocode, if count2 represents the number of male students whose Physics marks are less than or equal to Mathematics marks, then choose the correct code fragment(s) to complete the pseudocode. [MSQ]

text
count1 = 0, count2 = 0
while(Table 1 has more rows){
Read the first row X in Table 1
***********************
***Fill the code***
**********************
Move X to Table 2
}

Select all that apply.

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

Correct answers

  • A
  • D

Question 11

+4 marksOne or more correct options

The given information represents a "Library" dataset and it may have some mistakes with respect to the sanity of the data. Identify all rows with such mistakes. [MSQ].

Row no.FieldValue
Row 1SeqNo"C1"
Row 2Name"was"
Row 3Pages"-20"
Row 4Year"twentyfour"

Select all that apply.

  1. A

    Row 1: Incorrect data type of SeqNo

  2. B

    Row 2: Incorrect data type of Name

  3. C

    Row 3: Incorrect data type of Pages

  4. D

    Row 3: Invalid value of Pages

  5. E

    Row 4: Incorrect data type of Year

Show answer

Correct answers

  • A

    Row 1: Incorrect data type of SeqNo

  • C

    Row 3: Incorrect data type of Pages

  • D

    Row 3: Invalid value of Pages

  • E

    Row 4: Incorrect data type of Year

Question 12

+5 marksNumerical answer

The following pseudocode is executed using a dataset similar to the "Words" dataset, based on the following paragraph.

"Moments later, Susan takes a leisurely stroll, immersing herself in the peaceful surroundings. Mornings, with their calm and solitude, motivate Susan to embrace the day with a positive outlook. The motion in the trees catches her attention, signifying the awakening of nature."

text
count = 0, flag = True
while(Table 1 has more rows){
Read the first row X in Table 1
Move X to Table 2
if(flag){
if(1st letter of X.Word == 'm'){
if(2nd letter of X.Word == 'o'){
count = count + 1
}
}
}
flag = False
if(X.Word ends with full stop){
flag = True
}
}

What would be the value of the count at the end of the execution of the above pseudocode? Assume that upper case and lower case are ignored during comparison of letters.

Show answer

Correct answer: 2