Dictionaries || Type A || Sumita Arora || Class 11 || Computer science || Solution
Q1. Why is dictionary termed as an unordered collection of objects ?
Q2. What type of objects can be used as keys in dictionaries ?
Q3. Though tuples are immutable type, yet they cannot always be used as keys in a dictionary. What is the condition to use tuples as a key in a dictionary ?
Q4. What all types of values can you store in : (a) dictionary-values ?(b) dictionary-keys ?
Q5. Can you change the order of dictionary's contents, i.e., can you sort the contents of a dictionary ?
Q6. In no more than one sentence, explain the following Python error and how it could arise: Type Error : unhashable type: 'list'
Q7. Can you check for a value inside a dictionary using in operator ?How will you check for a value inside a dictionary using in operator ?
Q8. Dictionary is a mutable type, which means you can modify its contents ?What all is modifiable in a dictionary ?Can you modify the keys of a dictionary ?
Q9. How is del D and del D[<key>] different from one another if D is a dictionary ?
Q10. How is clear( ) function different from del < dict > statement ?
Q11. What does fromkeys() method do?
Q12. How is pop() different from popitem()?
Q13. If sorted() is applied on a dictionary, what does it return ?
Q14. Will max() and min() always work for a dictionary?
Q15. Can you use sum() for calculating the sum of the values of a dictionary?
Q16. What do you understand by shallow copy of a dictionary?
Q17. What is the use of copy() function?
Q18. Discuss the working of copy() if
(i) The values are of immutable types,
(ii) The values are of mutable types.
thanks
ReplyDeleteWelcome 😊😊😊
DeleteSuper this is usefull
ReplyDeleteWelcome : )
DeleteThanks! My periodic test 3 is approaching and this helped me much. Cheers!
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )