Quiz Space

Computational Thinking · Qualifier · 10 Jul 2022 · May 2022 term

Question 11: The following pseudocode is executed using the "Library"…

Question 11

+5 marksOne or more correct options

The following pseudocode is executed using the "Library" dataset. At the end of the execution, A captures the number of pairs of books that are released in the same year and under the same genre but in different languages. 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. It is a Multiple Select Question (MSQ).

text
1 A = 0
2 while(Table 1 has more rows){
3 Read the first row X from Table 1
4 Move X to Table 2
5 while(Table 1 has more rows){
6 Read the first row Y from Table 1
7 B = False, C = False, D = True
8 if(X.Genre == Y.Genre){
9 B = True
10 }
11 if(X.Year == Y.Year){
12 C = False
13 }
14 if(X.Language == Y.Language){
15 D = False
16 }
17 if(B or C or D){
18 A = A + 1
19 }
20 Move Y to Table 3
21 }
22 Move all rows from Table 3 to Table 1
23 }

Select all that apply.

  1. A

    Line 1: A is initialized with wrong value

  2. B

    Line 9: B is updated with wrong value

  3. C

    Line 12: C is updated with wrong value

  4. D

    Line 15: D is updated with wrong value

  5. E

    Line 17: Error in if-condition

  6. F

    No error

Show answer

Correct answers

  • C

    Line 12: C is updated with wrong value

  • E

    Line 17: Error in if-condition

Question 11 of 14 in the IIT Madras BS Computational Thinking (Computational Thinking (CT)) Qualifier paper sat on 10 Jul 2022, in the May 2022 term (IIT M QUALIFIER EXAM QPA1 10 July 2022). It carries 5 marks.

More questions from this paper

  1. Q1The following pseudocode is executed using the "Words" dataset. What will A represent at the end of the execution?
  2. Q2The following pseudocode is executed using the "Words" dataset. At the end of the execution, A is set to True if there …
  3. Q3The following pseudocode is executed using the "Library" dataset. What will count represent at the end of the execution?
  4. Q4Let A be an author who has written a book in the "Library" dataset and B be a positive integer. What does the procedure…
  5. Q5The following pseudocode is executed using the "Words" dataset. What will count represent at the end of the execution?
  6. Q6miniSum accepts three distinct numbers as parameters and returns the sum of two smallest numbers. Choose the correct co…
  7. Q7The following pseudocode is executed using the "Library" dataset. What will count represent at the end of the execution?
  8. Q8The following pseudocode is executed using the "Words" dataset. At the end of the execution, C captures the number of n…
  9. Q9The following pseudocode is executed using the "Words" dataset. What will count. represent at the end of the execution?
  10. Q10The following pseudocode is executed using the "Words" dataset. At the end of the execution, A captures the number of s…
  11. Q12The following pseudocode is executed using the "Scores" dataset. At the end of the execution, C captures the number of …
  12. Q13The following pseudocode is executed using the "Library" dataset. Assume that every author has published at least two b…
  13. Q14The following pseudocode is executed using the "Library" dataset. Assume that every author has published at least two b…