We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 14
ih
Home » Python
Python List MCQs wi
Python List MCQs: This section contains multiple-choice questions and answers on Python List.
These MCQs are written for beginners as well as advanced, practice these MCQs to enhance
and test the knowledge of Python List.
h Answers & Explanations
MCQ Questions and Answers on Python List
Here is the set of important 30 MCQ questions on Python list with answers:
1. What is the list in Python?
A. A mutable type of data type which can store anything
B. An immutable type of data type which can only store string
C.A mutable type of data type which can store only string
D. A mutable type of data type which can only store numbers
‘Answer: A) A mutable type of data type which can store anything
Explanation:
List is python's one of the data types which is mutable and can store anything i.e., numbers,
strings, characters, etc,
Discuss this Question )
2. Python lists are MUTABLE. What does this statement mean?
A. A mutable nature of the python list states that it allows us to store the element at the
creation time only
B. A mutable nature of the python list states that it allows us to store the data whenever we
want after its creationAnswer: 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.
3. In the python list, different elements are separated by which symbol?
A:
B.,
G:
D. None of the above
‘Answer: B) ,
Explanation:
In the python list, elements are separated by a comma (,) symbol.
4. What is the nature of the python list data type?
A. In python, lists are of ordered nature
B. In python, lists are of unordered nature
Answer: A) In python, lists are of ordered nature.
Explanation:
In python, lists are of ordered nature.
»
Discuss this Question }5. What do you mean by the ordered nature of the python list?
A. The ordered nature of the list indicates that you can only store the data in sequence
B. The ordered nature of the list indicates that you can store the data in any sequence
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
D. 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.
——
Discuss this Question }
6. How do you store list elements?
A. List elements are stored using square brackets [] symbol
B. List elements are stored using curly brackets (} symbol
C. List elements are stored using the parenthesis () symbol
Answer: A) List elements are stored using square brackets [] symbol
Explanation:
List elements are stored using square brackets [] symbol.
7. What will be the result of the above statement?
L1= ["ram", ‘hello’, 1,2,3, ‘hello world"]
print (11)A. ram, hello,1,2,3, hello world
B. ['ram’, ‘hello’, 1, 2, 3, ‘hello world']
C. ERROR
Answer: B) ['ram’, ‘hello’, 1, 2, 3, ‘hello world’]
Explanation:
The above code prints the list. Here is the output:
8. What element will come at index 5
A. Ram
B. Hello
C.33
D. None
Answer: B) Hello
Explanation:
[99,12,3,33, "ram", “hello”,122]
At index 5 hello will come. In the example given above this will be the following indexes: -
99
12
3
33
hello
122
Index 0
Index 1
Index 2
Index 3
Index 4
Index 5
Index 6
Discuss this Question )
9. How indices in python list are denoted?
La= [99,12,3,33,"ram", “hello",122]A. Lifindex 0] =99;
B. L1[index (0)] =99;
CLA [1] =12;
D. L1(1) =12;
Answer: C) 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
10. Can you make a list inside a list?
A. Yes
B. No
Answer: A) Yes
Explanation:
Yes, a list can contain another list.
Discuss this Question }
/
11. What will be the output of the following command
"ram", "hello",1,2,3,"hello world”, [1,2,3,4]] 5
print (11)?
A. "ram","hello",1,2,3,"hello world",1,2,3,4
B. “ram","hello",1,2,3,"hello world" [1,2,3,4]
C. ["ram","hello",1,2,3,"hello world"), (1,2,3,4]
D. ErrorAnswer: B) "ram'",*hello”,1,2,3,"hello world" [1,2,3,4]
Explanation:
“ram","hello",1,2,3,"hello world",[1,2,3,4] will be the outcome of the above command.
7 \
Discuss this Question )
\ —
12. What is the syntax of slicing the list?
A. List (start index, stop index, step)
B, List (start index: stop index: step)
C. List [start index, stop index, step]
D. List [Start index: stop index: step]
Answer: D) 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]
>
Discuss this Question )
13. What will be the output of the following statement?
“ram","hello",1,2,3,"hello world", [1,2,3,4]]5
print(La[:])
A.‘ram',hello’,1,2,3,‘hello world’, [1,2,3,4]
B. ‘ram’, ‘hello’, [1,2,3,'hello world’, [1,2,3,4]]
C. ram’, ‘hello'], [1,2,3,'hello world’, [1,2,3,4]
D. ERROR
Answer: A) ‘ram’,‘hello’,1,2,3,hello world’, [1,2,3,4]
Explanation:‘ram’ ‘hello’,1,2,3,'hello world’, [1,2,3,4] will be the output.
~
Discuss this Question }
14. How to access the last element of the list?
A. Print Li[last index]
B. Print L1 [-1]
C. Print L1 [-LAST INDEX]
Answer: B) Print L1 [-1]
Explanation:
To access the last element directly of the list we can use the following syntax: List name[-1]
Discuss this Question )
/
15. What will be the output of the following code?
Li=["apple","hello",1,2,3,"hello world”, "banana", ["Car","Bike",1,2,3,4]] 5
print (La[-2])
A3
B. Hello
C. Banana
D1
Answer: C) Banana
Explanation:
The -2 index denotes the second last element of the list.Hello | banana
world car | Bike} 1 | 2 3 4
apple | Helle
Inde | Inde | inde | index 3 | index | inde
xo fxt | x2 4 5
Index | index | Index | index | incex | index | index | index 7
a 1 2
16. What do you mean by negative indexing in python?
A. Negative indexing in python helps us to traverse the list from the end
B. Negative indexing in python helps us to traverse the list from the starting
C. 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.
\
Discuss this Question )
17. What will be the output of the following multidimensional list
statement
1a=[["hello",1,2,3], [
print(11[1][1]})?
everyone"
A. Hello
Bt
CHi
D. Everyone
Answer: D) EveryoneExplanation:
The output would be — Everyone. As the whole list contains 2 other lists it means the original
list contains only two indexes 0,1.
uss this Quest
18. Which python function will get you the size of the python list?
A Size )
B. Len Q)
C. Lenin 0
D. Listen 0.
Answer: B) Len ()
Explanation:
Len function will give you the total number of elements present in the list.
7 >
Discuss this Question )
\ /
19. What will be the syntax to use the Len function to get the size of the
following list
lis
"hello" ,1,2,3], [ everyone"
A. Print(len(l1)
B. Print (len{!1])
C. Print ([ len (11)))
Answer: A) Print(len(/1)
Explanation:
To get the size of any list we will use the following syntax: - Print(len(I1), where I1 is the name of
the list.Discuss this Qui
20. Suppose | 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 | do that?
A. L2= [4] =1000
B. L2[3] =1000
C. L2[4] =1000
D. L2{(4)]=1000
Answer: C) L2[4] =1000
Explanation:
To update the value we will use the following syntax: - L2[4] =1000
Discuss this Question )
21. Which of the following methods will help you to add the element at
the end of the list?
A. append)
B. end()
Caddo,
D. last)
Answer: A) Append()
Explanation:
The appendQ method in python helps you to add the element at the end of the list.
\
Discuss this Question )
22. What does extends() method do?‘A. Extend method helps you to insert the element from the starting of the list
B. Extend method helps you to insert the element at the end of the list
C. 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.
23. How to use extend() method to insert the element?
A. List(extend[element])
B. List.extend (elements)
C. List.extend ({elements))
Answer: C) List.extend ({elements])
Explanation:
To use extend method we will use the following syntax: - List.extend ([elements])
iscuss this Ques
24. What will be the output of the following code?
11=[45, 56,22, ["hello
li. reverse() print(11)
veryone"] ]
A. [['hello’, ‘everyone'], 22, 56, 45]
B. ['everyone’;hello’], 22, 56, 45]
C. [22, 56, 45, ['everyone’,‘hello’]
D. [22, 56, 45 [‘hello’, ‘everyone’]]
Answer: A) Java
Explanation:[[hello’, ‘everyone’], 22, 56, 45] will be the output.
rc >
Discuss this Question }
25. To eliminate any element from the list which function will be helpful.
A. Delete)
B. Remove()
C.Undod)
D. Del)
Answer: B) Remove()
Explanation:
Remove function will help you to remove the element from the list
uss this Quest
26. How do you find the index of any particular element?
A. Using list.index()
B. Using index().list
C. Using only_index0.list
Answer: A) Using listindex()
Explanation:
Using list index) will be used to find the index of any particular element.
Discuss this Question )
27. What will be the outcome?
# Suppose you have the following list
1,2, [1¢00,123]]
print(11.index("hello"))AO
B.1
C2
D3
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?
A. total) function
B. sum( function
C. aggregate() function
D. sum_total function
Answer: B) sum( function
Explanation:
The sum(Q function will help you to find out the sum of all the elements in the list.
)
Discuss this Question )
\
29. What will be the output of the following code?
L1=[1,276, 986, 1783]
Print(276 in L1)
AYES
B. Error
C. True
D. False
E. 276Answer: 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.
Discuss this Question )
30. What will be the output of the following code?
10, 1¢0, 1000, 1¢¢00]
print(L1*2)
A. [20, 200, 2000, 20000, 20, 200, 2000, 20000]
B. [10, 100, 1000, 10000, 10, 100, 1000, 10000]
C. [20, 200, 2000, 20000}
D. Error
Answer: B) [10, 100, 1000, 10000, 10, 100, 1000, 10000}
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}
————|
Discuss this Question )
Learn & Test Your Skills
| Lvs meas] [coe mee [mec [ssn]
[sey mea ][rur meas [sens wen]