# Class 11 IP Chapter 4 List and Dictionaries MCQ | Information Practices

1. Predict the output

L = [4,5,6,4,2,8,10,34]
L[::3]=[100,200,300]
print(L)

a. [4, 4, 10]
b. [100,200,300]
c. [100, 5, 6, 200, 2, 8, 300, 34]
d. [4,100,100,4,200,200,10,300]

c. [100, 5, 6, 200, 2, 8, 300, 34]

1. Predict the output

L = [4,5,6,4,2,8,10,34]
L[:4]=range(10,50,10)
print(L)

a. [10,5,6,4,20,8,10,30]
b. [4,5,6,4,10,20,30,40]
c. [10, 20, 30, 40, 2, 8, 10, 34]
d. Produce Error

c. [10, 20, 30, 40, 2, 8, 10, 34]

1. Predict the output

L = [4,5,6,4,2,8,10,34]
L[3:6]=[11,22,33]
print(L)

a. [4,5,11,22,33,8,10,34]
b. [4,5,6,11,22,33,10,34]
c. [4,5,11,22,33,0,10,34]
d. Produce Error

b. [4,5,6,11,22,33,10,34]

1. What will be the output of the following code segment?

List1 = [1,2,3,4,5,6,7,8,9,10]
for i in range(0,len(myList)):
if i%2 == 0:
print(List1[i], end = “ “)

a. 1 3 5  7 9
b. 2 4 6 8 10
c. 0 2 4 6 8
d. Error

a. 1 3 5  7 9

1. What will be the output of the following code segment?

List1 = [1,2,3,4,5,6,7,8,9,10]
del List1[:4]
print(List1)

a. [1 2 3 4]
b. [ 5 6 7 8 9 10]
c. [6 7 8 9 10]
d. Error

b. [ 5 6 7 8 9 10]

1. What will be the output of the following code segment?
List1 = [1,2,3,4,5,6,7,8,9,10]
del List1[::3]
print(List1)

a. [2,3,5,6,8,9]
b. [1,4,7,10]
c. [5,6,7,8,9,10]
d. [3,6,9]

a. [2,3,5,6,8,9]

1. What will be the output of the following code segment?
List1 = [2,4]
List1 *= 3
print(List1)

a. [6,12]
b. [8,64]
c. [2,4,2,4,2,4]
d. [[2,4],[2,4],[2,4]

c. [2,4,2,4,2,4]

1. Which of the following data type falls under mapping?
a. List
b. Tuple
c. String
d. Dictionary

d. Dictionary

1. Which of the following is NOT true about dictionary?
a. Items stored in dictionary are unordered.
b. Duplicate keys are allowed in dictionary.
c. Items in dictionary are stored as key:value pair.
d. Keys of dictionary are immutable and values are mutable.

b. Duplicate keys are allowed in dictionary.

1. Select the correct statement.
i.  A dictionary can have duplicate values for different keys
ii. The values of dictionary can be accessed using indexes

a. i true, ii false
b. i false, ii true
c. both true
d. both false

a. i true, ii false

1. Which of the following is correct syntax for defining a dictionary?
a. D = {[‘a’,10],[‘b’,20]}
b. D = {(‘a’,10),(‘b’,20)}
c. D = {‘a’,10:’b’,20}
d. D = {‘a’:10,’b’:20}

d. D = {‘a’:10,’b’:20}

1. The length of dictionary is equal to
a. Length of values of dictionaries
b. Length of keys of dictionaries
c. Length of key:value pairs of dictionary
d. Length of index of dictionary

c. Length of key:value pairs of dictionary

1. Method used to return all keys of dictionary is
a. key()
b. keys()
c. value()
d. values()

b. keys()

1. method which returns all the items (key:value) of dictionary as tuple is
a. dict()
b. items()
c. get()
d. keys()

b. items()

1. When we add a new key:value pair to dictionary, it increases the size of dictionary beyond its original size, an d hence an error occurs.
a. True
b. False

b. False

1. We can not use list as key for a dictionary because
i. List are mutable and keys are immutable
ii. List are collection of items and keys are represented with single item

a. both true
b. both false
c. i true, ii false
d. i false, ii true

a. both true

1. Slicing cannot be applied on dictionaries because
a. Dictionary stores items as key: value pair
b. Dictionary is not sequence, items stored in it are unordered
c. Dictionary keys are immutable
d. Dictionary keys cannot taken as list

b. Dictionary is not sequence, items stored in it are unordered

1. If we want to store our friends mobile no with their name, which data type would be more suitable for us?
a. List
b. String
c. Tuple
d. Dictionary

d. Dictionary

1. If we wish to store book details including its name and price, which of the following would be best suitable option?
a. List
b. String
c. Tuple
d. Dictionary

d. Dictionary

1. Select the correct statement to merge and store a dictionary D2 in D1.
a. D1.extend(D2)
b. D1.get(D2)
c. D1.update(D2)
d. D1.append(D2)

c. D1.update(D2)

1. Predict the output of given code:
d1 = {‘a’:10,’b’:20}
d2 = {‘c’:30,’d’:40}
d1.update(d2)
print(d1)

a. {‘a’:10,’b’:20, {‘c’:30,’d’:40}}
b. {{‘a’:10,’b’:20}, {‘c’:30,’d’:40}}
c. {‘a’:10,’b’:20, ‘c’:30,’d’:40}
d. {‘a’:10,’b’:20, [‘c’:30,’d’:40]}

c. {‘a’:10,’b’:20, ‘c’:30,’d’:40}

1. In the previous question, what code one can write to add 50 with key ‘e’ in dictionary d1.
b. d1[‘e’]=50
c. d1.e = 50
d. d1.keys(‘e’) = 50

b. d1[‘e’]=50

1. for the given dictionary
d1 = {‘a’:10,’b’:20, ‘c’:30,’d’:40}
which of the following code will display value 30

a. d1[‘c’]
b. d1.get(‘c’)
c. d1.keys(‘c’)
d. both a and b
E. all  a, b and c

d. both a and b

1. What will be output of following code?

d = {‘c’:30,’d’:40}
print(d.items())

a. dict_items([(‘c’, 30), (‘d’, 40)])
b. dict_items ({(‘c’, 30), (‘d’, 40)})
c. dict_items ([[‘c’, 30], [‘d’, 40]])
d. dict_items ([‘c’->30, ‘d’->40])

a. dict_items[(‘c’, 30), (‘d’, 40)]

1. What will be output of following code?

d = {‘c’:30,’d’:40}
print(d.values())

a. dict_values([30, 40])
b. dict_values((30, 40))
c. dict_values(30,40)
d. dict_values[30, 40]