0% found this document useful (0 votes)
170 views

Objective Type Questions - QUESTION & ANSWERS List Methods: Mcqs and True False That Is 1 Mark

The document provides a list of 20 multiple choice questions and answers about Python list methods. It also includes 3 examples of output questions and 3 error-based questions to test knowledge of list methods like len(), index(), append(), extend(), insert(), pop(), remove(), clear(), count(), reverse(), sort(), and sorted(). The document differentiates between various list methods and provides examples of using two-dimensional lists in Python.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
170 views

Objective Type Questions - QUESTION & ANSWERS List Methods: Mcqs and True False That Is 1 Mark

The document provides a list of 20 multiple choice questions and answers about Python list methods. It also includes 3 examples of output questions and 3 error-based questions to test knowledge of list methods like len(), index(), append(), extend(), insert(), pop(), remove(), clear(), count(), reverse(), sort(), and sorted(). The document differentiates between various list methods and provides examples of using two-dimensional lists in Python.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CP INTERNATIONAL FBD

Objective type Questions – QUESTION & ANSWERS List methods

MCQS AND TRUE FALSE THAT IS 1 MARK.

1. A __________ is a standard library that returns the total number of elements of the list.
2. What will be the output of: l = [[1,2,3],[4,5,6],7]; print(len(l))?
1. 3
2. 7
3. 2
4. None of these
3. Which of the following function is used to convert any sequence/object into a list object?
1. l[]
2. list()
3. convert_list()
4. l.list()
4. You cannot convert any tuple, dictionary object into the list. (True/False)
5. What will the output of l=[22,33,45,67,89]; print(l.index(67))?
1. 4
2. 3
3. 67
4. -2
6. When the element is not present in the list and user try to find out the index of a given element, it
returns:
1. index not found
2. Error – Element is not in list
3. 0
4. None
7. Which of the following method is used to add a single element to the existing list?
1. add()
2. extend()
3. addelement()
4. append()
8. Which of the following method is used to insert multiple elements into the list?
1. add()
2. append()
3. extend()
4. insert()
9. The append() and extend() method add an element to the end of the list. (True/False)
10. The _____________ method add an element at specified index or position.
11. The ___________ method removes the last element from the list.
12. The ___________ list method removes the specified element.
13. The ________________ list method removes all the elements from the list.
14. Which of the following method will count the frequency of the list elements?
1. count()
2. list_count()
3. countElement()

1|Page
CP INTERNATIONAL FBD
4. countFrequency()
15. The reverse method returns the list in reverse order of the elements in place. (True/False)
16. Which of the following parameter is required to return the list in descending order with sort
method?
1. order=descending
2. sort!=ascending
3. reverse=True
4. orderby=descending
17. Which of the following method returns a new list after rearranging the list elements?
1. sort()
2. sorted()
3. list_sort()
4. sort()=new list()
18. You can print the maximum and minimum values from the list using max() and min() methods.
19. Which of the following list method is used to return the addition of all list elements?
1. add()
2. sum()
3. autosum()
4. listSum()
20. You can remove an element by specifying its index using the pop method. (True/False)

Let’s have a look at answers for objective type questions QnA List methods.
 
1. len()
2.  3
3. list()
4. False
5. 3
6. Error – is not in list
7. append()
8. extend()
9. True
10. insert()
11. pop()
12. remove()
13. clear()
14. count()
15. True
16. reverse=True
17. sorted()
18. True
19. sum()
20. True
Subjective Type questions
1.  Write the significance use of following standard methods.
1. len
2|Page
CP INTERNATIONAL FBD
2. list
2. Find the output:
1. l=list(‘ListMethods’);print(l)
2. l=((78,90,12,34));print(l)
3. l=list({‘Karthik’:90,’Manoj’:85})
3. What is the use of index() method? Explain with example.
4.  Explain the ValueError exception with example.
5. Differentiate between append(),extend() and insert() methods.
6. Differentiate between pop(), remove() and clear() methods.
7. What is the use of count() method? Explain with example.
8. Justify the statement: “reverse() does not return anything.”
9. Differentiate between sort() and sorted() methods.
10. What do you mean two-dimensional lists?
11. How to create and traverse 2D lists?
Output Questions:
[1]
l1 = [78,89,67,45,69,42,89,]
n = l1.index(89) + l1.index(42)
print(l1.count(89))
l1.append(l1.count(100)+34)
print(l1.len())
 [2]
l1=[56,45,23,12,'ABC']

l1.extend([85,63])

l1.insert(3,99)

l1.pop()

print(l1)

l1.insert(0,101)

l1.insert(2,111)

l1.pop(2)

l1.remove('ABC')

print(l1)
[3]

l = [9,5,3,6,7,8]

3|Page
CP INTERNATIONAL FBD
l.sort()

l.reverse()

print(l)

n=sum(l)+max(l)+min(l)

print(n)
Now let’s see some error questions for QnA List methods:
Error Based Questions
[1]
l = (9,5,3,6,7,8)
print(l.len())
[2]
rno=int(input("Enter the rollno:"))
stu_name=input("Enter the name:")
fees=int(input("Enter the Fees:"))
stu_rec=list(rno,stu_name,fees)
print(stu_rec)
l.index(fees)
l.append('Manali')
l.insert(56)
[3]
l=['Jan','Feb','Mar','Apr']
l.index(2)
l.remove('Jun')
print(sort(l))
n = l.max()

4|Page

You might also like