NPTEL Python for Data Science Week 1 Assignment Answers 2025
1. Which of the following variable names are INVALID in Python?
- 1_variable
- variable_1
- variable1
- variable#
Answer :- a, d
2. Which of the following operators have lower precedence than “not” in Python?
- +
- and
- ==
- |
Answer :- b
📚 Did you know that 60-80% of the questions in the final exam are often repeated from previous years? 🎯 Boost your chances of success by exploring answers for NPTEL courses from past years on Answer GPT! 👇👇👇👇
3. What will be the output of the following code?
a = 10
b = 5
p r i n t ( a ∗∗ b % 3 )
- 0
- 100
- 1
- 2
Answer :- For Answer Click Here
4. What will be the output of the following code snippet?
g r e e t i n g s = ”Namaste”
g r e e t i n g s_1 = f l o a t ( g r e e t i n g s )
p r i n t ( type ( g r e e t i n g s_1 ) )
- int
- float
- str
- Code will throw an error.
Answer :-
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?
- int, int
- float, float
- float, int
- int, float
Answer :-
6. What will be the output of the following code snippet?
a = ”10”
b = f l o a t ( a ) + 5
r e s u l t = s t r ( b ) + ”123”
p r i n t ( type ( r e s u l t ) )
- <c l a s s ’ f l o a t ’>
- <c l a s s ’ s t r ’>
- <c l a s s ’ i n t ’>
- The code will give an error.
Answer :- For Answer Click Here
7. What will be the output of the following code snippet?
a = 15
b = 3
c = 4
r e s u l t = a + b ∗ c // ( c % b ) − 5
p r i n t ( r e s u l t )
- 20
- 1
- 22
- 0
Answer :-
8. What is the output of the following code snippet?
a = 4
b = 5
a ∗= b ∗ 2
p r i n t ( a )
- 10
- 20
- 25
- 40
Answer :-
9. What is the output of the following code snippet?
a = 3
b = 5
c = ( a == 3 ) and ( b == 5 ) o r ( a != 3 )
p r i n t ( c )
- True
- False
- Error
Answer :-
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
p r i n t ( a & b )
- 3
- 7
- 5
- 1
Answer :- For Answer Click Here
2024 Week 1 : NPTEL Python for Data Science Assignment Answers
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
Q4. Which of the following variable names are INVALID in Python?
1 variable
variable 1
variable1
variable#
Answer:- 1_variable, variable#
Q5. While naming the variable, use of any special character other than underscore(_) will 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
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
Week 1 2024 Python for Data Science Assignment Answers
Q1. What is the output of the following code?

- 36
- 121212
- 123
- Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’
Answer:- b
Q2. What is the output of the following code?

- -1
- -2
- -1.28
- 1.28
Answer:- b
Q3. Consider a following code snippet. What is a data type of y?

- int
- float
- str
- Code will throw an error
Answer:- c
Q4 Which of the following variable names are INVALID in Python?
- 1_variable
- variable_1
- variable1
- variable#
Answer:- a d
Q5. While naming the variable, use of any special character other than underscore(_) will throw which type of error?
- Syntax error
- Key error
- Value error
- Index error
Answer:- a
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:- d
Q7. Which Python library is commonly used for data wrangling and manipulation?
- Numpy
- Pandas
- scikit
- Math
Answer:- b
Q8. Predict the output of the following code.

- 12.0
- 12
- 11.667
- 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?
- int, int
- float, float
- float, int
- 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?

- 3
- 7
- 5
- 1
Answer:- d