This set of MCQ(multiple choice questions) focuses on the Python for Data Science NPTEL Week 1 Assignment 1 Solutions.
You should practice these questions to improve fundamentals of Data Science needed for various interviews (like company interview, campus interview, walk-in interview), entrance exams, placements and other competitive exams. All the questions in this particular section are based on only “Python for Data Science NPTEL Week 1 Assignment 1 Solutions“.
Course layout
Week 1: Basics of Python Spyder
Week 2: Sequence data types & associated operations
Week 3: Data frames
Week 4: Case study
NOTE: You can check your answer immediately by clicking show answer button. Moreover, this set of “Python for Data Science NPTEL Week 1 Assignment 1 Solution” contains 10 questions.
Now, start attempting the quiz.
Python for Data Science NPTEL Week 1 Assignment
Q1. What is the output of the following code?
a = 3
b = “12”
print(a*b)
a) 36
b) 121212
c) 123
d) Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’
Answer: b)
Q2. What is the output of the following code?
a = -9//7
print(a)
a) -1
b) -2
c) -1.28
d) 1.28
Answer: b)
Q3. Consider a following code snippet. What is a data type of y?
x = 15
y = str(float(x))
a) int
b) float
c) str
d) Code will throw an error
Answer: c)
Q4. Which of the following variable names are INVALID in Python?
a) 1 variable
b) variable 1
c) variable1
d) variable#
Answer: a), d)
Q5. 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
Answer: a)
Q6. Let x = “Mayur”. Which of the following commands converts the ‘x’ to float datatype?
a) str(float.x)
b) x.float(x)
c) float(x)
d) Cannot convert a string to float data type
Answer: d)
Q7. Which Python library is commonly used for data wrangling and manipulation?
a) Numpy
b) Pandas
c) scikit
d) Math
Answer: b)
Q8. Predict the output of the following code.
x = 10
y = 5
z = 3
ans = X + y % z
print(ans)
a) 12.0
b) 12
c) 11.667
d) 11
Answer: b)
Q9. 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
Answer: b)
Q10. Let a = 5 (101 in binary) and b = 3 (011 in binary). What is the result of the following operation?
a = 5
b = 3
print(a & b)
a) 3
b) 7
c) 5
d) 1
Answer: d)
Python for Data Science NPTEL Week 1 Assignment 1 Solutions
Q1. Which of the arithmetic operations given below cannot be used with ‘strings’ in Python?
a) *
b) –
c) +
d) All of the above
Answer: b) –
Q2. When the following statement is executed, what type of error is obtained?
var@check1 = 10
a) Type Error
b) Syntax Error
c) Value Error
d) None of the above
Answer: b) Syntax Error
Q3. Two variables X and Y were assigned the following values initially. X = 3 and Y = 6. Which of the following statements will help swap the values between these two variables?
a) Y = X, X = Y
b) X = Y
c) X = Y, Y = X
d) X, Y = Y, X
Answer: d) X, Y = Y, X
Q4. From the following set of statements, what will be the value of variable y in the final print statement?
y = 1**2**3**2
print(“Variable y:”, y)
a) 8
b) 9
c) 1
d) Error
e) 16
Answer: c) 1
Q5. Consider j = 5 and k = 11. We change the values from j = 7 and k remains constant.
What is print(j|k) before and after modification of value in variable j?
a) 3, 15
b) 15, 15
c) 11, 15
d) 15, 7
e) None of the above
Answer: b) 15, 15
Q6. What would be the output of the following statements?
log_exp = not not True and False or not False
print(log_exp)
a) False
b) True
c) Not True
d) None of the above
Answer: b) True
Q7. What does k = 4%7 evaluate to and what is the type of variable k?
a) 4, int
b) 0.0, float
c) 0, int
d) 1, int
e) None of the above
Answer: a) 4, int
Q8. j = 6 and g = 3.3. If normal division and floor division was done between j and k, what would be the type of the resultant variable?
a) int ,int
b) float, float
c) float, int
d) int, float
e) None of the above
Answer: b) float, float
Q9. Consider two answers to a question; answer1 and answer2. What is the output of the following set of statements?
answer1 = True
answer2 = False
print(answer1 * answer2)
a) True
b) False
c) 0
d) 1
Answer: c) 0
Q10. Consider the list of instructions and resulting outputs given below. Pick the set that is incorrect.
1. print("Good", end = "")
print("Day")
Output -> GoodDay
2. word1 = "Trial"
print("Word is %s" %word1)
Output -> Trial
3. num1 = 23
print(" Number: %f" %num1)
Output -> Number: 23.000000
4. print("ready\nsteady\ngo")
Output -> ready
steady
go
a) 4
b) 2
c) 1, 3, 4
d) 3, 4
e) All are correct
Answer: b) 2
>> Next- Python for Data Science Week 2 Assignment Solutions
Programming in Java NPTEL week 1 quiz answers
Nptel – Deep Learning assignment solutions
The above question set contains all the correct answers. But in any case, you find any typographical, grammatical or any other error in our site then kindly inform us. Don’t forget to provide the appropriate URL along with error description. So that we can easily correct it.
Thanks in advance.
For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.