Python - Dictatory In Python
Questions No: 1/50

What will be the output of the following Python code?

d1={"abc":5,"def":6,"ghi":7}
print(d1[0])

Questions No: 2/50

What will be the output of the following Python code snippet?

test = {1:'A', 2:'B', 3:'C'}
test = {} 
print(len(test))

Questions No: 3/50

Which of the following function of dictionary gets all the keys from the dictionary
निम्नलिखित में से डिक्शनरी का कौन सा फ़ंक्शन डिक्शनरी से सभी की निकालने के लिए किया जाता है

Questions No: 4/50

What will be the output of the following Python code snippet?

d = {"john":40, "peter":45}
print("john" in d)

 

Questions No: 5/50

What will be the output of the following Python code?

a={1:"A",2:"B",3:"C"}
a.clear() 
print(a)

Questions No: 6/50

What will be the output of the following Python code?

a={}
a[2]=1
a[1]=[2,3,4]
print(a[1][1])

Questions No: 7/50

What will be the output of the following Python code?

a=dict()
print(a[1])

Questions No: 8/50

What will be the output of the following Python code snippet?

total={}
def insert(items):
    if items in total:
        total[items] += 1
    else:
        total[items] = 1
insert('Apple')
insert('Ball')
insert('Apple') 
print (len(total))

Questions No: 9/50

If b is a dictionary, what does any(b) do?
यदि b एक डिक्शनरी है, तो कोई भी (b) क्या करता है?

Questions No: 10/50

Which of the following function of dictionary gets all the keys from the dictionary?
निम्नलिखित में से डिक्शनरी का कौन सा फंक्शन सभी कीज को डिक्शनरी से प्राप्त करता है?

Questions No: 11/50

What is the output of the following code?

a = {1:"A", 2: "B", 3: "C"}
b = {4: "D", 5: "E"}
a.update(b)
print(a)

Questions No: 12/50

What will be the output of the following Python code snippet?

>>> a={1:"A",2:"B",3:"C"}
>>> del a

Questions No: 13/50

What will be the output of the following Python code snippet?

a={1:"A",2:"B",3:"C"}
a.setdefault(4,"D") 
print(a)

Questions No: 14/50

What will be the output of the following Python code?

a={1:5,2:3,3:4}
a.pop(3) 
print(a)

Questions No: 15/50

Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]?
मान लीजिए कि d = {"जॉन": 40, "पीटर": 45}, तब क्या होता है जब हम एक्सप्रेशन का यूज़ करते हुए value प्राप्त करने का प्रयास करते हैं d[“susan”]?

Questions No: 16/50

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

