Question 1 of 25
Hints left: 3
Q1
What will be the output of the following code: my_list = [1, 2, 3] my_list[1] = 4 print(my_list)
Q2
In Python, how can you remove all occurrences of a specific element from a list?
Q3
What is the purpose of the count() method for lists?
Q4
What is the purpose of the list() constructor in Python?
Q5
What method is used to insert an element at a specific index in a list?
Q6
What is the output of the following code: my_list = [1, 2, 3] print(my_list[1])
Q7
Which method is used to count the occurrences of an element in a list?
Q8
What is the purpose of the remove() method for lists?
Q9
Which of the following is the correct way to create an empty list in Python?
Q10
In Python, how can you copy the elements of one list into another?
Q11
What is the output of the following code: my_list = [1, 2, 3] my_list.insert(1, 4) print(my_list)
-
A
-
B
-
C
-
D
Q12
Which method is used to remove the last element from a list?
Q13
In Python, how can you join two or more lists together?
Q14
What is the purpose of the clear() method for lists?
Q15
How can you add an element at the end of a list in Python?
Q16
What will be the output of the following code: my_list = [3, 1, 2] my_list.sort() print(my_list)
Q17
What does the len() function do when applied to a list?
Q18
What will the following code output: my_list = [1, 2, 3] new_list = my_list.copy() print(new_list)
-
A
-
B
-
C
-
D
Q19
In Python, how can you check if an element exists in a list?
Q20
What is the output of the following code: my_list = [1, 2, 3, 4] my_list.remove(2) print(my_list)
Q21
In Python, how can you find the index of a specific element in a list?
Q22
Which method is used to remove the first occurrence of a specific element in a list?
Q23
In Python, how can you extend a list by adding elements from another iterable?
Q24
What is the output of the following code: my_list = [1, 2, 3] my_list.append(4) print(my_list)
Q25
What is the output of the following code: my_list = [1, 2, 3, 4, 5] print(my_list[1:4])