Question 6
The following pseudocode is executed using the "Scores" dataset. What will count represent at the end of the execution? [MCQ]
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 111 }12 Procedure findPair(X, Y)13 A = False, B = False14 if(X.Gender == Y.Gender){15 A = True16 }17 if(X.CityTown == Y.CityTown){18 B = True19 }20 if((A and not B) or (not A and B)){21 return(1)22 }23 return(0)24 End findPaircount represents the number of pairs of students having either the same gender or from the same city or both.
count represents the number of pairs of students having the same gender and from the same city.
count represents the number of pairs of students having either the same gender or from the same city but not both.
count represents the number of pairs of students having the same gender but not from the same city.