Q8Multiple correct6 Marks22 Dec 2024
The given pseudocode is executed using the "Words" dataset. At the end of execution A captures the frequency count of the most frequent vowel in the dataset. 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).
D = {}, A = 0
while(Table 1 has more rows){
Read the first row X in Table 1
D = updateDictionary(D, X)
Move X to Table 2
}
foreach C in keys(D){
if(C is a vowel and D[C] > A){
A = D[C]
}
}
Procedure updateDictionary(D, Y)
i = 1
while(i <= Y.LetterCount){
P = ith letter of Y.Word
if(not isKey(D, P)){
D[P] = D[P] + 1
}
else{
D[P] = 1
}
i = i + 1
}
return(D)
End updateDictionary
Topic Mapping: chapter: Week 6 │ topic: Dictionary — Key-Value Data Structure │ subtopic: Debugging dictionary operations; key initialization and conditional updates