Top 1000+ Solved Problem Solving and Python Programming MCQ Questions Answer
Q. What is the result of round(0.5) – round(-0.5)?
a. 1.0
b. 2.0
c. 0.0
d. value depends on python version
Q. d = {"john":40, "peter":45}
a. “john”, 40, 45, and “peter”
b. “john” and “peter”
c. 40 and 45
d. d = (40:”john”, 45:”peter”)
Q. Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use?
a. d.delete(“john”:40)
b. d.delete(“john”)
c. del d[“john”]
d. del d(“john”:40)
Q. Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
a. d.size()
b. len(d)
c. size(d)
d. len()
Q. print(list(d.keys()))
a. [“john”, “peter”]
b. [“john”:40, “peter”:45]
c. (“john”, “peter”)
d. (“john”:40, “peter”:45)
Q. Which of these about a dictionary is false?
a. the values of a dictionary can be accessed using keys
b. the keys of a dictionary can be accessed using values
c. dictionaries aren’t ordered
d. dictionaries are mutable
Q. Which of the following is not a declaration of the dictionary?
a. {1: ‘a’, 2: ‘b’}
b. dict([[1,”a”],[2,”b”]]) c) {1,”a”,2”b”}