Q47.The following pseudocode is executed using the "Olympics" dataset. Procedure `doSomething` accepts a Table of rows which contains rows of the same player. Assume that every player has won at least two medals and only one medal in any year. What will `(B - A)` represent at the end of the execution?
```
Procedure doSomething(Table T1)
A = 0, B = 0
while(Table T1 has more rows){
Read the first row Z from Table T1
if(Z.Year > A){
B = A
A = Z.Year
}
if(Z.Year < A and Z.Year > B){
B = Z.Year
}
Move the row Z to Table T2
}
return(A - B)
End doSomething
```@passage
Save
Read
Check
Details
Q47
16 Oct 2022
Q47.The following pseudocode is executed using the "Olympics" dataset. Procedure `doSomething` accepts a Table of rows which contains rows of the same player. Assume that every player has won at least two medals and only one medal in any year. What will `(B - A)` represent at the end of the execution?
```
Procedure doSomething(Table T1)
A = 0, B = 0
while(Table T1 has more rows){
Read the first row Z from Table T1
if(Z.Year > A){
B = A
A = Z.Year
}
if(Z.Year < A and Z.Year > B){
B = Z.Year
}
Move the row Z to Table T2
}
return(A - B)
End doSomething
```@passage