Q14.The following pseudocode is executed using the "Scores" dataset. What will `count` represent at the end of the execution?
```
count = 0
while(Table 1 has more rows){
Read the first row X in Table 1
Move X to Table 2
while(Table 1 has more rows){
Read the first row Y in Table 1
Move Y to Table 3
count = count + findPair(X, Y)
}
Move all rows from Table 3 to Table 1
}
Procedure findPair(X, Y)
A = False, B = False
if(X.Gender == Y.Gender){
A = True
}
if(X.CityTown == Y.CityTown){
B = True
}
if((A and B) or (not A and not B)){
return(1)
}
return(0)
End findPair
```
Save
Check
Details
Q14
7 Jul 2024
Q14.The following pseudocode is executed using the "Scores" dataset. What will `count` represent at the end of the execution?
```
count = 0
while(Table 1 has more rows){
Read the first row X in Table 1
Move X to Table 2
while(Table 1 has more rows){
Read the first row Y in Table 1
Move Y to Table 3
count = count + findPair(X, Y)
}
Move all rows from Table 3 to Table 1
}
Procedure findPair(X, Y)
A = False, B = False
if(X.Gender == Y.Gender){
A = True
}
if(X.CityTown == Y.CityTown){
B = True
}
if((A and B) or (not A and not B)){
return(1)
}
return(0)
End findPair
```