Q38Comprehension4 Marks29 Oct 2023
Passage
Based on the above question, answer the given subquestions. The following pseudocode is executed using the "Library" dataset. Assume that an author publishes at least two books, and only one in a year.
```
Count = 0, max = 0
while(Table 1 has more rows) {
Read the first row X from Table 1
Move the row X to Table 2
while(Table 1 has more rows) {
Read the first row Y from Table 1
if(X.Author == Y.Author) {
Move the row Y to Table 2
}
else {
Move the row Y to Table 3
}
}
Diff = doSomething(Table 2)
if(Diff == max) {
Count = Count + 1
}
if(Diff > max) {
max = Diff
Count = 1
}
Delete all the rows from Table 2
Move all the rows from Table 3 to Table 1
}
Procedure doSomething(Table 2)
A = 2050, B = 2050
while(Table 2 has more rows) {
Read the first row Z from Table 2
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 4
}
return(B - A)
End doSomething
```
What will procedure `doSomething` return?