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?

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

Questions No: 3/50

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

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

Questions No: 4/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: 5/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: 6/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: 7/50

Which type stores key-value pairs?
किस प्रकार का डेटा कुंजी-मान युग्मों को संग्रहीत करता है?

Questions No: 8/50

What will be the output of the following Python code?

a={1:"A",2:"B",3:"C"}
b=a.copy()
b[2]="D" 
print(a)

Questions No: 9/50

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

Questions No: 10/50

What is the output of the following code?

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

Questions No: 11/50

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

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

Questions No: 12/50

What does the update() method do in a dictionary?
अपडेट() मेथड किसी ड़िक्शनरी में क्या करती है?

Questions No: 13/50

What will be the output of the following Python code?

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

Questions No: 14/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: 15/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: 16/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: 17/50

What will be the output of the following Python code?

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

Questions No: 18/50

What is the output of following code

d = {}
d[1] = "Python"
d[2] = "Java"
print(len(d))

Questions No: 19/50

Which method is used to get all keys from a dictionary?
डिक्शनरी से सभी कीज़ प्राप्त करने के लिए किस मेथड का यूज़ किया जाता है?

Questions No: 20/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: 21/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: 22/50

What will be the output of the following Python code?

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

Questions No: 23/50

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

Questions No: 24/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: 25/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: 26/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: 27/50

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

Questions No: 28/50

What will be the output of the following Python code?

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

Questions No: 29/50

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

Questions No: 30/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: 31/50

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

Questions No: 32/50

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

Questions No: 33/50

What will be the output?

dict1={'a':[3,6,8]}
print(len(dict1))

Questions No: 34/50

What will be the output?

a={'a':4,'b':6,'a':7}
print(a)

Questions No: 35/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: 36/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: 37/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: 38/50

What will be the output of the following Python code?

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

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.keys():
    print(d[x])

Questions No: 40/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: 41/50

What will be the output?

d = {"a": 1, "b": 2}
print(2 in d)

Questions No: 42/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: 43/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: 44/50

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

Questions No: 45/50

Which of the statements about dictionary values if false?
ड़िक्शनरी वैल्यूज में से कौन सा स्टेट्मेंट यदि गलत है?

Questions No: 46/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: 47/50

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

Questions No: 48/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: 49/50

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

Questions No: 50/50

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

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