# The Joy of Computing using Python | NPTEL 2023 | Week 5 Assignment Solutions

This set of MCQ(multiple choice questions) focuses on the The Joy of Computing using Python NPTEL 2023 Week 5 Assignment Solutions.

The course carries programming to your work area with stories, similarities and distinguished models. Going reflections to experiences and designing to engineering, the course concentrates fundamentally to rouse the student’s psyche to automatically think intelligently and show up at an answer. As a feature of the course, you will figure out how to practice and culture the craft of programming with Python as a language.

### Course layout

NOTE: You can check your answer immediately by clicking show answer button. The Joy of Computing using Python NPTEL 2023 Week 5 Assignment Solution” contains 10 questions.

Now, start attempting the quiz.

### The Joy of Computing using Python NPTEL 2023 Week 5 Assignment Solutions

Q1. Which is the fastest sorting algorithm?

a) Bubble Sort
b) Bucket Sort
c) Quick Sort
d) Insertion Sort

Q2. How can you remove all items from a dictionary?

a) dict.clear()
b) del dict
c) dict.remove_all()
d) dict.pop()

Q3. What happens if you try to add a new key to a dictionary that already exists?

a) The key and its associated value will be updated.
b) The key and its associated value will be added.
c) The key will be added, but the associated value will remain unchanged.
d) An error will occur.

Answer: a) The key and its associated value will be updated.

Q4. Which of the following is true about dictionaries?

a) There can be multiple same keys.
b) Every value must be unique.
c) Every key must be unique.
d) We canâ€™t get every key from the dictionary.

Answer: c) Every key must be unique.

Q5. What is the syntax to create a dictionary?

a) D = []
b) D = {}
c) D = ()
d) D = dictionary()

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q6. What will be the output of the following code?

``````d= {'a': 20, 'b':30, 'c':50}
print(d.items())``````

a) â€˜aâ€™ â€˜bâ€™ â€˜câ€™
b) 20 30 50
c) (‘a’, 20), (‘b’, 30), (‘c’, 50)
d) (â€˜aâ€™, â€˜bâ€™, â€˜câ€™) (20, 30, 50)

Answer: c) (‘a’, 20), (‘b’, 30), (‘c’, 50)

Q7. In the Monte Hall Problem, what is the probability of winning if you switch doors after the host reveals a goat behind one of the other doors?

a) 1/3
b) 1/2
c) 2/3
d) 3/4

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q8. In the Monte Hall Problem, what is the probability of winning if you do not switch doors after the host reveals a goat behind one of the other doors?

a) 1/3
b) 1/2
c) 2/3
d) 3/4

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q9. What is the name of the game show that the Monte Hall Problem was based on?

a) Jeopardy
b) Wheel of Fortune
c) The Price is Right
d) Let’s Make a Deal

Answer: d)Â Let’s Make a Deal

Q10. Which module in Python can be used for Speech to Text conversion?

a) SpeechRecognition
b) PyAudio
c) Wave
d) All of the above

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

### The Joy of Computing using Python NPTEL 2023 Week 5 Assignment Solutions

Q1. Binary search can be applied on ___.

a) Sorted list
b) Unsorted list
c) Both A and B
d) Any list with any elements

Q2. Which of the following is a Waveform Audio File Format.

a) Wav
b) Wave
c) Wv
d) Waves

Q3. Which of the following libraries can help us to convert audio into lyrics?

a) speech_recognition
b) text_to_speech
c) speech_to_text
d) text_translate

Q4. State True or False: In the monte hall problem, swapping the choice does not increase the chance of winning. (For the large number of experiments)

a) Swapping will decrease the chance of winning.
b) Swapping will increase the chance of winning.
c) Swapping will not affect the chance of winning.
d) Swapping may or may not increase the chance of winning.

Q5. What is the correct way to initialize a dictionary?

a) D = {a-10, b-20, c-30}
b) D = {â€˜aâ€™-10, â€˜bâ€™-20, â€˜câ€™-30}
c) D = {a:10, b:20, c:30}
d) D = {â€˜aâ€™:10, â€˜bâ€™:20, â€˜câ€™:30}

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q6. What is the correct syntax to get all the keys only from a dictionary d?

