Choose a topic to test your knowledge and improve your Python skills
Which of the following statement will create list?
Write the output of the following code : list(“welcome”)
Write the output of the following code : >>> L=[‘w’,’e’,’l’,’c’,’o’,’m’,’e’] >>> print(len(L))
Write the output of the following code : >>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”] >>> print(max(L))
Write the output of the following code : >>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”,123] >>> print(max(L))
Write the output of the following code : >>>L=[1,5,9] >>>print(sum(L),max(L),min(L))
Write the output of the following code : >>>L=[1,2,3,4,5,[6,7,8]] >>>print(L[5])
Write the output of the following code : L=list(“www.csiplearninghub.com”) print(L[20 : -1])
Write the output of the following code : >>>L=list(“www.csiplearninghub.com”) >>>print(L[20 : 0])
Write the output of the following code : >>>L=[“Amit”,”Sumit”,”Naina”] >>>print(L[-1][-1])
Write the output of the following code : >>>L=[“Amit”,”Sumit”,”Naina”] >>>print(L[1:-1])
Write the output of the following code : L=[“Amit”,”Sumit”,”Naina”] print(L*2)
Write the output of the following code : L=[“Amit”,”Sumit”,”Naina”] print(L**2)
Write the output of the following code : L=[0.5 * x for x in range(4)] print(L)
Write the output of the following code : L=[‘a’ * x for x in range(4)] print(L)
Write the output of the following code : L= [1*x for x in range(10,1,-4)] print(L)
Write the output of the following code : L=[1,2,3,4,5] for i in L: print(i,end=” “) i=i+1
Write the output of the following code : L=[“Amit”,”Sumit”,”Naina”] L1=[“Sunil”] print(L + L1)
Which command is used to add an element in List named L1
Write the output of the following : L = “123456” L = list(L) print(type(L[0]))
Write the output of the following: T=(1,2,3,4,5.5) L = list(T) print(L[3]*2.5)
Write the output of the following: T=(1,2,3,4,5.5) L = list(T) print(L*2)
Write the output of the following: T = [1,2,3,4] T1 = [3,4,5,6] T2 = T + T1 print(T2)
Write the output of the following: T = [1,2,3,4] T1 = [3,4,5,6] T2 = T.append(T1) print(T2)
del statement can delete the following from the List?
Write the output of the following: T = [1,2,3,4] T1=T T[0] = “A” print(T) print(T1)
What type of error is returned by the following statement? T = [1,2,3,4] print(T.index(9))
Write the output of the following. T = [1,2,3,4] T1=[5,6,7] L=T.append(T1) print(L)
Write the output of the following: L=["Amit","Sumit","Naina"] L1=["Sunil"] print(L + L1)
What we call the operation which is used to extract particular range from a sequence.
Write the output of the following : L=[2 * x for x in range(3,14,3)] print(L)
Write the output of the following : L=["Amit","Sumit","Naina"] L1=["Sumit"] print(L - L1)
Write the output of the following:
Write the output of the following:
Write the output of the following:
Which mathematical operator is used for repetition?
Which of the following is not list operation?
Which of the following is true about List data type in Python?
Identify data type of ‘T’ in following line of Code: T = list(tuple([1,2,3])) print(type(T))
List and String are different
List can have elements of _____________ data types.
Write the output of the following: L =[['Physics',101],['Chemistry',202], ['Maths',303],45, 6, 'j'] print(len(L))
Write the output of the following : L = [1,2,3,4,5,6,7,8,9,10] print(L[L[3]])
Which of the following statement will return first element from right of list ‘L’?
Write the output of the following: L = [1,2,3,4,5,6,7,8,9,10] print(L[len(L) - 1])
The following statements is showing ______ operation in List. L1 = [1,2,3,4] L2 = [1,2,3,4] L = L1 + L2
Which mathematical operator is used to concatenate list?
Write the output of the following : L1 = [1,2,3] L2=[5,6,7] L1 + L2 print(L1)
If we try to concatenate a list with elements of some other data type, _____________ occurs.
If we try to concatenate a list with elements of some other data type, _____________ occurs.
If we try to concatenate a list with elements of some other data type, _____________ occurs.
If we try to concatenate a list with elements of some other data type, _____________ occurs.
Name the operator which is used in the following print statement.
Which operator helps to check whether an element is present in list or not?
Write the output of the following: print(1 in [[1],2,3])
Which operation of List is shown in following lines? L1 = [1, 2, 3, 4, 5, 6, 7, 8] print(L1[3 : 6])
Which of the following statement will reverse the list L1?
Traversing a list can be done with the help of _____
Write the output of the following: print(len(tuple[1]))
Write the output of the following : L = [[1,2,3,5,6,7,[1,[2,3]]]] print(len(L))
Which function returns the length of a list?
Write the output of the following : D = list[ ] print(len(D))
remove( ) function removes the _______________ occurrences of an element from the list
Which of the following function creates the new list?
Write the output of the following : D = [1,2,3] D1 = D D.append(4) print(D1)
Fill in the blanks with same word in both places >>> import __________ >>> list1 = [1,2,3,4,5] >>> list2 = _________copy(list1) >>> list2
Write the output of the following : def listchange(L): L.append(45) return L1 = [1, 2, 3, 4] listchange(L1) print(L1)
Write the output of the following: print([] * 2 )
Which of the following will give output as [21,2,9,7] ? if list L = [1,21,4,2,5,9,6,7]
Write the output of the following : L = ['Amit', 'anita', 'Sumant', 'Zaid'] print(max(L))
Write the output of the following: L=[13, 12, 15, 27, 3, 46] list1.pop(3) print(L)
Write the output of the following: list1=[3,2,5,7,3,6] list1.remove(3) print(sum(list1))
Write the output of the following list1=[3,2,5,7,3,6] list1.insert(6,3) print(list1)
Write the output of the following L = [14, 2, 3, 16, 15] L[1:4] = [5, 4, 8] print(L)
Write the output of the following L = ["Amit", 'Sumit', 'Ravi'] print(L[0][1])
Write the output of the following L = ["Amit", 'Sumit', 'Ravi'] print("@".join(L))
Write the output of the following: L = ['A', 'S', 'R'] L = L + L*2 print(L)
Write the output of the following : L = [[5, 7, 9, 1 ], [12, 23, 4, 9]] for r in L: r.reverse( ) for e in r: print(e, end = ” “)
Write the output of the following: L = [[5, 7, 9, 1 ], [12, 23, 4, 9]] for r in L: r.sort() for e in r: print(e, end = ” “)
How many elements will be there in list ‘L’ L = [[p, q] for p in (0, 4) for q in (0, 4)]
Write the output of the following: L = [[p, q] for p in (0, 4) for q in (0, 4)] print(L[0])
Write the output of the following: L = [23, 45, 65, 32, 3] L.insert(L[4], 'Monitor') print(L)
Which statement will give the same output? list1 = [1, 2, 3, 4] list2 = [5, 6, 7, 8]
Write the output of the following: L = [11, 21, 31, 41] L.append([51,62,73,84]) print(len(L))
Write the output of the following : L = [11, 21, 31, 41] L.extend([51,62,73,84]) print(len(L))
Write the output of the following L1 = ['C++', 'C-Sharp', 'Visual Basic'] L2 = [name.upper() for name in L1] L3 = [name for name in L1] if(L2[2][0] == L3[2][0]): print("YES") else: print("N0")
Write the output of the following : L = [11, 22, 33, 44, 55, 66] for i in range(1, 6): L[i - 1] = L[i]*2 for i in range(0, 4): print(L[i], end = " ")
Write the output of the following : L= [1,2,3,4,5] m = [m and 1 for m in L] print(m)
Write the output of the following : L= [1,2,3,4,5] m = [m + 3 for m in L] print(m)
Write the output of the following : L1 = [1, 2, 3, 4, 5] L2 = [9, 8, 7, 6, 5] S= [L1 + 3 for L1 in L2] print(S)
Write the output of the following : L1 = [1, 2, 3] L2 = [9, 8] S= [m * n for m in L1 for n in L2] print(S)
Write the output of the following : L1 = [1, 2, 3] L2 = [9, 8] S= [n + m for m in L1 for n in L1] print(S)
Which of the following statement will generate the square of given list L ? L = [1, 2, 3, 4, 5]
Which of the following function is used to shuffle the list ?
Which of the following command will insert 7 in third position of List L.