ExamVeda
Login
Home
61
What will be the output of the following Python code?
>>> a={i: i*i for i in range(6)}
>>> a
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
62
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)
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
63
Which of the following is not a declaration of the dictionary?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
64
What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
"john" in d
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
65
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))
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
66
If a is a dictionary with some key-value pairs, what does a.popitem() do?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
67
What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
d["john"]
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
68
What will be the output of the following Python code snippet?
a={1:"A",2:"B",3:"C"}
print(a.get(5,4))
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
69
What will be the output of the following Python code snippet?
a={1:"A",2:"B",3:"C"}
print(a.setdefault(3))
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
70
Suppose d = {"john":40, "peter":45}, to delete the entry for "john" what command do we use?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board