dic={"lion":"'wild","tiger":"'wild",'cat":"domestic","dog":"domestic"}

Questions No: 17/50

What will be the output of the following Python code snippet?

test = {1:'A', 2:'B', 3:'C'}
del test[1]
test[1] = 'D'
del test[2]
print(len(test))

Questions No: 18/50

What will be the output of the following Python code snippet?

a={1:"A",2:"B",3:"C"}
print(a.get(3))

Questions No: 19/50

Suppose d = {"john”:40, “peter":45}. To obtain the number of entries in dictionary which command do we use?
मान लीजिए d = {"john":40, “peter":45}| डिक्शनरी में प्रविष्टियों की संख्या प्राप्त करने के लिए हम किस कमांड का उपयोग करते हैं?

Questions No: 20/50

What will be the output of the following Python code snippet?

d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
print(d1 > d2)

 

 

 

Questions No: 21/50

Which one is not a built in function
इनमें से कौन सा बिल्ट इन फंक्शन नहीं है?

Questions No: 22/50

What will be the output of the following Python code snippet?

d = {"john":40, "peter":45}
print(d["john"])

Questions No: 23/50

Which of the following is not a declaration of the dictionary?
निम्नलिखित में से कौन सा ड़िक्शनरी का डिक्लेरेशन नहीं है?

Questions No: 24/50

Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
मान लीजिए d= {"जॉन": 40, "पीटर": 45}। ड़िक्शनरी में एंट्रीज के नंबर्स प्राप्त करने के लिए हम किस कमांड का यूज़ करते हैं?

Questions No: 25/50

Which of the following isn’t true about dictionary keys?
निम्नलिखित में से कौन ड़िक्शनरी keys के बारे में सही नहीं है?

Questions No: 26/50

Which of the following is a mapping datatype?
निम्न में से कौन एक मैपिंग डेटाटाइप है?

Questions No: 27/50

What will be the output of the following Python code snippet?

d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
print(d1 == d2)

 

Questions No: 28/50

What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for i in d:
    print(i)

Questions No: 29/50

What will be the output of the following Python code?

count={}
count[(1,2,4)] = 5
count[(4,2,1)] = 7
count[(1,2)] = 6
count[(4,2,1)] = 2
tot = 0
for i in count:
    tot=tot+count[i]
print(len(count)+tot)

Questions No: 30/50

What will be the output of the following Python code snippet?

 d = {"john":40, "peter":45}
print(list(d.keys()))

Questions No: 31/50

What will be the output of the following Python code snippet?

 a = {}
a[1] = 1
a['1'] = 2
a[1.0]=4
count = 0
for i in a:
    count += a[i]
print(count)
print(a)

Questions No: 32/50

Dictionary has:
डिक्सनरी में है:

Questions No: 33/50

What will be the output of the following Python code?

a={1:"A",2:"B",3:"C"}
print(a.items())

Questions No: 34/50

What will be the output of the following Python code snippet?

a={1:"A",2:"B",3:"C"}
for i,j in a.items(): 
    print(i,j,end=" ")

Questions No: 35/50

What will be the output of the following Python code?

a={1:"A",2:"B",3:"C"}
for i in a: 
    print(i,end=" ")

Questions No: 36/50

What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
    print(x, y)
A)

0
1
2

B)

a
b
c

C)
0 a
1 b
2 c

D)
None of the Above

Questions No: 37/50

What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.keys():
    print(d[x])

Questions No: 38/50

Which keyword is used to remove individual items or the entire dictionary itself.
अलग-अलग आइटम या पूरी डिक्शनरी को हटाने के लिए किस कीवर्ड का उपयोग किया जाता है।

Questions No: 39/50

What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
    print(x)

Questions No: 40/50

What will be the output of the following Python code snippet?

a={}
a['a']=1
a['b']=[2,3,4] 
print(a)

Questions No: 41/50

What is the output of the following code?

dict={"Joey":1, "Rachel":2}
dict.update({"Phoebe":2})
print(dict)

Questions No: 42/50

What will be the output of the following Python code snippet?

a={1:"A",2:"B",3:"C"}
print(a.get(1,4))

Questions No: 43/50

What will be the output of the following Python code snippet?

a = {}
a[1] = 1
a['1'] = 2
a[1]=a[1]+1
count = 0
for i in a: 
    count += a[i]
print(count)

Questions No: 44/50

Which of these about a dictionary is false?
एक ड़िक्शनरी के बारे में इनमें से कौन गलत है?

Questions No: 45/50

What will be the output of the following Python code?

a={'B':5,'A':9,'C':7}
print(sorted(a))

Questions No: 46/50

What will be the output of the following Python code?

a={1:"A",2:"B",3:"C"}
b={4:"D",5:"E"}
a.update(b) 
print(a)

Questions No: 47/50

Which of the following statements create a dictionary?
निम्नलिखित में से कौन सा स्टेट्मेंट एक ड़िक्शनरी बनाता है?

Questions No: 48/50

What will be the output of the following Python code snippet?

numbers = {}
letters = {}
comb = {}
numbers[1] = 56
numbers[3] = 7
letters[4] = 'B'
comb['Numbers'] = numbers 
comb['Letters'] = letters
print(comb)

Questions No: 49/50

If a is a dictionary with some key-value pairs, what does a.popitem() do?
यदि कुछ की-वैल्यू वाले पेअर के साथ एक ड़िक्शनरी है,तो a.popitem () क्या करता है?

Questions No: 50/50

Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use?
मान लीजिए कि d = {"जॉन": 40, "पीटर": 45}, "जॉन" के लिए एंट्री डिलीट करने के लिए,हम किस कमांड का यूज़ करते हैं?