NPTEL The Joy of Computing using Python Week 5 Assignment Answers 2025
1. Which of the following is the correct way to add data with key as CS102 and value as “Database Management Systems” to a dictionary named courses?
- courses[“CS101”] = (“Database Management Systems”)
- courses[“CS102”][“Database Management Systems”]
- courses[“CS102”] = “Database Management Systems”
- courses[“CS101”] = “Database Management Systems”
Answer :- For Answers Click Here
2. What is the probability of Monty not opening the door with goat, given the hypothesis that you initially chose the door which has car ?
- 0
- 0.5
- 1
- 0.33
Answer :-
3. What should be replaced with ? in line 10, so that there is high chance that final_choice is equal to 2 ?

- 2
- 2∗∗(1024) % 2 != 0
- 2∗(2∗∗(89)+7) % 2 == 0
- (2∗∗(90)) % len(doors) != 1
Answer :-
4. Given that you have a sorted list of 2048 elemets,what is the maximum number of comparisons to search such an element using linear search ? Can binary search do it in less number of comparisons ?
- Yes, binary search can do it more efficiently, linear search takes 1024 comparisons
- Yes, binary search can do it more efficiently, linear search takes 2048 comparisons
- No, binary search may/may not do it more efficiently, linear search takes 1024 comparisons
- No, binary search will take more comparisons, linear search takes 2048 comparisons
Answer :-
5. What is the primary use of a file with a .wav or .wave extension?
- Storing video recordings
- Storing log files
- Storing waves of files
- Storing audio recordings
Answer :-
6. What does this program print in the end ?

- Fraction of throws where both players showed different symbol(rock/paper/scissors)
- Fraction of throws where both players showed rock.
- Fraction of throws where both players showed same symbol(rock/paper/scissors)
- Fraction of throws where both players showed paper.
Answer :- For Answers Click Here
7. In binary search the list gets divided in every iteration to find the element.
- True
- False
Answer :-
8. Which of the following are requirements for binary search to work correctly?
- The list can be unsorted.
- The list must contain only positive integers.
- The list must be sorted.
- The list must have no duplicate values.
Answer :-
9. Given an array [4, 2, 7, 1, 3], what will be the array after the third pass of Bubble Sort?
- [1,3,2,4,7]
- [2,4,1,3,7]
- [1,2,3,4,7]
- [2,1,3,4,7]
Answer :-
10. How many swaps are performed in iteration 3 for bubble sorting list [5,4,3,2,1]? Enter 0 if the list is sorted in less than 3 iterations.
Answer :- For Answers Click Here