Python List Board Questions


  1. A tuple named subject stores the names of different subjects. Write the Python commands to convert the given tuple to a list and thereafter delete the last element of the list. [2 MARKS] [2024]
  2.  subject=list(subject)
     subject.pop()
    
     OR
    
     subject=list(subject)
     subject.pop(-1)
    
     OR
    
     subject=list(subject)
     del subject[-1]
    

  3. Given is a Python list declaration : [1 MARK] [2023]
    Listofnames= ["Aman", "Ankit", "Ashish", "Rajan", "Rajat"]

    Write the output of :
    print(Listofnames[-1 : -4 : -1])
  4. ['Rajat', 'Rajan', 'Ashish']

  5. Which function returns the sum of all elements of a list ? [1 MARK] [2023]

    a)  count()		
    b)  sum()	          
    c)  total()	          
    d)  add()
    
  6. b) sum()

  7. __________ function is used to arrange the elements of a list in ascending order. [1 MARK] [2023]

    a)  sort()		
    b)  arrange()	          
    c)  ascending()	          
    d)  asort()
    
  8. a) sort()