Topic: Chapter 9: Lists, Tuples, Sets and Dictionary (Test 1)



Topic: Chapter 9: Lists, Tuples, Sets and Dictionary
Q.1
Pick odd one in connection with collection data type
A. List
B. Tuple
C. Dictionary
D. Loop
Answer : Option D
Explaination / Solution:
No Explaination.


Workspace
Report
Q.2
Let list1=[2,4,6,8,10], then print(List1[-2]) will result in
A. 10
B. 8
C. 4
D. 6
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report
Q.3
Which of the following function is used to count the number of elements in a list?
A. count()
B. find()
C. len()
D. index()
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.4
If List=[10,20,30,40,50] then List[2]=35 will result
A. [35,10,20,30,40,50]
B. [10,20,30,40,50,35]
C. [10,20,35,40,50]
D. [10,35,30,40,50]
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.5
If List=[17,23,41,10] then List.append(32) will result
A. [32,17,23,41,10]
B. [17,23,41,10,32]
C. [10,17,23,32,41]
D. [41,32,23,17,10]
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report
Q.6
Which of the following Python function can be used to add more than one element within an existing list?
A. append()
B. append_more()
C. extend()
D. more()
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.7
What will be the result of the following Python code? S=[x**2 for x in range(5)] print(S)
A. [0,1,2,4,5]
B. [0,1,4,9,16]
C. [0,1,4,9,16,25]
D. [1,4,9,16,25]
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report
Q.8
What is the use of type() function in python?
A. To create a Tuple
B. To know the type of an element in tuple.
C. To know the data type of python object.
D. To create a list.
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.9
Which of the following statement is not correct?
A. A list is mutable
B. A tuple is immutable.
C. The append() function is used to add an element.
D. The extend() function is used in tuple to add elements in a list.
Answer : Option D
Explaination / Solution:
No Explaination.


Workspace
Report
Q.10
Let setA={3,6,9}, setB={1,3,9}. What will be the result of the following snippet? print(setA|setB)
A. {3,6,9,1,3,9}
B. {3,9}
C. {1}
D. {1,3,6,9}
Answer : Option D
Explaination / Solution:
No Explaination.


Workspace
Report