Quiz Home
Python_list Quiz
1: What is Python List?
  Sequence Data Type
  Mutable Data Type
  It is also a collection
  Ordered



2: What is the correct syntax for creating an empty list in Python?
  []
  {}
  list()
  empty_list()



3: Which of the following is NOT a valid data type in Python?
  Integer
  String
  Decimal
  Float



4: What is the result of the following code? x = [1, 2, 3]; y = x; y.append(4); print(x)
  [1,2,3]
  [1,2,3,4]
  [2,1,3]



5: How do you access the third element of a list called `my_list`?
  my_list[2]
  my_list[3]
  my_list(2)
  my_list(3)



6: What method is used to remove an element by value from a list?
  remove()
  pop()
  delete()
  discard()



7: Which of the following is used to sort a list in place?
  sorted()
  sort()
  order()
  arrange()



8: What is the output of the following code?
  ['apple', 'orange', 'banana', 'cherry']
  ['apple', 'blueberry', 'banana', 'cherry']
  ['kiwi', 'banana', 'banana', 'cherry']



9: How do you find the number of elements in a list?
  len(my_list)
  count(my_list)
  size(my_list)
  elements(my_list)



10: What is the purpose of list comprehension in Python?
  To create a new list by filtering and transforming elements from an existing list
  To create a list containing only integers
  To create a list with random elements
  To remove elements from a list



11: What is the correct way to access the last element of a list `my_list`?
  my_list[-1]
  my_list[-len(my_list)]
  my_list[0]
  my_list[1]



12: What is the difference between a list and a tuple in Python?
  A list is mutable, while a tuple is immutable
  A list is ordered, while a tuple is unordered
  A list allows duplicate elements, while a tuple does not
  A list is faster for indexing than a tuple



13: What method is used to add multiple elements to a list in Python?
  append()
  extend()
  insert()
  add()



14: What is the purpose of the `reverse()` method in Python lists?
  To reverse the order of elements in a list
  To remove the last element from a list
  To check if a list is empty
  To sort a list in descending order



15: What is the result of the following code?
  [2, 4, 6, 8, 10]
  [24, 44, 64, 84, 104]
  Error