Question 11
The following pseudocode is executed using the "Library" dataset. At the end of the execution, A captures the number of pairs of books that are released in the same year and under the same genre but in different languages. The pseudocode may have mistakes. Identify all such mistakes (if any). Assume that all statements not listed in the options below are free of errors. It is a Multiple Select Question (MSQ).
1 A = 0 2 while(Table 1 has more rows){ 3 Read the first row X from Table 1 4 Move X to Table 2 5 while(Table 1 has more rows){ 6 Read the first row Y from Table 1 7 B = False, C = False, D = True 8 if(X.Genre == Y.Genre){ 9 B = True10 }11 if(X.Year == Y.Year){12 C = False13 }14 if(X.Language == Y.Language){15 D = False16 }17 if(B or C or D){18 A = A + 119 }20 Move Y to Table 321 }22 Move all rows from Table 3 to Table 123 }Line 1: A is initialized with wrong value
Line 9: B is updated with wrong value
Line 12: C is updated with wrong value
Line 15: D is updated with wrong value
Line 17: Error in if-condition
No error