Free Class 11 Python List Questions for Practice

Share with others

Python List Questions for Practice

Practice Questions of List in Python
Python List Questions for Practice

CHAPTER: LIST IN PYTHON

Python List Questions

ASSIGNMENT SET – 1

Time: 30 min                                                                                   M.M. – 20

Q1. What do you mean by List in Python?                                            [1]

Q2. Write the output of the following code:                                         [1]

        >>> A = [ ]

        >>> A

        >>> print(A)

Q3. What do you mean by Nested list? Give example                          [1]

Q4. Which method is used to create an empty List?                    [1]

Q5. Negative indexing start from right side of the List(T/F)                [1]

Q6. Write the code to convert the following string into List.              [1]

            “csiplearninghub”

Q7. Write a program to accept 10 numbers from the user and             [2]

       add even numbers in a list named “evenlist” and odd

      numbers in a list named “oddlist”

Q8. Write a function evensum(list) in python that takes list of 10      [2]

       numbers as argument and display the sum of all even

       numbers in the list.

Q9. What is the difference between slicing and indexing of list?        [2]

Q10. Write the output of the following code:                                       [2]

         L = [[1,2],[3,4],[5,6]]

         print(L[0][0])

         print(L[-1])

Q11. Write the output of the following code:                                       [2]

          [1,3,7,9] < [3,5,4]

          [‘A’,’b’,’c’] > [‘z’]

Q12. Write the output of the following code:                                       [4]

         S = “csiplearninghub”

          L = list(S)

  1. print(L[-1:-5])
  2. print(L[::-1])
  3. print(L[1:8:2])
  4. print(L[2:5])

Please enter details for downloading file in pdf format

ASSIGNMENT SET – 1

Python List Questions for Practice

Practice Questions of List in Python
Python List Questions for Practice

CHAPTER: LIST IN PYTHON

Python List Questions

ASSIGNMENT SET – 2

Time: 30 min                                                                                   M.M. – 20

Q1. What do you mean by traversing of list in Python?                       [1]

Ans. Traversing means to access each elements of list. This can be done with the help of the loop.

Q2. Write the output of the following code:                                         [1]

       A = [1, 2, 3, 4, 5]

       print (A[2:6])

Ans. [3, 4, 5]

Q3. Elements of list are enclosed in ________ brackets                      [1]

Ans. Square([ ])

Q4. Write an example of nested list.                                                       [1]

Ans. A = [1, 2, 3, [4, 5]]

Q5. Write the output of the following: (if input string is = INDIA)  [1]

A = list(input(“Enter the String”))

print(A)

Ans. [‘I’,’N’,’D’,’I’,’A’]

Q6. Which method is used to remove last element of element in list?         [1]

 Ans. pop( )                            

Q7. Write a program to add only multiples of 3 from the given list.    [2]

        A = [12, 3, 4, 56, 7, 9, 49, 34, 6]

Ans.

A = [12, 3, 4, 56, 7, 9, 49, 34, 6]

s=0

for i in A:

  if i%3==0:

    s=s+i

print(“Sum of all multiples of 3 is “,s)

Q8. Write a function Lavg(list) in python that takes list as argument and display the average of all [2]

numbers in the list.

Ans.

A = []

def Lavg(A):

    s=0

    av=0

    for i in A:

        s=s+i

    av=s/len(A)

    print(“Average is “,av)

Lavg([1,2,3,4,5,6,7,8,9,10]) #Only to verify the result

Q9. Write a function double(list) which takes list as argument and multiply each and every [2]

element of list by 2?                      

Ans.

A = []

def double(A):

    for i in range(len(A)):

        A[i]=A[i]*2

    print(“List is “,A)

double([1,2,3,4,5]) #Only to verify the result

Q10. Write the output of the following code:                                       [2]

A = list(“Python List Questions”)

for i in range(len(A)-1,0,-5):

     print(A[i])

Ans.

s

s

t

n

 Q11. Write the output of the following code:                                      [2]

a=[‘a’,’b’,’c’]

b=a

a[0]=’A’

print(a)

print(b)

Ans.

[‘A’, ‘b’, ‘c’]

[‘A’, ‘b’, ‘c’]

 Q12. Write the output of the following code:                                      [4]

k = “Subscribe to my blog”

L = list(k)

  1. print(L[-1:-7:-3])
  2. print(L[:15:-1])
  3. print(L[1:len(k):5])
  4. print(L[2:-15])

Please enter details for downloading file in pdf format

Share your feedback on csiplearninghub@gmail.com

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

error: Content is protected !!
%d bloggers like this: