Assesment - Basic Python - MCQ - 40 Questions
Assesment - Basic Python - MCQ - 40 Questions
MCQ
d) Niene Stom
d) .p
a) Indentation
b) Key
c) Brackets
d) All of the mentioned
break
print(i)
i+=1
a) 1 2 3
b) error
c) 1 2
d) none of the mentioned
9. Python supports the creation of anonymous functions at runtime, using a construct called
__________
a) pi
b) anonymous
c) lambda
d) none of the mentioned
10. What is the order of precedence in python?
d) sqrt()
d) False
b) 6
c) 4
d) 3
c) [5, 6, 7]
d) [2, 4, 6]
20. How many elements will be there in the series named "S1"?
S1 = pd.Series(range(5))
print(S1)
a) 5
b) 4
c) 6
d) None of the above
Columns: []
Index: []
c) Empty DataFrame
Columns: [tech, fees]
Index: []
d) None of the above
22. Which argument keyword can be used to emphasize each point with a specified marker in
plotting?
a) marker_points
b) marker
c) ring
d) types
24. What is the purpose of using the ** symbol in function argument unpacking?
a) It allows a tuple of arguments to be passed
b) It allows a list of arguments to be passed
print(min(101*99, 102*98))
a) 9997
b) 9999
c) 9996
d) None of the above
b = np.array([4, 5, 6])
c=a+b
print(c)
a) [1, 2, 3, 4, 5, 6]
b) [[1, 4], [2, 5], [3, 6]]
c) [5, 7, 9]
d) Error
d) Error
28. How to select column number 2, 3 and 5 from the dataframe named df?
a) df.iloc[[2,3,5]]
b) df.iloc[2,3,5]
c) df.iloc[[2:5:2]]
d) subpyplot()
c) scatters()
d) scatter()
a) print(list1[2:])
b) print(list1[:2])
c) print(list1[:-2])
d) all of the mentioned
34. Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?
a) Error
b) None
c) 25
d) 2
35. Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
a) [2, 33, 222, 14]
b) Error
c) 25
if ls[0] == 'Alice':
sum += 1
if ls[1] == 'Bob':
sum += 10
print sum
a) 11
b) 12
c) 21
d) 22
b) [0, 1, 2, 3, 4]
c) [0.0, 0.5, 1.0, 1.5]
d) [0.0, 0.5, 1.0, 1.5, 2.0]
c) Error
d) None
a) list1.add(5)
b) list1.append(5)
c) list1.addLast(5)
d) list1.addEnd(5)