Dictionaries Class 11 Computer Science Exam Questions

Exam Questions Class 11

Please refer to Dictionaries Class 11 Computer Science Exam Questions provided below. These questions and answers for Class 11 Computer Science have been designed based on the past trend of questions and important topics in your class 11 Computer Science books. You should go through all Class 11 Computer Science Important Questions provided by our teachers which will help you to get more marks in upcoming exams.

Class 11 Computer Science Exam Questions Dictionaries

Class 11 Computer Science students should read and understand the important questions and answers provided below for Dictionaries which will help them to understand all important and difficult topics.

Very Short answer Type Questions

Question: Can you change the order of the dictionaries contents?
Ans:
 Yes, the order of dictionary contents may be changed.

Question: Can you modify the value in a dictionary?
Answer: Yes, Values can be modified in dictionaries.

Question: Why can‟t List can be used as keys?
Answer:  List is mutable datatype. And Keys of dictionary must be immutable type. This is the region that
list cannot be used as keys.

Question: What type of objects can be used as keys in dictionary?
Answer: Any immutable objects can be used as keys in dictionary.

Question: Can you modify the keys in a dictionary?
Answer: Keys cannot be modified in dictionary while values are mutable in dictionary.

Question: Is dictionary Mutable? Why?
Answer: Dictionary is mutable type because we can change its values.

Short Answer Type Questions

Question: Discuss the utility and significance of Dictionaries.
Answer:
 Dictionaries can be much more useful than lists when we wanted to store all our friends cellphone numbers. We could create a list of pairs,(name of friend, phone number), but once this list becomes long enough searching this list for a specific phone number will get-time consuming. Better would be if we could index the list by our friend‘s name. This is precisely what a dictionary does.

Question: How are dictionaries different from Lists?
Answer: The dictionary is similar to lists in the sense that it is also a collection of data-items but it is different from lists in the sense that lists are sequential collections(ordered) and dictionaries are non-sequential collections(unordered).
Elements in lists or tuples can be accessed by using indexes. But in dictionaries the values can be obtained using keys. By changing the sequence of key we can shuffle the order of elements of dictionary while this thing is not possible in list.

Question: When are dictionaries more useful than lists?
Answer: Dictionaries can be much more useful than lists when we wanted to store all our friends cellphone numbers. We could create a list of pairs,(name of friend, phone number), but once this list becomes long enough searching this list for a specific phone number will get-time consuming. Better would be if we could index the list by our friend‘s name. This is precisely what a dictionary does.

Question: Why is a dictionary termed as an unordered collection of objects?
Answer: But in dictionaries the values can be obtained using keys. By changing the sequence of key we can shuffle the order of elements of dictionary while this thing is not possible in list. In dictionaries there is no index. It uses its keys as index which can be rearranged. That‘s why a dictionary termed as an unordered collection of objects.

Question: How is clear() function different from del <dict> Statement? 
Answer: clear() removes all the elements of a dictionary and makes it empty dictionary while del statement removes the complete dictionary as an object. After del statement with a dictionary name, that dictionary object no longer exists, not even empty dictionary.

Question: What is the output produced by the following code –

Dictionaries Computer Science Exam Questions

Answer:

Skill Based Questions 

Question: WAP to create a dictionary named year whose keys are month names and values are their corresponding number of days. 2
Answer:

Dictionaries Computer Science Exam Questions

Question: WAP that repeatedly asks the user to enter product names and prices. Store all of them in a dictionary whose keys are product names and values are prices. And also write a code to search an item from the dictionary.
Answer:

Dictionaries Computer Science Exam Questions
Dictionaries Computer Science Exam Questions

We hope you liked the above provided Dictionaries Class 11 Computer Science Exam Questions. If you have any further questions please put them in the comments section below so that our teachers can provide you an answer.