ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
Python MCQ Practice Questions SET 6
2
3
Sr. No.QuestionOption 1Option 2Option 3Option 4Correct Option
4
51What character is used to format strings directly within the print statement in Python?$%#{}D
5
52Which method of the list data type is used to add an element at the end of the list in Python?append()extend()insert()pop()A
6
53What is the purpose of the insert() method in Python lists?To remove an element from the listTo add an element at a specific position in the listTo add an element at the end of the listTo remove the last element from the listB
7
54Which method is used to remove the first occurrence of a specified element from a list in Python?append()extend()remove()pop()C
8
55What does the pop() method do in Python lists?Adds an element to the end of the listRemoves the last element from the listRemoves the first element from the listAdds an element at a specific position in the listB
9
56Which method is used to sort the elements of a list in ascending order in Python?sort()reverse()clear()count()A
10
57my_set=set([1,2,2,3,3,4,5,6,7,8,9,9,9])
print(my_set) what will be the output of given code
{1, 2, 2,3,3, 4, 5, 6, 7, 8, 9,9,9}{1, 2, 3, 4, 5, 6, 7, 8, 9}{1, 2, 2,3,3, 4, 5, 6, 7, 8, 9,9,}{1, 2, 2,3, 4, 5, 6, 7, 8, 9,9,9}B
11
58What is the purpose of the reverse() method in Python lists?To remove all elements from the listTo count the occurrences of a specified element in the listTo reverse the order of elements in the listTo add an element at the end of the listC
12
59Which method is used to remove all elements from a list in Python?remove()clear()reverse()sort()B
13
60What method is used to find the index of the first occurrence of a specified element in a list in Python?index()count()sort()append()A
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100