Computer Science
A copy of the dictionary where only the copy of the keys is created for the new dictionary, is called …………… copy.
- key copy
- shallow copy
- deep copy
- partial copy
Python Dictionaries
2 Likes
Answer
shallow copy
Reason — Shallow copy means the content of the dictionary is not copied by value, but just creating a new reference. It is done by using copy() function on original dictionary.
For example:
original_dict = {1:'computer with python', 2:'computer with java'} 
new_dict = original_dict.copy()
print(new_dict)
Output
{1: 'computer with python', 2: 'computer with java'}
Answered By
1 Like
Related Questions
- Which of the following will raise an error if the given key is not found in the dictionary ? - del statement
- pop( )
- popitem()
- all of these
 
- Which of the following will raise an error if the given dictionary is empty ? - del statement
- pop( )
- popitem( )
- all of these
 
- A copy of the dictionary where the copy of the keys as well as the values is created for the new dictionary, is called …………… copy. - key copy
- shallow copy
- deep copy
- partial copy
 
- Which of the following is correct with respect to above Python code ? - d = {"a" : 3,"b" : 7}- a dictionary d is created.
- a and b are the keys of dictionary d.
- 3 and 7 are the values of dictionary d.
- All of these.