90+ List in Python Important Practice Questions

Share with others

Practice questions of list in python

Table of Content:

  1. Practice Questions of List in Python – Test 1
  2. Practice Questions of List in Python – Test 2
  3. Practice Questions of List in Python – Test 3
  4. Practice Questions of List in Python – Test 4
  5. Practice Questions of List in Python – Test 5
  6. Practice Questions of List in Python – Test 6
  7. Practice Questions of List in Python – Test 7
  8. Practice Questions of List in Python – Test 8
  9. Practice Questions of List in Python – Test 9

Practice Questions of List in Python – Test 1

Q1. What do you mean by List in Python?

Q2. The elements in the list can be of ______ type (any/fixed)

Q3. Elements in the list are enclosed in _____ brackets

Q4. Values in the list are called _______.

Q5. Lists are ________ in nature (heterogeneous/homogeneous)

Q7. Elements in the list are separated by ______.

Q8. Write the code to create an empty list named ‘L’.

Q9. Write a code to create list of any three colors named ‘color’.

Q10. What do you mean by nested list

Practice questions of list in python
Practice Questions of List in Python

Practice Questions of List in Python – Test 2

Q1. Write the code to create the list of::

  1. Five vegetables
  2. Vowels
  3. First 10 natural numbers
  4. Square of first 5 natural numbers.
  5. Any five names of your friends
  6. All the alphabets of word “Taj Mahal”
  7. First five multiples of 6.

Q2. Write a code to convert the string “Practice” into list.

Q3. Write the output of the following:

>>> d = “a*hj?”

>>> list(d)

Q4. Write the output of the following:

>>>a = “String”

>>>list (a)

Q5. Write the output of the following:

>>> a = list ()

>>> a

Q6. What is list() function?

Q7. Write the output of the following:

>>>a = input("Enter any String")
Enter any String : Practice 
>>>list(a)

Q8. Write the output of the following

a = [1,2,3,4,5]
print([0]
print([-1]
print([2]
print([-2]
print([1]

Q9. Fill the index value in place of ‘?’ as output should come as below

P
Q
L
N
T

list1 = "Practice QuesTions of List in pythoN"
list2 = list(list1)

print(list2[ ? ])
print(list2[ ? ])
print(list2[ -? ])
print(list2[- ? ])
print(list2[ ? ])

Q10. Write the output of the following code :

b = ['p','r','a','c','t','i','c','e']
for i in b:
     print(i,end="?")
Practice questions of list in python
Practice Questions of List in Python

Practice Questions of List in Python – Test 3

Q1. What do you mean by traversing a list?

Q2. Write a program to print all the elements of given list using for loop.

A = [‘a’,’b’,’c’,’d’,’e’]

Q3. List in python are mutable.(T/F)

Q4. Write the output of the following :

S. NoCodeOutput
1[1,2,3,4] == [4,3,2,1]
2[1,2,3,4] >  [4]
3[1,2,3,4] != [1,2,3,4]
4[1,2,3,4] == [1,2,[3,4]]
5[1,2,3] == [1.0,2.0,3.0]
6>>>a = [1,2,3,4]
>>>b = [5,6,7,8,]
>>>a+b

Q5. What do you mean by concatenation in list? Explain with example.

Q6. Which mathematical operator is used to concatenate the list?

Q7. Which mathematical operator is used to replicate the list?

Q8. Write the output of the following:

>>> a= “python”

>>> b=list(a)

>>> b*2

>>> b+b

>>> a+a

Q9. Can we multiply two list?

Practice questions of list in python
Practice Questions of List in Python

Practice Questions of List in Python – Test 4

Q1. Index value of first element in list is _______________________

Q2. Index value of last element in list is ____________________

Q3. Write one difference between indexing and slicing.

Q4. The syntax of slicing is:

       List[start : stop : step]

    Which argument is optional out of start, stop and step?

Q5. Write the output of the following:

            b = “Practice Questions of List in Python
            a=list(b)
            1.          print(a)
            2.          print(len(a))
            3.          print(a[1:4])
            4.          print(a[1:7])
            5.          print(a[3:])
            6.          print(a[:5])
            7.          print(a[4:17])
            8.          print(a[-2:-5:-1])
            9.          print(a[1:7:1])
            10.       print(a[1:7:2])
            11.       print(a[-5:])
            12.       print(a[:4])
            13.       print(a[-2:-5:-2])
            14.       print(a[11:15])
            15.       print(a[:])
            16.       print(a[::2])
            17.       print(a[-5:-1])
            18.       print(a[7:1:-1])
            19.       print(a[3:-3])
            20.       print(a[30:40])
            21.       print(a[17:-1])
            22.       print(a[10::-1]
)

Q6. Write a code to make copy of following list using copy function.

       a = [1,2,3,4]

Q7. What do you mean by append() function?

Q8. Write the output of the following:

>>> a = [1,2,3,4]

>>> a.append(7)

>>> a

Q9. Write the output of the following

>>> a = [1,2,3,4]

>>> a.append([7,8])

>>> a


Practice questions of list in python
Practice Questions of List in Python

Practice Questions of List in Python – Test 5

Q1. Write a program to create list of the  following (take input from the user)

a.     Any five students name

b.     Any five numbers

c.     Any five alphabets

d.     Any five name of colors.

Q2. Write a program to accept 10 numbers from the user, if the number is odd, and then add that number to the list.

(input numbers are : 1,2,3,4,5,6,7,8,9,10

L = [1, 3, 5, 7, 9])

Q3. Write a program to find the largest number from the following list.(without using inbuilt function)

A = [23, 12, 45, 67, 55]

Q4. Write a program to find the second largest number from the following list.

A = [23, 12, 45, 67, 55]

Q5. Explain the extend() function with example.

Q6. Write any one difference between insert() and append() function.


Practice questions of list in python
Practice Questions of List in Python

Practice Questions of List in Python – Test 6

Q1. Write the role of reverse() function in list.

Q2. reverse() function create new list. (T/F)

Q3. >>> a = [1,2,3,4]

    >>> a.reverse()

    >>> print(a)

Write the output of above code.

Q4. What type of error return by index() function, if element is not present in list?

Q5. a = [1,5,7,5]

    b = a.index(5)

    print(b)

Write the output of above code.

Q6. Write the output of the following code :

a = [1,2,3,4]
a[1] = 'a'
print(a)

Q7. len() function returns the ______ of the list.

Q8. By default sort() function arrange the elements in ________ order (increasing/decreasing)

Q9. Write code to arrange elements of following list in increasing order.

    A = [23,12,45,32,67,33]

Q10. What do you mean by nested list. Give one example of nested list.


Practice questions of list in python
Practice Questions of List in Python

Practice Questions of List in Python – Test 7

Q1. Explain the following functions in reference to list with example

a.     count()

b.     clear()

c.     pop()

d.     remove()

Q2. What is the difference between del statement and pop() function.

Q3. Write the output of the following:

a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
b = a.pop(5)
c = a.pop( )
d = a.pop(-1)
print(b)
print(c)
print(d)
print(a)

Q4. Out of del and pop() which one return the deleted element.

Q5. remove() function take _______ (element/index) as argument.

Q6. Name a function/statement which can delete more than one element from the list.

Q7. Name a function which can delete only one element from the list.

Q8. Write a program to delete/remove all the negative elements from the list.

Q9. Write a program to delete/remove all the odd numbers from the list.

Q10. Write a program to delete/remove all the numbers less than 10 from the list.


Practice questions of list in python
Practice Questions of List in Python

Practice Questions of List in Python – Test 8

Q1. Write a program to check whether a number (accepted from user) is present in a list.

Q2. Name a function which is used to find the largest number from a list.

Q3. ______ function returns the smallest value from the list.

Q4. max() function works in a list which have all values of same data type. (T/F)

Q5. Write the full form of ASCII value.

Q6. ASCII value of ‘A’ is ______.

Q7. ASCII value of ‘b’ is ______.

Q8. Write the output of the following:

a = [11,42,31,14]

print(max(a))

print(min(a))

print(a.index(42))

 Q9. Write the output of the following:

a = [11,42,31,’a’,14]

print(max(a))

Q10. Write the output of the following:

a = [‘amit’,’Amit’,’Amita’]

print(max(a))

print(min(a))


Practice questions of list in python
Practice Questions of List in Python

Practice Questions of List in Python – Test 9

Q1. Write a program to input a number and count the occurrence of that number in the given list.

       B = [34,21,3,12,34,56,76,5,4,21,12,34]

Q2. Write a program to separate the character and numeric value from a given list and store them in a separate list.

    A = [1,’f’,2,’b’,3,4,’h’,j’,6,9,0,’k’]

Q3. What do you mean by sorting?

Q4. Name any two sorting techniques.

Q5. Write a program to create a list of 10 integers and sort the list in increasing order using bubble sort.

Q6. Suppose total element in a list are 7, so how many times the outer loop will be executed in bubble sort.

Q7. A = [23,45,21,78,43]

Write the order of the elements in the above list after first pass of bubble sort (in ascending order).

Q8. Write any one application of bubble sort.


Class 12 Computer Science Sample Paper 2020-2021.

Class 12 Computer Science Sample Paper Marking Scheme

Class 12 Computer Science Test Series


Share with others

Leave a Reply

%d bloggers like this: