NPTEL Python For Data Science Week 2 Assignment Answers 2024

admin
By admin

NPTEL Python For Data Science Week 2 Assignment Answers 2024

1. Which of the following object does not support indexing?

  • tuple
  • list
  • dictionary
  • set
Answer :- d

2. Given a NumPy array, arr = np.array([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]), what is the output of the command, print(arr[0][1])?

image 104
Answer :- c

3. What is the output of the following code?

2.1
  • [2, 3, 4, 5]
  • [0 1 2 3]
  • [1, 2, 3, 4]
  • Will throw an error: Set objects are not iterable.
Answer :- For Answers Click Here

4. What is the output of the following code?

2.2
image 105
Answer :- For Answers Click Here

5. Which of the following code gives output My friend’s house is in Chennai?

image 106
Answer :- 

6. Let t1 = (1, 2, “tuple”, 4) and t2 = (5, 6, 7). Which of the following will not give any error after the execution?

  • t.append(5)
  • x=t2[t1[1]]
  • t3=t1+t2
  • t3=(t1,t2)
  • t3=(list(t1),list(t2))
Answer :- For Answers Click Here

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

8. Which of the following data type is immutable?

  • list
  • set
  • tuple
  • dictionary
Answer :- 

9. 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 :- 

10. What is the output of the following code?

2.7
  • [‘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 :- For Answers Click Here
Share This Article
Leave a comment