Quiz Space

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

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

Question 7

+4 marksOne correct option

The following pseudocode is executed using the "Library" 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 from Table 1
4 Move X to Table 2
5 Flag = True
6 if(X.Genre != "Fiction"){
7 Flag = False
8 }
9 if(Flag){
10 while(Table 1 has more rows){
11 Read the first row Y from Table 1
12 if(X.Author == Y.Author){
13 Move Y to Table 2
14 if(Y.Genre != "Fiction"){
15 Flag = False
16 }
17 }
18 else{
19 Move Y to Table 3
20 }
21 }
22 Move all rows from Table 3 to Table 1
23 }
24 if(Flag){
25 count = count + 1
26 }
27 }
  1. A

    Number of authors who have written exactly one book under genre "Fiction"

  2. B

    Number of pairs of authors who have not written any book under genre "Fiction"

  3. C

    Number of authors who have written books only under genre "Fiction"

  4. D

    Number of pairs of authors who have written books only under genre "Fiction"

Show answer

Correct answer

  • C

    Number of authors who have written books only under genre "Fiction"

Question 7 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 4 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. Q8The following pseudocode is executed using the "Words" dataset. At the end of the execution, C captures the number of n…
  8. Q9The following pseudocode is executed using the "Words" dataset. What will count. represent at the end of the execution?
  9. Q10The following pseudocode is executed using the "Words" dataset. At the end of the execution, A captures the number of s…
  10. Q11The following pseudocode is executed using the "Library" dataset. At the end of the execution, A captures the number of…
  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…