Python - Dictatory In Python
Questions No: 1/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: 2/50

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

Questions No: 3/50

What will be the output?

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

Questions No: 4/50

What will be the output of the following Python code?

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

Questions No: 5/50

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

Questions No: 6/50

What will be the output of the following Python code?

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

Questions No: 7/50

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

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

Questions No: 8/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: 9/50

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

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

 

Questions No: 10/50

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

Questions No: 11/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: 12/50

What will be the output of the following Python code?

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

Questions No: 13/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: 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?

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

Questions No: 16/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: 17/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: 18/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: 19/50

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

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

Questions No: 20/50

What is the output of following code

d = {1:"A", 2:"B", 1:"C"}
print(d)

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

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

Questions No: 24/50

What is the output of following code

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

Questions No: 25/50

What is the output of the following code?

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

Questions No: 26/50

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

Questions No: 27/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: 28/50

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

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

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

Questions No: 33/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: 34/50

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

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

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

Questions No: 38/50

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

Questions No: 39/50

What will be the output of the following Python code?

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

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

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

Questions No: 42/50

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

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

What will be the output of the following Python code?

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

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

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

Questions No: 47/50

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

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

What will be the output of the following Python code?

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