Q41.Let `A` be an author who has written a book in the "Library" dataset and `B` be a positive integer. What does the procedure `DoSomething` compute?
```
Procedure DoSomething(A, B)
C = 0, D = 2023
while(Table 1 has more rows){
Read the first row X in Table 1
if(X.Author == A){
if(X.Year > C){
C = X.Year
}
if(X.Year < D){
D = X.Year
}
}
Move X to Table 2
}
if(C - D >= B){
return(True)
}
else{
return(False)
}
End DoSomething
```
Save
Check
Details
Q41
10 Jul 2022
Q41.Let `A` be an author who has written a book in the "Library" dataset and `B` be a positive integer. What does the procedure `DoSomething` compute?
```
Procedure DoSomething(A, B)
C = 0, D = 2023
while(Table 1 has more rows){
Read the first row X in Table 1
if(X.Author == A){
if(X.Year > C){
C = X.Year
}
if(X.Year < D){
D = X.Year
}
}
Move X to Table 2
}
if(C - D >= B){
return(True)
}
else{
return(False)
}
End DoSomething
```