Python for Data Science Week 1 NPTEL Assignment Solution
byNavin Kumar-
0
1. What is the output of the following code?
(A) 36
(B) 121212
(C) 123
(D) Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’
2.What is the output of the following code?
(A) 1
(B) -2
(C) -1.28
(D) 1.28
3. Consider a following code snippet. What is a data type of y?
(A) int
(B) float
(C) str
(D) Code will throw an error
4. Which of the following variable names are INVALID in Python?
(A) 1_variable
(B) variable_1
(C) variable1
(D) variable#
5. While naming the variable, use of any special character other than underscore(_) will throw which type of error?
(A) Syntax error
(B) Key error
(C) Value error
(D) Index error
6. Let x = “Mayur”. Which of the following commands converts the ‘x’ to float datatype?
(A) str(float,x)
(B) x.float()
(C) float(x)
(D) Cannot convert a string to float data type
7. Which Python library is commonly used for data wrangling and manipulation?
(A) Numpy
(B) Pandas
(C) scikit
(D) Math
8. Predict the output of the following code.
(A) 12.0
(B) 12
(C) 11.667
(D) 11
9. Given two variables, j = 6 and g = 3.3. If both normal division and floor division operators were used to divide j by g, what would be the data type of the value obtained from the operations?
(A) int, int
(B) float, float
(C) float, int
(D) int, float
10. Let a = 5 (101 in binary) and b = 3 (011 in binary). What is the result of the following operation?