NPTEL Python for Data Science Week 2 Assignment Answers 2025
1. Which of the following object does not support indexing?
- tuple
- list
- dictionary
- set
Answer :- For Answers Click Here
2. How can you concatenate the strings “data” and “science” with a hyphen(-) between them?
- “data”.join(“science”)
- “-”.join([“data”, “science”])
- “data” + “-” + “science”
- None of the above.
Answer :-
3. What will be the output of the following code snippet?

- [[ 5 12]
[21 32]] - [[19 22]
[43 50]] - [[3 8]
[35 56]] - [[ 5 21]
[12 32]]
Answer :-
4. What will be the output of the following code snippet?

- [ 1 10 3 4 5 6 7 8 9 10]
- [ 10 1 2 3 4 5 6 7 8 9]
- [ 0 10 2 3 4 5 6 7 8 9]
- [ 10 2 3 4 5 6 7 8 9 ]
Answer :-
5. What is the output of the following code?

- [2, 3, 4, 5]
- [0, 1, 2, 3]
- [1, 2, 3, 4]
- Will throw an error: Set objects are not iterable.
Answer :-
6. What will be the output of the following code snippet?

- {27.5}
- {1, ‘four ‘, 3.0, 3, 5, ‘two ‘, 10, 27.5}
- {1, ‘four ‘, 3.0, 5, ‘two ‘, 10, 27.5}
- {1, ‘four ‘, 3.0, 5, ‘two ‘, 3}
Answer :- For Answers Click Here
7. Let t1 = (1, 2, “tuple”, 4) and t2 = (5, 6, 7). Which of the following will not give any error after the execution?
- t1.append(5)
- x = t2[t1[1]]
- t3 = t1 + t2
- t3 = (t1, t2)
- t3 = (list(t1), list(t2))
Answer :-
8. Let d = {1 : “Pyhton”, 2 : [1, 2, 3]}. Which among the following will not give the error after the execution?
- d[2].append(4)
- x = d[0]
- d[“one”] = 1
- d.update({‘one’ : 2})
Answer :-
9. Which of the following data type is immutable?
- list
- set
- tuple
- dictionary
Answer :-
10. student = {‘name’: ‘Jane’, ‘age’: 25, ‘courses’: [‘Math’, ‘Statistics’]}
Which among the following will return
{‘name’: ‘Jane’, ‘age’: 26, ‘courses’: [‘Math’, ‘Statistics’], ‘phone’: ‘123-456’}
- student.update({‘age’ : 26})
- student.update({‘age’ : 26, ‘phone’: ‘123-456’})
- student[‘phone’] = ‘123-456’
student.update({‘age’ : 26}) - None of the above
Answer :-
11. What is the output of the following code?

- [‘M’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’]
- [‘m’, ‘a’, ‘h’, ‘e’, ‘s’, ‘h’]
- [‘M’, ‘a’, ‘h’, ‘e’, ‘s’, ‘h’]
- [‘m’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’]
Answer :-
12. What will be the output of the following code snippet?

- [[1 2 3 4 5]
[3 4 5 6 7]
[5 6 7 8 9]] - [[1 2 3 4]
[3 4 5 6]
[5 6 7 8]] - [[2 3 4]
[4 5 6]
[6 7 8]] - None of the above
Answer :- For Answers Click Here