Quiz Space

Computational Thinking · Qualifier · 16 Mar 2025 · January 2025 term

Question 11: Statement The following pseudocode is executed using the…

Question 11

+5 marksOne or more correct options

Statement

The following pseudocode is executed using the “Scores” dataset. At the end of the execution, count captures the number of pairs of students having either same gender or from the same city but not both. But the pseudocode may have mistakes. Identify all such mistakes (if any). Assume that all statements not listed in the options below are free of errors. [MSQ]

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 = True
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) and (not A and B)){
21 return(1)
22 }
23 return(0)
24 End findPair

Select all that apply.

  1. A

    Line 13: Incorrect initialisation of B

  2. B

    Line 18: Incorrect update of B

  3. C

    Line 20: Incorrect condition

  4. D

    Line 21: It should return(0)

Show answer

Correct answers

  • A

    Line 13: Incorrect initialisation of B

  • C

    Line 20: Incorrect condition

Question 11 of 12 in the IIT Madras BS Computational Thinking (Computational Thinking (CT)) Qualifier paper sat on 16 Mar 2025, in the January 2025 term (IIT M QUALIFIER AN EXAM QDQ1 16 Mar 2025). It carries 5 marks.

More questions from this paper

  1. Q1Statement The following pseudocode is executed using the "Scores" dataset. At the end of the execution of below pseudoc…
  2. Q2The following pseudocode is executed using the "Words" table. At the end of the execution, count stores the number of p…
  3. Q3Statement The following pseudocode is executed using the “Scores” dataset. At the end of the execution, variable Count …
  4. Q4Statement The following pseudocode is executed using the “Words” dataset. What will A represent at the end of the execu…
  5. Q5Statement Procedure miniSum accepts three numbers as parameters and returns the sum of two smallest numbers. Choose the…
  6. Q6Statement The following pseudocode is executed using the “Scores” dataset. What will A represent at the end of the exec…
  7. Q7The given pseudocode is executed using the “Olympics” table. What will count represent at the end of the execution? Ass…
  8. Q8Let X and Y be two rows in the “Scores” table. We call X and Y partially matching if student X and Y are either from th…
  9. Q9Statement The given pseudocode is executed using the “Shopping Bills” dataset. frac stores the ratio of the number of c…
  10. Q10Statement The given information represents a "Words" dataset and it may have some mistakes with respect to the sanity o…
  11. Q12The following pseudocode is executed using a dataset similar to the "Words" dataset, based on the following paragraph. …