Monday, 2 September 2019

The Joy of Computing using Python: Assignment 5


1 point
1. Binary search algorithm uses
 
 
 
 
1 point
2. The number of swaps needed to sort the numbers [8, 22, 7, 9, 31, 5, 13] in ascending order, using bubble sort is
 
 
 
 
1 point
3. Suppose a list is [2, 9, 5, 4, 8, 1]. After the first pass of bubble sort (while sorting in ascending order), the list becomes
 
 
 
 
1 point
4. Which of the following is TRUE in the Monty Hall game with 3 doors?
 
 
 
 
1 point
5. Which file format is supported by Python Speech Recognition library?
 
 
 
 
1 point
6. Consider the secure Rock Paper Scissors game
0->Rock
1->Paper
2 ->Scissors
Player 1’s input : 1000010210
Player 2’s input : 1012010211
Who won?
 
 
 
 
1 point
7. In the simple Monte Hall game, we had 3 doors and 1 door contained a prize. The player has to guess
which door could possibly contain the prize. That door would be opened and if it contains the prize he
wins it. If more doors are added, the player has more choices to guess. What do you think will happen
to the probability (i.e. chance) of winning if more doors are added?
 
 
 
Ans: b
1 point
8. In rock, paper, scissors game, how many combinations of choices made by the players are possible?((Rock, Paper) and (Paper, Rock) are considered different combinations.)
 
 
 
 
1 point
9. In Rock, Paper and Scissors game, if one of the players shows Scissors then which of the following is/are TRUE?
1. He is guaranteed to win the game if the other player shows Rock.
2. He is guaranteed to win the game if the other player does not show Rock.
3. He is guaranteed to win the game if the other player shows Paper.
4. He is guaranteed to lose the game if the other player shows Paper.
 
 
 
 
1 point
10. The average number of key comparisons done in a successful sequential search in a list of length 9 is
 
 
 
 

2 comments: