Prasnya
Prasnya
Continue with Google
Week 5 Computational Thinking Questions | Prasnya
Prasnya
Prasnya
Continue with Google
Computational Thinking > Week 5
All PYQs
Topic Wise PYQs
Start Weekly Test
Type:
All
Difficulty:
All
Year:
All
1Q
01
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(s) of procedure `hasItem` to complete the pseudocode. Assume there is at least one customer who has purchased "Milk". ``` mcount = 0, bcount = 0 while(Pile 1 has more cards){ Read the top card X in Pile 1 if(hasItem(X, "Milk")){ mcount = mcount + 1 if(hasItem(X, "Bread")){ bcount = bcount + 1 } } Move X to Pile 2. } frac = bcount / mcount Procedure hasItem(Y, A) **************** * Fill the code * **************** End hasItem ```
Multiple correct
HARD
4 marks
25 February 2024
Showing 1 question.
Computational Thinking > Week 5
All PYQs
Topic Wise PYQs
Start Weekly Test
Type:
All
Difficulty:
All
Year:
All
1Q
01
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(s) of procedure `hasItem` to complete the pseudocode. Assume there is at least one customer who has purchased "Milk". ``` mcount = 0, bcount = 0 while(Pile 1 has more cards){ Read the top card X in Pile 1 if(hasItem(X, "Milk")){ mcount = mcount + 1 if(hasItem(X, "Bread")){ bcount = bcount + 1 } } Move X to Pile 2. } frac = bcount / mcount Procedure hasItem(Y, A) **************** * Fill the code * **************** End hasItem ```
Multiple correct
HARD
4 marks
25 February 2024
Showing 1 question.