a) d.key()
b) d.item()
c) d.value()
d) d.keys()

Q7. Which of the following is valid?.

a) D = {‘a’: {‘a’: 10}, ‘b’: 10}
b) D = {‘a’: ‘a’: 10, ‘b’: 10}
c) D = {‘a’: {‘a’: 10}, ‘b’: {‘b’: 10}}
d) D = {‘a’: ‘a’: 10, ‘b’: ‘b’: 10}

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q8. For bubble sort, which of the following statements is true?

a) If the list is sorted, the algorithm wonâ€™t work.
b) In each iteration consecutive pairs of elements are compared with each other.
c) Every element is compared with every other element in the list in each iteration.
d) Swapping never happens in bubble sort.

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q9. Which error is faced while accessing an element that is not there in a dictionary?

a) KeyError
b) IndexError
c) RunTimeError
d) ValueError

Q10. In dictionaries, d.items() will return _

a) Pairs of all (key, value) together.
b) All (keys) and (values) separately.
c) All (values) and (keys) separately.
d) Pairs of all (value, key) together.

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

### The Joy of Computing using Python NPTEL 2022 Week 5 Assignment Solutions

Q1. What is the correct way to initialize a dictionary?

a) D = {a-10, b-20, c-30}
b) D = {â€˜aâ€™-10, â€˜bâ€™-20, â€˜câ€™-30}
c) D = {a:10, b:20, c:30}
d) D = {â€˜aâ€™:10, â€˜bâ€™:20, â€˜câ€™:30}

Answer: d) D = {â€˜aâ€™:10, â€˜bâ€™:20, â€˜câ€™:30}

Q2. What is the correct syntax to get all the keys only from a dictionary d?

a) d.key()
b) d.item()
c) d.value()
d) d.keys()

Q3. Which of the following statements are true about dictionaries in python?

a) The keys of a dictionary must be unique values.
b) The keys of a dictionary can or cannot be unique.
c) The values of a dictionary must be unique values.
d) The values of a dictionary can or cannot be unique.

Q4. State True or False: In the monte hall problem, swapping the choice does not increase the chance of winning.

a) True
b) False

Q5. In dictionaries, d.items() will return _

a) Pairs of all (key, value) together.
b) All (keys) and (values) separately.
c) All (values) and (keys) separately.
d) Pairs of all (value, key) together.

Answer: a) Pairs of all (key, value) together.

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q6. What will be the output of the following program?

a) A dictionary with all letters as keys and 0 as values.
b) A dictionary with some letters as keys and 0 as values.
c) A dictionary with all letters as keys and some random numbers as values.
d) A dictionary with some letters as keys and some random numbers as values.

Answer: d) A dictionary with some letters as keys and some random numbers as values.

Q7. Binary search can be applied on ___.

a) Sorted list in ascending order.
b) Unsorted list
c) Both A and B
d) Sorted list in descending order

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q8. Which error is encountered while accessing a position that is not present in a list?

a) KeyError
b) IndexError
c) RunTimeError
d) ValueError

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

Q9. Which of the following command is correct to delete a key from a dictionary â€˜dâ€™?

a) d.pop(â€˜keyâ€™)
b) d.del(â€˜keyâ€™)
c) d.remove(â€˜keyâ€™)
d) d.delete(â€˜keyâ€™)

Q10. Which of the following is/are correct regarding dictionaries?
1) One can make a dictionary inside a dictionary in python.
2) Keys in the dictionary are mutable.

a) Option 1 is correct, option 2 is correct. Option 2 is the correct explanation for option 1.
b) Option 1 is correct, option 2 is incorrect. Option 2 is not the correct explanation for option 1.
c) Option 1 is correct, option 2 is correct. Option 2 is not the correct explanation for option 1.
d) None of these

Answer: b) Option 1 is correct, option 2 is incorrect. Option 2 is not the correct explanation for option 1.

The Joy of Computing using Python NPTEL week 5 Assignment Solutions

<< Prev- The Joy of Computing using Python Week 4 Assignment Solutions

>> Next- The Joy of Computing using Python Week 6 Assignment Solutions

`DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.`

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.