Q3Single correct5 Marks22 Dec 2024
The following pseudocode is executed using the "Scores" dataset. At the end of execution cityD[k] represent the dictionary with gender as key mapped to the lowest Physics marks scored by that gender in city k. Choose the correct code fragment to complete the pseudocode.
cityD = {}
while(Table 1 has more rows){
Read the first row X in Table 1
if(isKey(cityD, X.Town/City)){
if(*** Statement 1 ***){
if(cityD[X.Town/City][X.Gender] > X.Physics){
cityD[X.Town/City][X.Gender] = X.Physics
}
}
else{
cityD[X.Town/City][X.Gender] = X.Physics
}
}
else{
*** Statement 2 ***
*** Statement 3 ***
}
Move X to Table 2
}
Topic Mapping: chapter: Week 6 │ topic: Dictionary — Applications │ subtopic: Nested dictionaries for grouped tracking and minimum-finding with initialization checks