Q36Multiple correct5 Marks7 Aug 2022
The following pseudocode is executed using the "Shopping Bills" dataset. At the end of the execution, L stores the list of distinct shops from which only one category of items have been bought. But 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).
```
A = {}
L = []
while(Pile 1 has more cards){
Read the top card X from pile 1
if(not isKey(A, X.ShopName)){
A = updateDict(A, X)
}
else{
A[X.ShopName] = []
A = updateDict(A, X)
}
Move X to pile 2
}
foreach k in keys(A){
if(length(A[k]) == 1){
L = L ++ [k]
}
}
19
procedure updateDict(D, Y){
foreach Z in Y.ItemList{
if(not member(D[Y.ShopName], Z.Category)){
D[Y.ShopName] = D[Y.ShopName] ++ [Z.Category]
}
}
return(D)
}
End updateDict
```