Q31.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 the 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 = 2030, B = 2030
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((B - A))
End doSomething
```
Save
Check
Details
Q31
25 Feb 2024
Q31.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 the 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 = 2030, B = 2030
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((B - A))
End doSomething
```