Quiz Space

Computational Thinking · Quiz 2 · 13 Mar 2022 · January 2022 term · Set QPE2

Question 8: The following table contains information regarding author…

Question 8

+4 marksOne correct option

The following table contains information regarding authors from the “Library” dataset. Each row in the table corresponds to an author and list of publication years. There are n authors, each author is being assigned a unique index between 0 and n−1.

The table is represented by a dictionary named authors, with S.No as keys and lists of publication years as values. Assume that authors has already been computed. For example, we have: authors [0] = [1998,..., 2015]
isCommon(L1, L2) returns True if there are at least two common elements in lists L1 and L2.

text
M = createMatrix (n, n)
foreach i in keys (authors) {
foreach j in keys (authors) {
if (i > j and isCommon(authors[i], authors[j])) {
M[i][j] = 1
M[j][i] = 1
}
}
}
A = { }
foreach i in rows (M) {
count = 0
foreach j in columns (M) {
if (M[i][j] ≠ 0) {
count = count + 1
}
}
A[i]= count
}

What does an entry A[i] represent at the end of the execution of the pseudocode above?

  1. A

    Author A[i] has published books in i years

  2. B

    Author i has published books in A[i] years

  3. C

    Author A[i] has published at least two books in common years with i authors

  4. D

    Author i has published at least two books in common years with A[i] authors

Show answer

Correct answer

  • D

    Author i has published at least two books in common years with A[i] authors

Question 8 of 19 in the IIT Madras BS Computational Thinking (Computational Thinking (CT)) Quiz 2 paper sat on 13 Mar 2022, in the January 2022 term (IIT M FOUNDATION QUIZ2 EXAM QPE2 13 Mar 2022). It carries 4 marks.

More questions from this paper

  1. Q1Let L be a non-empty list, and D be a non-empty dictionary. Choose whether the given statements are true or false: Elem…
  2. Q2Let L be a non-empty list, and D be a non-empty dictionary. Choose whether the given statements are true or false: Let …
  3. Q3Let L be a non-empty list, and D be a non-empty dictionary. Choose whether the given statements are true or false: For …
  4. Q4Let L be a non-empty list, and D be a non-empty dictionary. Choose whether the given statements are true or false: For …
  5. Q5Let L be a non-empty list, and D be a non-empty dictionary. Choose whether the given statements are true or false: For …
  6. Q6Let L be a non-empty list, and D be a non-empty dictionary. Choose whether the given statements are true or false: Let …
  7. Q7Consider the procedure doSomething given below. If A = [4, 5, 3, 1, 9, 4, 6, 5, 9] and B = doSomething(A). Choose the c…
  8. Q9In a shop selling soft drinks, Ritvika wants to combine two soft drinks to see which combinations taste better. The dri…
  9. Q10Consider the procedure given below. If L1 and L2 are two lists, and L = eliminate (L1, L2), then answer the given subqu…
  10. Q11Consider the procedure given below. If L1 and L2 are two lists, and L = eliminate (L1, L2), then answer the given subqu…
  11. Q12What will countSomething(M, 0, 5) return?\ NOTE: Enter your answer to the nearest integer.
  12. Q13If Line 2 is replaced by count = M[i][j], then what will countSomething(M, 0, 5) return? NOTE: Enter your answer to the…
  13. Q14The following pseudocode is executed using the “Words” dataset. Assume that words are arranged in increasing order of s…
  14. Q15The following pseudocode is executed using the “Words” dataset. Assume that words are arranged in increasing order of s…
  15. Q16The following pseudocode is executed using the “Shopping Bills” dataset. Based on the above data, answer the given subq…
  16. Q17The following pseudocode is executed using the “Shopping Bills” dataset. Based on the above data, answer the given subq…
  17. Q18The following pseudocode is executed using the “Shopping Bills” dataset. Procedure similar(X, Y) returns True if the di…
  18. Q19The following pseudocode is executed using the “Shopping Bills” dataset. Procedure similar(X, Y) returns True if the di…