Python Programming - Dictionaries
Exercise : Dictionaries - General Questions
- Dictionaries - General Questions
11.
How do you check if a value is present in the values of a dictionary?
Answer: Option
Explanation:
The
in
keyword is used to check if a value is present in the values of a dictionary.
12.
What is the purpose of the
dictionary.copy()
method?
Answer: Option
Explanation:
The
copy()
method creates a shallow copy of the dictionary.
13.
How do you get a list of all values in a dictionary?
Answer: Option
Explanation:
The
values()
method returns a list of all values in a dictionary.
14.
What is the result of the expression
len(dictionary.keys())
?
Answer: Option
Explanation:
The
len()
function returns the number of keys in a dictionary.
15.
How do you iterate over the key-value pairs in a dictionary?
Answer: Option
Explanation:
The
items()
method is used to iterate over key-value pairs in a dictionary.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers