CBSE Class 11 Computer Science Question 8 of 88

Tuples and Dictionary — Question 8

Back to all questions
8
Question

Question 8

Assertion (A): clear() method removes all elements from the dictionary.

Reasoning (R): len() function cannot be used to find the length of a dictionary.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.
Answer

A is true but R is false.

Explanation
The clear() method removes all items from the particular dictionary and returns an empty dictionary. The len() method returns the length of key-value pairs in the given dictionary.