Python for Data Science NPTEL Assignment 1

                     

Python for Data Science NPTEL Assignment 1

Link to Enroll : Click Here

Q1. What is the output of the following code?

num1 = 12
num2 "58"
print(num1 + num2)

a.12

b.58

c.70

d.Error: Invalid operation, unsupported operator ‘+’ used between ‘int’ and ‘str’

Answer:- d


2. 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


3. Let a = 5 (101 in binary) and b = 3 (011 in binary). Which of the following operations results in the values 7 and 1?

Answer:- b


NPTEL Python for Data Science Assignment 1 Answers

4. State whether the given statement is True or False.

When using the floor division operator (//), if the result is negative, then the result is rounded off to the next largest integer.

a. True
b. False

Answer:- b


5. Let x = “50”. 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 datatype

Answer:- c


6. Which of the following variable names are INVALID in Python?

a. 1_variable
b. variable_1
c. variable_*
d. variable1

Answer:- a, c


7. Which of the following variable assignments would throw an error?

a. var1=True; var2=False;
b. var1=false; var2=true;
c. var1=’True’; var2=’False’;
d. var1=’true’; var2=’false’;

Answer:- b


NPTEL Python for Data Science Assignment 1 Answers

8. Predict the output of the following code

x=4
y-11
p 5.0
ans=x**(y % p)
print(ans)

a. 4
b. 4.0
c. 5
d. 4.1

Answer:- b


9. The value of the variable result after running the code snippet below is ____

num-20.5
z-3
result-2+:*3+num/lz
print(result)

a. 89.0

b. 17.0

c. 737.0

d. 96.0

Answer:- b


10. Which Python library is commonly used for data wrangling and manipulation?

a. Numpy
b. Pandas
c. scikit
d. Math

Answer:- b


More from NPTEL : Click Here

* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first.