Hey Folks, This article focuses on the NPTEL Joy Of Computing Using Python Week 5 Assignment Answers. If you didn't Complete the Week 4 NPTEL Joy Of Computing, the link is below. The answers are 100% correct according to my source, you are free to change answers to your own choice.
Also Read: NPTEL Joy Of Computing Using Python Week 4 Assignment Answers
For Faster Updates and Immediate answer links, join with us on Telegram
Join us on Telegram 👉 CLICK HERE
Q1. 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?
A. courses["CS101"] = ("Database Management Systems")
B. courses["CS102"]["Database Management Systems"]
C. courses["CS102"] = "Database Management Systems"
D. courses["CS101"] = "Database Management Systems"
Answer: [ C ]Â courses["CS102"] = "Database Management Systems"
A. 0
B. 0.5
Q3. What should be replaced with ? in line 10, so that there is high chance that final_choice is equal       to 2?
Q6. What does this program print in the end ?
Q7. In binary search the list gets divided in every iteration to find the element.
A. True
Also Read: NPTEL Joy Of Computing Using Python Week 4 Assignment Answers
For Faster Updates and Immediate answer links, join with us on Telegram
Join us on Telegram 👉 CLICK HERE
NPTEL Joy Of Computing Using Python Week 5 Assignment 2025
Q1. 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?
A. courses["CS101"] = ("Database Management Systems")
B. courses["CS102"]["Database Management Systems"]
C. courses["CS102"] = "Database Management Systems"
D. courses["CS101"] = "Database Management Systems"
Answer: [ C ]Â courses["CS102"] = "Database Management Systems"
Q2. What is the probability of Monty not opening the door with goat, given the hypothesis that you initially chose the door which has car?
A. 0
B. 0.5
C. 1
D. 0.33
Answer: [ A ] 0Â
D. 0.33
Answer: [ A ] 0Â
Given:
- There are 3 doors: One has a car, and the other two have goats.
- You initially choose a door.
- Monty (the host) always opens a door with a goat (never revealing the car).
- We need to find the probability that Monty does not open a door with a goat, given that you initially chose the door with the car.
Solution:Â
- If you initially choose the door with the car, then the two remaining doors both contain goats.
- Monty must open a door with a goat (since he never reveals the car).
- Since both remaining doors have goats, Monty has no choice but to open one of them.
- Since Monty always opens a door with a goat in this scenario, the probability that he does not do so is 0.
import randomÂinitial _choice = random.randint (0,2)doors = [ 'goat', 'goat', 'car' ]Âfor i in range (3):Â Â Â if i ! = initial_choice and doors [ i ]Â != 'car' :Â Â Â Â Â monty_opens=i
     breakif ? :  for i in range (3):     if i ! = initial_choice and i != monty_opens :       final_choice = i       breakelse:  final_choice = initial_choice {codeBox}
A. 2
B. 2∗∗(1024) % 2 != 0
C. 2∗(2∗∗(89)+7) % 2 == 0
D. (2∗∗(90)) % len(doors) != 1
Answer: [ A, C ] 2, 2∗(2∗∗(89)+7) % 2 == 0
Q4. 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 ?
A. Yes, binary search can do it more efficiently, linear search takes 1024 comparisons
B. Yes, binary search can do it more efficiently, linear search takes 2048 comparisons
C. No, binary search may/may not do it more efficiently, linear search takes 1024 comparisons
D. No, binary search will take more comparisons, linear search takes 2048 comparisons
Answer: [ B ] Yes, binary search can do it more efficiently, linear search takes 2048 comparisons
Q5. What is the primary use of a file with a .wav or .wave extension?
A. Storing video recordingÂ
C. 2∗(2∗∗(89)+7) % 2 == 0
D. (2∗∗(90)) % len(doors) != 1
Answer: [ A, C ] 2, 2∗(2∗∗(89)+7) % 2 == 0
Q4. 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 ?
A. Yes, binary search can do it more efficiently, linear search takes 1024 comparisons
B. Yes, binary search can do it more efficiently, linear search takes 2048 comparisons
C. No, binary search may/may not do it more efficiently, linear search takes 1024 comparisons
D. No, binary search will take more comparisons, linear search takes 2048 comparisons
Answer: [ B ] Yes, binary search can do it more efficiently, linear search takes 2048 comparisons
Q5. What is the primary use of a file with a .wav or .wave extension?
A. Storing video recordingÂ
B. Storing log files
C. Storing waves of files
D. Storing audio recordings
Answer: [ D ] Storing audio recordings
C. Storing waves of files
D. Storing audio recordings
Answer: [ D ] Storing audio recordings
Q6. What does this program print in the end ?
import randomÂn = 10Âcounter = 0Âfor i in range(10):ÂÂ Â Â choices = [ "rock", "paper", " scissor"]ÂÂ Â Â choice1 = random.choice(choices)Â Â Â choice2 = random.choice(choices)Â Â Â if choice1 != choice2:ÂÂ Â Â Â Â counter +=1print(counter/n) {codeBox}
A. Fraction of throws where both players showed different symbol(rock/paper/scissors)
B. Fraction of throws where both players showed rock.
C. Fraction of throws where both players showed same symbol(rock/paper/scissors)
D. Fraction of throws where both players showed paper.
Answer: [ A ] Fraction of throws where both players showed different symbol (rock/paper/scissors)
C. Fraction of throws where both players showed same symbol(rock/paper/scissors)
D. Fraction of throws where both players showed paper.
Answer: [ A ] Fraction of throws where both players showed different symbol (rock/paper/scissors)
Q7. In binary search the list gets divided in every iteration to find the element.
A. True
B. False
Answer: [ A ] True
Q8. Which of the following are requirements for binary search to work correctly?
A. The list can be unsorted.
B. The list must contain only positive integers.
C. The list must be sorted.
D. The list must have no duplicate values.
Answer: [ C ] The list must be sorted.
Q9. Given an array [4, 2, 7, 1, 3], what will be the array after the third pass of Bubble Sort?
A. [1,3,2,4,7]
B. [2,4,1,3,7]
C. [1,2,3,4,7]
D. [2,1,3,4,7]
Answer: [ A ] True
Q8. Which of the following are requirements for binary search to work correctly?
A. The list can be unsorted.
B. The list must contain only positive integers.
C. The list must be sorted.
D. The list must have no duplicate values.
Answer: [ C ] The list must be sorted.
Q9. Given an array [4, 2, 7, 1, 3], what will be the array after the third pass of Bubble Sort?
A. [1,3,2,4,7]
B. [2,4,1,3,7]
C. [1,2,3,4,7]
D. [2,1,3,4,7]
Answer: [ C ]Â [1,2,3,4,7]
Q10. 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.
Q10. 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: 2
Conclusion
Also, Join us on Telegram 👉 CLICK HERE
I want NPTEL Assignment Week 6-The joy of computing using python
ReplyDeletehttps://www.study2night.in/2025/02/nptel-joy-computing-using-python-week-6-assignment-2025.html
Delete