Quiz Space

Computational Thinking · Qualifier · 7 Aug 2022 · May 2022 term

Question 2: The following pseudocode is executed using the "Olympics"…

Question 2

+3 marksOne correct option

The following pseudocode is executed using the "Olympics" dataset. Assume that no player won more than one medal. What will A represent at the end of execution?

text
A = 0
while (Pile 1 has more cards) {
Read the first row X in Table 1
Move X to Pile 2
while (Pile 1 has more cards) {
Read the first row Y in Table 1
Move Y to Pile 3
if (X.Nationality == Y.Nationality and X.Gender ≠ Y.Gender) {
A = A + 1
}
}
Move all cards from Pile 3 to Pile 1
}
  1. A

    Number of pairs of players having different nationality but same gender

  2. B

    Number of pairs of players having either same nationality or same gender

  3. C

    Number of pairs of players having same nationality but different gender

  4. D

    Number of pairs of players having same nationality and same gender

Show answer

Correct answer

  • C

    Number of pairs of players having same nationality but different gender

Question 2 of 14 in the IIT Madras BS Computational Thinking (Computational Thinking (CT)) Qualifier paper sat on 7 Aug 2022, in the May 2022 term (IIT M QUALIFIER EXAM QPE 07 Aug 2022 IBA NS). It carries 3 marks.

More questions from this paper

  1. Q1The following pseudocode is executed using the "Words" dataset. What will A represent at the end of execution?
  2. Q3The following pseudocode is executed using the "Scores" dataset. What will Count represent at the end of execution? It …
  3. Q4The following pseudocode is executed using the "Olympics" dataset. Count represents the number of pairs of distinct pla…
  4. Q5The following pseudocode is executed using the "Words" dataset. Based on the above data, answer the given subquestions.…
  5. Q6The following pseudocode is executed using the "Words" dataset. Based on the above data, answer the given subquestions.…
  6. Q7A palindrome is a sequence of characters which reads the same backward as forward, for example level and noon. The foll…
  7. Q8The following pseudocode is executed using the "Scores" dataset. What will Count represent at the end of execution?
  8. Q9The following pseudocode is executed using the "Scores" dataset. At the end of execution, B captures the minimum Mathem…
  9. Q10The following pseudocode is executed using the "Words" dataset. What will A represent at the end of execution?
  10. Q11The following pseudocode is executed using the "Scores" dataset. What will A represent at the end of execution?
  11. Q12The following pseudocode is executed using the "Scores" dataset. What will (A - B) represent at the end of execution?
  12. Q13A sentence is said to be balanced if there are equal numbers of vowels and consonants in it. The following pseudocode i…
  13. Q14The following pseudocode is executed using the "Olympics" dataset. It counts the number of pairs of players who have th…