Top 1000+ Solved Problem Solving and Python Programming MCQ Questions Answer

From 571 to 585 of 820

Q. What is the result of cmp(3, 1)?

a. 1

b. 0

c. true

d. false

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

  • d. value depends on python version

Q. What does 3 ^ 4 evaluate to?

a. 81

b. 12

c. 0.75

d. 7

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”)

  • b. “john” and “peter”

Q. "john" in d

a. true

b. false

c. none

d. error

  • a. true

Q. d1 == d2

a. true

b. false

c. none

d. error

  • b. false

Q. d1 > d2

a. true

b. false

c. error

d. none

  • c. error

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)

  • c. del d[“john”]

Q. print(list(d.keys()))

a. [“john”, “peter”]

b. [“john”:40, “peter”:45]

c. (“john”, “peter”)

d. (“john”:40, “peter”:45)

  • a. [“john”, “peter”]

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

  • b. the keys of a dictionary can be accessed using values

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”}

  • c. d) { }

Q. ,4))

a. 1

b. a

c. 4

d. invalid syntax for get method

Q. ,4))

a. error, invalid syntax

b. a

c. 5

d. 4

Q. ,"D") print(a)

a. {1: ‘a’, 2: ‘b’, 3: ‘c’, 4: ‘d’}

b. none

c. error

d. [1,3,6,10]

  • a. {1: ‘a’, 2: ‘b’, 3: ‘c’, 4: ‘d’}
Subscribe Now

Get All Updates & News