Quiz: List

To View Tricks: Login Required

Number of Questions: 10

Question: 6 -

What will be the output of below Python code?

list1=["tom","mary","simon"]
list1.insert(5,8)
print(list1)

Options:
  1. Error

  2. ["tom", "mary", "simon", 8]

  3. ["tom", "mary", "simon", 5]

  4. [8, "tom", "mary", "simon"]

  5. Answer:

    ["tom", "mary", "simon", 8]

    Solution not available.

Question: 7 -

What will be the output of following Python code?

list1=["Python","Java","c","C","C++"]
print(min(list1))

Options:
  1. C++

  2. c

  3. C

  4. min function cannot be used on string elements

  5. Answer:

    C

    Solution not available.

Question: 8 -

What will be the result after the execution of above Python code?

list1=[3,2,5,7,3,6]
list1.pop(3)
print(list1)

Options:
  1. [2,5,7,3,6]

  2. [2,5,7,6]

  3. [3,2,5,3,6]

  4. [3,2,5,7,3,6]

  5. Answer:

    [3,2,5,3,6]

    Solution not available.

Question: 9 -

The elements of a list are arranged in descending order. Which of the following two will give same outputs?
   i. print(list_name.sort())
   ii. print(max(list_name))
   iii. print(list_name.reverse())
   iv. print(list_name[-1])

Options:
  1. iii, iv

  2. i, iii

  3. i, ii

  4. ii, iii

  5. Answer:

    i, iii

    Solution not available.

Question: 10 -

What will be the output of below Python code?

list1=[1,3,5,2,4,6,2]
list1.remove(2)
print(sum(list1))

Options:
  1. 20

  2. 19

  3. 18

  4. 21

  5. Answer:

    21

    Solution not available.