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

From 511 to 525 of 820

Q. print(veggies)

a. [‘carrot’, ‘celery’, ‘broccoli’, ‘potato’, ‘asparagus’] correct 1.00

b. [‘carrot’, ‘celery’, ‘potato’, ‘asparagus’]

c. [‘carrot’, ‘broccoli’, ‘celery’, ‘potato’, ‘asparagus’]

d. [‘celery’, ‘carrot’, ‘broccoli’, ‘potato’, ‘asparagus’]

  • a. [‘carrot’, ‘celery’, ‘broccoli’, ‘potato’, ‘asparagus’] correct 1.00

Q. >>>m = [[x, x + 1, x + 2] for x in range(0, 3)]

a. [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

b. [[0, 1, 2], [1, 2, 3], [2, 3, 4]]

c. [1, 2, 3, 4, 5, 6, 7, 8, 9]

d. [0, 1, 2, 1, 2, 3, 2, 3, 4]

  • b. [[0, 1, 2], [1, 2, 3], [2, 3, 4]]

Q. print(v)

a. 3

b. 5

c. 6

d. 33

  • d. 33

Q. print(v)

a. 1

b. 3

c. 5

d. 6

Q. print(matrix[i][1], end = " ")

a. 1 2 3 4

b. 4 5 6 7

c. 1 3 8 12

d. 2 5 9 13

  • d. 2 5 9 13

Q. print(data[1][0][0])

a. 1

b. 2

c. 4

d. 5

Q. print(ttt(data[0]))

a. 1

b. 2

c. 4

d. 5

Q. print(points)

a. [[1, 2], [3, 1.5], [0.5, 0.5]]

b. [[3, 1.5], [1, 2], [0.5, 0.5]]

c. [[0.5, 0.5], [1, 2], [3, 1.5]]

d. [[0.5, 0.5], [3, 1.5], [1, 2]]

  • c. [[0.5, 0.5], [1, 2], [3, 1.5]]

Q. for i in range(3)]; print(x);

a. [0, 1, 2]

b. [1, 2, 5]

c. error, **+ is not a valid operator

d. error, ‘;’ is not allowed

  • a. [0, 1, 2]

Q. ==0: i; else: i+1; for i in range(4)])

a. [0, 2, 2, 4]

b. [1, 1, 3, 3]

c. error

d. none of the mentioned

  • c. error

Q. Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))?

a. [x**-1 for x in [(1, 2, 3)]]

b. [1/x for x in [(1, 2, 3)]]

c. [1/x for x in (1, 2, 3)]

d. error

  • c. [1/x for x in (1, 2, 3)]

Q. for x in l]

a. [1, 1, 1, 1, 1]

b. [1, 0, 1, 0, 1]

c. [1, 0, 0, 0, 0]

d. [0, 1, 0, 1, 0]

  • b. [1, 0, 1, 0, 1]

Q. for y in l2]

a. [4, 8, 12, 5, 10, 15, 6, 12, 18]

b. [4, 10, 18]

c. [4, 5, 6, 8, 10, 12, 12, 15, 18]

d. [18, 12, 6, 15, 10, 5, 12, 8, 4]

  • c. [4, 5, 6, 8, 10, 12, 12, 15, 18]

Q. Write the list comprehension to pick out only negative integers from a given list ‘l’.

a. [x<0 in l]

b. [x for x<0 in l]

c. [x in l for x<0]

d. [x for x in l if x<0]

  • d. [x for x in l if x<0]
Subscribe Now

Get All Updates & News