Title | |
---|---|
Which of the following statements create a dictionaryWhich of the following statements create a dictionary?
The answer is:
D. All of the mentioned
|
|
Read the code shown below carefully and pick out the keysRead the code shown below carefully and pick out the keys?
The answer is:
B. “john” and “peter”
|
|
What will be the outputWhat will be the output
The answer is:
A. True
|
|
What will be the outputWhat will be the output
The answer is:
B. False
|
|
What will be the outputWhat will be the output?
The answer is:
D. Error
|
|
What is the outputWhat is the output?
The answer is:
A. 40
|
|
Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we usSuppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use
The answer is:
C. del d[“john”].
|
|
Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we useSuppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
The answer is:
B. len(d)
|
|
What will be the outputWhat will be the output?
The answer is:
A. [“john”, “peter”].
|
|
Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]?
The answer is:
C. Since “susan” is not a key in the set, Python raises a KeyError exception
|
|
Which of these about a dictionary is falseWhich of these about a dictionary is false?
The answer is:
B. The keys of a dictionary can be accessed using values
|
|
Which of the following is not a declaration of the dictionaryWhich of the following is not a declaration of the dictionary?
The answer is:
C. {1,”A”,2”B”}
|
|
What is the output of the following codeWhat is the output of the following code?
The answer is:
A. 1 A 2 B 3 C
|
|
What is the output of the following piece of codeWhat is the output of the following piece of code?
The answer is:
B. A
|
|
What is the output of the following codeWhat is the output of the following code?
The answer is:
D. 4
|
|
What is the output of the following codeWhat is the output of the following code?
The answer is:
B. C
|
|
What is the output of the following codeWhat is the output of the following code?
The answer is:
A. {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’}.
|
|
What is the output of the following codeWhat is the output of the following code?
The answer is:
C. {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’, 5: ‘E’}
|
|
What is the output of the following codeWhat is the output of the following code?
The answer is:
B. {1: ‘A’, 2: ‘B’, 3: ‘C’}
|
|
What is the output of the following codeWhat is the output of the following code?
The answer is:
D. { }
|
MCQs
Views
Best Answers
Points