Python for Data Science NPTEL Week 1 Assignment Answers
Are you looking for Python for Data Science NPTEL Week 1 Assignment Answers? You are here at right place for Week 1 assignment answers
Table of Contents

Python for Data Science NPTEL Week 1 Assignment Answers (July-Dec 2025)
Que.1 Which of the following variable names are INVALID in Python?
A) 1_variable
B) variable_1
C) variable1
D) variable#
Que.2 Which of the following operators have lower precedence than “not” in Python?
A) +
B) and
C) ==
D) |
Que.3 What will be the output of the following code?
a = 10
b = 5
print(a ** b % 3)
A) 0
B) 100
C) 1
D) 2
Que.4 What will be the output of the following code snippet?
greetings = "Namaste"
greetings_1 = float(greetings)
print(type(greetings_1))
A) int
B) float
C) str
D) Code will throw an error.
Que.5 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
Que.6 What will be the output of the following code snippet?
a = "10"
b = float(a) + 5
result = str(b) + "123"
print(type(result))
A) <class ‘float’>
B) <class ‘str’>
C) <class ‘int’>
D) The code will give an error.
Que.7 What will be the output of the following code snippet?
a = 15
b = 3
c = 4
result = a + b * c // (c % b) - 5
print(result)
A) 20
B) 1
C) 22
D) 0
Que.8 What is the output of the following code snippet?
a = 4
b = 5
a *= b * 2
print(a)
A) 10
B) 20
C) 25
D) 40
Que.9 What is the output of the following code snippet?
a = 3
b = 5
c = (a == 3) and (b == 5) or (a != 3)
print(c)
A) True
B) False
C) Error
D) None of the above
Que.10 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
Python for Data Science NPTEL Week 1 Assignment Answers (Jan-Apr 2025)
Course Link: Click Here
1. Which of the following variable names are INVALID in Python?
- (a) I variable
- (b) variable I
- (c) variable1
- (d) variable#
2. Which of the following operators have lower precedence than “not” in Python?
- (a) and
- (b) or
3. What will be the output of the following code?
a = 10
b = 10
print(a b % 3)
- (a) 0
- (b) 100
- (c) 1
- (d) 2
4. What will be the output of the following code snippet?
greetings = "Namaste"
greetings_1 = float(greetings)
print(type(greetings_1))
- (a) int
- (b) float
- (c) str
- (d) Code will throw an error.
5. Given 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
6. What will be the output of the following code snippet?
result = 12 // 3
print(type(result))
- (a) class ‘float’
- (b) class ‘str’
- (c) The code will give an error.
7. What will be the output of the following code snippet?
result = 5 + 15
print(result)
- (a) 20
- (b) 1
- (c) 22
- (d) 0
8. What is the output of the following code snippet?
a = 5 * 5
print(a)
- (a) 10
- (b) 20
- (c) 25
- (d) 40
9. What is the output of the following code snippet?
c = (a == 3) and (b > 2)
print(c)
- (a) True
- (b) False
- (c) Error
10. Let a = 5 (101 in binary) and b = 3 (011 in binary). What is the result of the following operation?
print(a & b)
- (a) 3
- (b) 7
- (c) 5
- (d) 1
Python for Data Science NPTEL Week 1 Assignment Answers (Jul-Dec 2024)
Course Link: Click Here
Q1. What is the output of the following code?
36
121212
123
Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’
Answer: 121212
Q2. What is the output of the following code?
-1
-2
-1.28
1.28
Answer: -2
Q3. Consider a following code snippet. What is a data type of y?
int
float
str
Code will throw an error.
Answer: str
For answers or latest updates join our telegram channel: Click here to join
Q4. Which of the following variable names are INVALID in Python?
1_variable
variable_1
variable1
variable#
Answer: [A, D] 1_variable, variable#
These are Python for Data Science NPTEL Week 1 Assignment Answers
Q5. While naming the variable, use of any special character other than underscore(_) ill throw which type of error?
Syntax error
Key error
Value error
Index error
Answer: Syntax error
Q6. Let x = “Mayur”. Which of the following commands converts the ‘x’ to float datatype?
str(float,x)
x.float()
float(x)
Cannot convert a string to float data type
Answer: Cannot convert a string to float data type
For answers or latest updates join our telegram channel: Click here to join
These are Python for Data Science NPTEL Week 1 Assignment Answers
Q7. Which Python library is commonly used for data wrangling and manipulation?
Numpy
Pandas
scikit
Math
Answer: Pandas
Q8. Predict the output of the following code.
12.0
12
11.667
11
Answer: 12
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?
int, int
float, float
float, int
int, float
Answer: float, float
Q10. Let a = 5 (101 in binary) and b = 3 (011 in binary). What is the result of the following operation?
3
7
5
1
Answer: 1
These are Python for Data Science NPTEL Week 1 Assignment Answers
More Weeks of Python for Data Science: Click here
More Nptel Courses: Click here
Python for Data Science NPTEL Week 1 Assignment Answers (Jan-Apr 2023)
Course Link: Click Here
Q1. Which of the following is/are the correct ways of naming variables in Python?
a. 2_max = 5
b. max_2 = 5
c. max2 = 5
d. max @2 = 5
Answer: b, c
Q2. What does 5%11 will evaluate to
a. 1
b. 5
c. 0
d. Syntax error
Answer: b. 5
Q3. What does 4//7 evaluate to
a. 0
b. 1
c. 0.0
d. 4
Answer: a. 0
These are Python for Data Science NPTEL Week 1 Assignment Answers
Q4. What will be the output of the following code snippet?
a. 300
b. 100200
c. ‘100’ + ‘200’
d. ‘100 + 200’
Answer: b. 100200
Q5. What will be the output of the following code snippet?
a. 300
b. 100200
c. ‘100’ + ‘200’
d. ‘100 + 200’
Answer: a. 300
Q6. What is the type of the following expression?
1 + 4 / 2
a. int
b. float
c. bool
d. str
Answer: b. float
These are Python for Data Science NPTEL Week 1 Assignment Answers
Q7. What is the type of the following expression?
[1] (1 > 0) and (-1 < 0) and (1 == 1)
a. str
b. bool
c. True
d. False
Answer: c. True
Q8. What is the output of the following code snippet?
a. 32
b. 44
c. 40
d. 36
Answer: c. 40
Q9. Which of the arithmetic operators given below cannot be used with ‘strings’ in Python?
a. *
b. –
c. +
d. All of the above
Answer: b. –
Q10. Consider the list of instructions and resulting outputs given below. Pick the set that is incorrect.
a. 4
b. 2
c. 1, 3
d. 1, 3, 4
e. All are correct
Answer: b. 2
Q11. Two variables Xand 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
These are Python for Data Science NPTEL Week 1 Assignment Answers
Python for Data Science NPTEL Week 1 Assignment Answers (Jul-Dec 2022)
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
These are Python for Data Science NPTEL Week 1 Assignment 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
These are Python for Data Science NPTEL Week 1 Assignment Answers
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
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
These are Python for Data Science NPTEL Week 1 Assignment Answers
More Weeks of Python for Data Science: Click here
More Nptel Courses: Click here







