Computational Thinking, Qualifier
The given pseudocode is executed using the "Shopping Bills" dataset. frac stores the ratio of the number of customers who purchased both "Bread" and "Milk" to the number of customers who purchased "Milk". Choose the correct code fragment to complete the pseudocode. (Assume there is at least one customer who has purchased "Milk").
1 mCount = 0, bCount = 02 while(Pile 1 has more cards){3 Read the top card X in Pile 14 ********************5 **Code Fragment**6 *******************7 Move X to Pile 2.8 }9 frac = bCount / mCount1011 Procedure hasItem (Y, A)12 C = False13 while(Card Y has more items){14 Read an item Z from ItemList of card Y15 if(Z.Item == A){16 C = True17 }18 Remove Z from ItemList of Y19 }20 return(C)21 End hasItemThe given pseudocode is executed using the "Shopping Bills" dataset. **frac** stores the ratio of the number of customers who purchased both "Bread" and "Milk" to the number of customers who purchased "Milk". Choose the correct code fragment to complete the pseudocode. (Assume there is at least one customer who has purchased "Milk"). 1 mCount = 0, bCount = 0 2 while(Pile 1 has more cards){ 3 Read the top card X in Pile 1 4 ******************** 5 **Code Fragment** 6 ******************* 7 Move X to Pile 2. 8 } 9 frac = bCount / mCount 10 11 Procedure hasItem (Y, A) 12 C = False 13 while(Card Y has more items){ 14 Read an item Z from ItemList of card Y 15 if(Z.Item == A){ 16 C = True 17 } 18 Remove Z from ItemList of Y 19 } 20 return(C) 21 End hasItem The following pseudocode is executed using the "Scores" dataset. At the end of the execution of below pseudocode, if **count2** represents the number of male students whose Physics marks are less than or equal to Mathematics marks, then select the correct code fragment for **A** and **B**. 1 count1 = 0, count2 = 0 2 while(Table 1 has more rows){ 3 Read the first row X in Table 1 4 if(....A.... or ....B....){ 5 count1 = count1 + 1 6 } 7 else{ 8 count2 = count2 + 1 9 } 10 Move X to Table 2 11 } The following pseudocode is executed using the "Words" dataset. At the end of the execution, **count** stores the number of pairs of nouns such that both nouns have either the same letter count or both end with a full stop. Choose the correct code fragment to complete the pseudocode. 1 count = 0 2 while(Table 1 has more rows){ 3 Read the first row X in Table 1 4 Move X to Table 2 5 if(***Statement 1***){ 6 while(Table 1 has more rows){ 7 Read the first row Y in Table 1 8 Move Y to Table 3 9 if(***Statement 2***){ 10 if(X.LetterCount == Y.LetterCount){ 11 count = count + 1 12 } 13 else{ 14 if(***Statement 3***){ 15 count = count + 1 16 } 17 } 18 } 19 } 20 Move all rows from Table 3 to Table 1 21 } 22 }