Class 11 Dictionary MCQ Quiz

Preview



Created by Lucky

Class 11 Dictionary Quiz

1 / 45

The value of  dictionary can be accessed with the help of indices.

 

2 / 45

To delete an element using a key , ___  _____ is used.

 

3 / 45

Dictionaries are ___ data types of python.

 

4 / 45

which of the following Python codes will not give the same output if

dict ={"dairy" : 1,"book":3,"novel":5}

(i) dict.pop("book")   (ii) del dict["book"]

(iii) dict.update({"diary":1,"novel":5})

5 / 45

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 .

 

6 / 45

What is printed by the foll0wing statements ?

D1={ "cat" :12,"dog" : 6, "elephant " :23, "bear" :20}

print(25 in D1)

 

 

7 / 45

sum() function can work with all types of dictionaries

 

8 / 45

In python ,a dictionary can have two same keys with different values.

9 / 45

copy() method creates a shallow copy of dictionary.

 

10 / 45

The ___ statement will give raise an error if the given key is not found in the dictionary.

 

11 / 45

The  copy() method creates a ____ copy of a dictionary.

.

12 / 45

Dictionaries are ____ set of elements.

 

13 / 45

The ___ function allows to specify own value/ message, if the given key is not found in the dictionary.

 

14 / 45

Which of the following can be used to delete item(s) from a dictionary ?

 

15 / 45

To create a new dictionary from a set of keys, ____  function is used .

.

16 / 45

A copy of the dictionary where only the copy of the keys is created for the new dictionary is called ____  copy

 

17 / 45

What would the following code print ?

d={ 'spring' :'autumn', 'autumn': 'fall' ,'fall' : 'spring'}

print(d['autumn'])

18 / 45

Which of the following will delete key _value pair for key ="tiger " in dictionary ?

di = { " lion ": "wild","tiger" : "wild","car" :"domestic","dog":"domestic" }

 

 

19 / 45

for  ___ function to work ,the keys of a dictionary must be addition compatible.

 

20 / 45

Keys of a dictionary can be string, integer or combination of both.

 

21 / 45

Which of the following will raise an error if the given key is not found in the dictionary ?

 

22 / 45

What will be the result of the following code ?

dict= { "Jo" : 1 , "Ra" :2}

dict. update ( { "ph" :2 } )

print (dict)

 

 

23 / 45

fromkeys () method creates a dictionary with given keys, each having a different value.

 

24 / 45

What will be the result of the following code ?

d1={ "abc" :5 , "def":6,"ghi":7}

print(d1['ghi'])

 

25 / 45

Which of the following functions will return the key , value pairs of a dictionary ?

 

26 / 45

Which of the following is correct with respect to above python code?

d={"a" : 3 ,"b" : 7 }

27 / 45

Which value is assigned to keys , if no value is specified with the fromkeys() method ?

 

28 / 45

sorted( ) function cannot work with dictionaries.

 

29 / 45

Which of the following will add a key to the dictionary only if it does not already exist in the dictionary.

 

30 / 45

Dictionaries are unordered set of elements.

 

31 / 45

Which of the following will create a dictionary with give keys and a common value ?

 

32 / 45

To get all the keys of a dictionary, ____ method is used .

33 / 45

A dictionary can have duplicate keys.

 

34 / 45

What will be the output of the following Python Code?

d1={"a":10,"b":2,"c":3}

str1=" "

for i  in d1:

   str1=str1+str(d1[i]+" "

print(str1])

35 / 45

The del statement raises error if the given  key is not found in the dictionary .

 

36 / 45

popitem ( ) function removes the last element from a dictionary.

 

37 / 45

The keys of a dictionary must be of _____ types.

 

38 / 45

Which of the following will give error if d1 is as shown below ?

d1={"a": 1, "b" : 2,"c" : 3}

 

39 / 45

Dictionary can have two same keys or same values but cannot have two same key-value pairs.

 

40 / 45

Values of a dictionary can be string , integers or combination of both.

 

41 / 45

Running the code sorted (my_dictionary, reverse=True) on a dictionary named my - dictionary will return results sorted in what order ?

 

42 / 45

In python, a dictionary can have two same values with different keys .

 

43 / 45

Dictionaries are also called ____.

 

44 / 45

The popitem() function will always remove the ____ entered value of a dictionary .

 

45 / 45

A dictionary is immutable.

 

Your score is

0%

Exit



 

Lesson tags: Class 11 Dictionary MCQ Quiz, python quiz class 11, python quiz for class 12
Back to: CBSE class 11 Computer Science Notes