Python List MCQs With Answers Amp Explanations
Python List MCQs With Answers Amp Explanations
includehelp.com/python/python-list-mcqs.aspx
Explanation:
List is python's one of the data types which is mutable and can store anything i.e.,
numbers, strings, characters, etc.
1. A mutable nature of the python list states that it allows us to store the element at the
creation time only
2. A mutable nature of the python list states that it allows us to store the data
whenever we want after its creation
Answer: B) A mutable nature of the python list states that it allows us to store the data
whenever we want after its creation.
Explanation:
A mutable nature of the python list states that it allows us to store the data whenever we
want after its creation which means we can modify the data anytime.
Answer: B) ,
Explanation:
1/11
In the python list, elements are separated by a comma ( , ) symbol.
Explanation:
1. The ordered nature of the list indicates that you can only store the data in sequence
2. The ordered nature of the list indicates that you can store the data in any sequence
3. The ordered nature of the list indicates that the elements which you will put after the
creation of the list will be added from the last index
4. The ordered nature of the list indicates that the elements which you will put after the
creation of the list will be added from the first index
Answer: C) The ordered nature of the list indicates that the elements which you will put
after the creation of the list will be added from the last index.
Explanation:
The ordered nature of the list indicates that the elements which you will put after the
creation of the list will be added from the last index.
Explanation:
2/11
Discuss this Question
Explanation:
1. Ram
2. Hello
3. 33
4. None
Answer: B) Hello
Explanation:
At index 5 hello will come. In the example given above this will be the following indexes: -
1. L1[index 0] =99;
3/11
2. L1[index (0)] =99;
3. L1 [1] =12;
4. L1(1) =12;
Explanation:
The index of the python list is denoted by: - List name [index]. In the example given above
L1 is the list name and 1 is the index so the correct syntax would be L1[1] which will give
you 12 as a result as at index 1 we have a 12 as its value.
1. Yes
2. No
Answer: A) Yes
Explanation:
L1=["ram","hello",1,2,3,"hello world",[1,2,3,4]] ;
print (L1)?
1. "ram","hello",1,2,3,"hello world",1,2,3,4
2. "ram","hello",1,2,3,"hello world",[1,2,3,4]
3. ["ram","hello",1,2,3,"hello world"],[1,2,3,4]
4. Error
Explanation:
4/11
1. List (start index, stop index, step)
2. List (start index: stop index: step)
3. List [start index, stop index, step]
4. List [Start index: stop index: step]
Explanation:
Slicing in python list is used to divide the list according to the start and last index and to
do that following syntax is followed: - List [Start index: stop index: step].
Explanation:
Explanation:
To access the last element directly of the list we can use the following syntax: List
name[-1].
5/11
15. What will be the output of the following code?
L1=["apple","hello",1,2,3,"hello world","banana",["Car","Bike",1,2,3,4]] ;
print(L1[-2])
1. 3
2. Hello
3. Banana
4. 1
Answer: C) Banana
Explanation:
1. Negative indexing in python helps us to traverse the list from the end
2. Negative indexing in python helps us to traverse the list from the starting
3. There is no such thing as negative indexing in python
Answer: A) Negative indexing in python helps us to traverse the list from the end.
Explanation:
Negative indexing in python helps us to traverse the list from the end.
1. Hello
2. 1
3. Hi
6/11
4. Everyone
Answer: D) Everyone
Explanation:
The output would be – Everyone. As the whole list contains 2 other lists it means the
original list contains only two indexes 0,1.
18. Which python function will get you the size of the python list?
1. Size ()
2. Len ()
3. Lenln ()
4. List_len ()
Answer: B) Len ()
Explanation:
Len function will give you the total number of elements present in the list.
19. What will be the syntax to use the Len function to get the size of the
following list
1. Print(len(l1)
2. Print (len[l1])
3. Print ([ len (l1)])
Answer: A) Print(len(l1)
Explanation:
To get the size of any list we will use the following syntax: - Print(len(l1), where l1 is the
name of the list.
20. Suppose I have a list L2= [45,56,22,11,34,1,3] and I want to update the
value of index 4 to 1000. How will I do that?
7/11
1. L2= [4] =1000
2. L2[3] =1000
3. L2[4] =1000
4. L2[(4)]=1000
Explanation:
To update the value we will use the following syntax: - L2[4] =1000.
21. Which of the following methods will help you to add the element at the
end of the list?
1. append()
2. end()
3. add()
4. last()
Answer: A) Append()
Explanation:
The append() method in python helps you to add the element at the end of the list.
1. Extend method helps you to insert the element from the starting of the list
2. Extend method helps you to insert the element at the end of the list
3. Extend methods helps you to insert the element anywhere we want
Answer: B) Extend method helps you to insert the element at the end of the list.
Explanation:
Extend method helps you to insert the element at the end of the list.
1. List(extend[element])
2. List.extend (elements)
8/11
3. List.extend ([elements])
Explanation:
To use extend method we will use the following syntax: - List.extend ([elements])
l1=[45,56,22,["hello","everyone"]]
l1.reverse() print(l1)
Answer: A) Java
Explanation:
25. To eliminate any element from the list which function will be helpful.
1. Delete()
2. Remove()
3. Undo()
4. Del()
Answer: B) Remove()
Explanation:
Remove function will help you to remove the element from the list.
9/11
Answer: A) Using list.index()
Explanation:
Using list.index() will be used to find the index of any particular element.
1. 0
2. 1
3. 2
4. 3
Answer: B) 1
Explanation:
The index function will give you the index of the particular element.
28. How do you find the total of all the elements of the list?
1. total() function
2. sum() function
3. aggregate() function
4. sum_total function
Explanation:
The sum() function will help you to find out the sum of all the elements in the list.
L1=[1,276,986,1783]
Print(276 in L1)
1. YES
10/11
2. Error
3. True
4. False
5. 276
Answer: C) True
Explanation:
print (element in list_name) will give you true if the particular element is there in the list
else it will return you false.
L1=[10,100,1000,10000]
print(L1*2)
Explanation:
When you multiply the whole list with some integer then it repeats the elements that
number of times so here the output will be [10, 100, 1000, 10000, 10, 100, 1000, 10000].
11/11