ExamVeda
Login
Home
71
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)
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
72
What will be the output of the following Python code?
>>> import collections
>>> a=dict()
>>> a=collections.defaultdict(int)
>>> a[1]
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
73
Suppose d = {"john":40, "peter":45}, what happens when we try to retrieve a value using the expression d["susan"]?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
74
What will be the output of the following Python code snippet?
a={}
a['a']=1
a['b']=[2,3,4]
print(a)
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
75
What will be the output of the following Python code?
>>> a={'B':5,'A':9,'C':7}
>>> sorted(a)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
76
What will be the output of the following Python code?
>>> import collections
>>> b=dict()
>>> b=collections.defaultdict(lambda: 7)
>>> b[4]
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
77
What will be the output of the following Python code?
>>> a={"a":1,"b":2,"c":3}
>>> b=dict(zip(a.values(),a.keys()))
>>> b
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
78
Which of the following isn't true about dictionary keys?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
79
What will be the output of the following Python code?
>>> a={i: 'A' + str(i) for i in range(5)}
>>> a
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
80
What will be the output of the following Python code?
>>> b={}
>>> all(b)
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board