uiz Space

January 2024 term · Computational Thinking · BSCS1001

Computational Thinking Qualifier: 24 March 2024 (January 2024 term)

The IIT Madras BS Computational Thinking (Computational Thinking (CT)) Qualifier paper sat on 24 Mar 2024, in the January 2024 term: 14 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
14
Marks
50
Duration
120 min
MCQ
11
MSQ
2
Numerical
1

Updated

Official paper: IIT M QUALIFIER AN EXAM QDQ1 24 Mar 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 "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 3

+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 4

+4 marksOne correct option

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

text
1 SumT = 0, CountT = 0, B = 0
2 while(Table 1 has more rows){
3 Read the first row X in Table 1
4 if(X.PartOfSpeech == "Noun"){
5 CountT = CountT + 1
6 SumT = SumT + X.LetterCount
7 }
8 Move X to Table 2
9 }
10 B = SumT / CountT
11
12 SumS = 0, CountS = 0, A = 0, C = 0
13 while(Table 2 has more rows){
14 Read the first row X in Table 2
15 CountS = CountS + 1
16 SumS = SumS + X.LetterCount
17 if(X.Word ends with a full stop){
18 C = SumS / CountS
19 if(C < B){
20 A = A + 1
21 }
22 SumS = 0, CountS = 0
23 }
24 Move X to Table 1
25 }
  1. A

    Number of sentences with an average letter count more than the average letter count of all the nouns in the dataset.

  2. B

    Number of sentences with an average letter count less than the average letter count of all the nouns in the dataset.

  3. C

    Number of nouns with an average letter count more than the average letter count of all the words in the dataset.

  4. D

    Number of words with an average letter count less than the average letter count of all the nouns in the dataset.

Show answer

Correct answer

  • B

    Number of sentences with an average letter count less than the average letter count of all the nouns in the dataset.

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 “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 year the gap between first and second medals won by a player then, choose the correct code fragment to complete the pseudocode.

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

Correct answer

  • A

Question 8

+3 marksOne correct option

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

text
1 A = 0
2 count = 0
3 while(Table 1 has more rows){
4 Read the first row X in Table 1
5 count = count + 1
6 if(X.Author == "Kalam" and X.Language == "English"){
7 A = A + 1
8 }
9 Move X to Table 2
10 }
11 B = count - A
  1. A

    Number of books written by author Kalam in English

  2. B

    Number of books not written by author Kalam in English

  3. C

    Number of English books written by authors other than Kalam

  4. D

    Number of books that are not written by author Kalam or not in English or both

Show answer

Correct answer

  • D

    Number of books that are not written by author Kalam or not in English or both

Question 9

+3 marksOne correct option

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

text
1 A = 0
2 while(Pile 1 has more cards){
3 Read the top card X from Pile 1
4 A = A + isInSeq(X)
5 Move X to Pile 2
6 }
7
8 Procedure isInSeq(X)
9 if(X.Mathematics > X.Physics){
10 if(X.Chemistry < X.Mathematics){
11 return(1)
12 }
13 }
14 return(0)
15 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 10

+3 marksOne correct option

The following pseudocode is executed using the “Words” dataset.

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 i = 1, A = False, B = False
6 while(i ≤ X.LetterCount){
7 if(ith letter of X.Word is a vowel){
8 if(A){
9 B = True
10 }
11 A = True
12 }
13 i = i + 1
14 }
15 if(B){
16 count = count + 1
17 }
18 }

What will count represent at the end of execution?

  1. A

    Number of words with at least two vowels

  2. B

    Number of words with at most two vowels

  3. C

    Number of words with at least two vowels occurring consecutively

  4. D

    Number of words with at least one vowel

Show answer

Correct answer

  • A

    Number of words with at least two vowels

Question 11

+3 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
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 ********************
9 ***Fill the code***
10 ********************
11 }
12 Move all rows from Table 3 to Table 1
13 }
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 12

+3 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.

Select all that apply.

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

Correct answers

  • A
  • D

Question 13

+3 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.

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 14

+4 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
1 count = 0, flag = True
2 while(Table 1 has more rows){
3 Read the first row X in Table 1
4 Move X to Table 2
5 if(flag){
6 if(1st letter of X.Word == 'm'){
7 if(2nd letter of X.Word == 'o'){
8 count = count + 1
9 }
10 }
11 }
12 flag = False
13 if(X.Word ends with full stop){
14 flag = True
15 }
16 }

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