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

From 106 to 120 of 820

Q. >>>t1 < t2

a. true

b. false

c. error

d. none

  • b. false

Q. >>>print len(my_tuple)

a. 1

b. 2

c. 5

d. error

  • d. error

Q. What is the data type of (1)?

a. tuple

b. integer

c. list

d. both tuple and integer

  • b. integer

Q. What type of data is: a=[(1,1),(2,4),(3,9)]?

a. array of tuples

b. list of tuples

c. tuples of lists

d. invalid type

  • b. list of tuples

Q. Is the following Python code valid?>>> a,b=1,2,3

a. yes, this is an example of tuple unpacking. a=1 and b=2

b. yes, this is an example of tuple unpacking. a=(1,2) and b=3

c. no, too many values to unpack

d. yes, this is an example of tuple unpacking. a=1 and b=(2,3)

  • c. no, too many values to unpack

Q. Tuples can’t be made keys of a dictionary.

a. true

b. false

  • b. false

Q. Which of the following statements create a dictionary?

a. d = {}

b. d = {“john”:40, “peter”:45}

c. d = {40:”john”, 45:”peter”}

d. all of the mentioned

  • d. all of the mentioned

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
Subscribe Now

Get All Updates & News