Quiz: List

To View Tricks: Login Required

Number of Questions: 10

Question: 1 -

Which of the following is True regarding lists in Python?

Options:
  1. size(list1) command is used to find the size of lists.

  2. Elements of lists are stored in contagious memory location.

  3. Size of the lists must be specified before its initialization

  4. Lists are immutable.

  5. Answer:

    Elements of lists are stored in contagious memory location.

    Solution:

    Elements of lists are stored in contagious memory location is True regarding lists in Python.


Question: 2 -

The marks of a student on 6 subjects are stored in a list, list1=[80,66,94,87,99,95]. How can the student's average mark be calculated?

Options:
  1. print(total(list1)/len(list1))

  2. print(sum(list1)/len(list1))

  3. print(sum(list1)/sizeof(list1))

  4. print(avg(list1))

  5. Answer:

    print(sum(list1)/len(list1))

    Solution not available.

Question: 3 -

Which of the following would give an error?

Options:
  1. list1=[]

  2. list1=[]*3

  3. list1=[2,8,7]

  4. None of the above

  5. Answer:

    None of the above

    Solution not available.

Question: 4 -

Which of the following will give output as [23,2,9,75] ?

If list1=[6,23,3,2,0,9,8,75]

Options:
  1. print(list1[0:8:2])

  2. print(list1[1:8:2])

  3. print(list1[1:7:2])

  4. print(list1[0:7:2])

  5. Answer:

    print(list1[1:8:2])

    Solution not available.

Question: 5 -

What will be the output of below Python code?

list1=[8,0,9,5]
print(list1[::-1])

Options:
  1. [8,0,9]

  2. [5,9,0,8]

  3. [8,0,9,5]

  4. [0,9,5]

  5. Answer:

    [5,9,0,8]

    Solution not available.