Python for Data Science | NPTEL | Week 2 Answers

This set of MCQ(multiple choice questions) focuses on the Python for Data Science NPTEL Week 2 Answers

You should practice these questions to improve fundamentals of Data Science needed for various interviews (like company interview, campus interview, walk-in interview), entrance exams, placements and other competitive exams. All the questions in this particular section are based on only “Python for Data Science NPTEL Week 2 Answers“.

Course layout

Week 1: Basics of Python Spyder
Week 2: Sequence data types & associated operations
Week 3: Data frames
Week 4: Case study

NOTE: You can check your answer immediately by clicking show answer button. Moreover, this set of “Python for Data Science NPTEL Week 2 Answers” contains 10 questions.

Now, start attempting the quiz.

Python for Data Science NPTEL Week 2 Answers

Q1. Consider a variable job = “chemist”. Which of the following expressions will retrieve the last character from the variable value?

a) job[7]
b) job[len(job) – 1]
c) job[5:6]
d) job[- 1]
e) All of the above statements are true

Answer: b), d)

Q2. Which of the following expressions should be used to assign the variable get_num to get the final print statement output as value 75 from the below tuple?

nst_tup = ("System", (60, 75, 45), (15, 3, 12))
get_num =
print(get_num)

a) nst_tup[1][2]
b) nst_tup[1:2][1]
c) nst_tup[1][1]
d) nst_tup[1:2](1)
e) None of the above

Answer: c) nst_tup[1][1]

Q3. What would be the output for the following set of statements?

new_list = [13, 23, 18, 64, 51]
new_list[4] = True
print(new_list)

a) [13, 23, 18, 64, 51, “True”]
b) [13, 23, 18, 64, True]
c) [13, 23, 18, 64, 51, True]
d) Index Error

Answer: b) [13, 23, 18, 64, True]

Q4. What result does the final statement print?

scores = (12, 25, 32, 39, 44)
f_score, *bw_s, l_score = scores
print("Output is :", f_score, "and", bw_s, "and", l_score)

a) Output is: 12, (25, 32, 39), 44
b) Output is: 12 and (25, 32, 39) and 44
c) Output is: 12 and 25 and 39
d) ValueError: Too many values to unpack
e) Output is: 12 and [25, 32, 39] and 44

Answer: e) Output is: 12 and [25, 32, 39] and 44

Python for Data Science NPTEL Week 2 Answers

Q5. When the following set of instructions are executed, how many times does the vowel “e” appear in the result?

word = "occurrence"
for ltr in range(len(word)):
    if ltr % 3 == 0:
        print(word[ltr])

a) 1
b) “e” is not printed
c) 2
d) 4
e) None of the above

Answer: c) 2

Q6. Which of the following options, when executed, will result in a tuple?

a) t = (2,2)
b) y =[‘h’,’4′,’3′]
c) r = (‘v’,)
d) s = (‘w’)
e) All except b

Answer: a), c)

Q7. Which statement/ statements will result in an empty data structure?

a) dict1 = {}
b) tup1 = ()
c) st1 = set()
d) toy = “baseball”
gt_str = toy[2:2]
print(“Output:”, gt_str)
e) All of the above

Answer: e) All of the above

Python for Data Science NPTEL Week 2 Answers

Q8. Consider a dictionary city created with the following keys and values.

city = {'Delhi':3, 'Bengaluru':5, 'Chennai':4, 'Kolkata':6, 'Mumbai':7}

Through which all possible way / ways can we access the value 5 from the dictionary city?

a) city[‘Bengaluru’]
b) city.get[‘Bengaluru’]
c) city.values()[1]
d) list(city.values())[1]
e) None of the above

Answer: a), d)

Q9. Count the number of elements in the below list.

list_tens = [["October", 24, ["2021"]]]

a) 2
b) 1
c) 3
d) 0
e) None of the above

Answer: b) 1

Q10. A data structure is defined as celebrate = set(‘Nativity Day’). What are the possible outputs if celebrate is printed?

1. {‘v’, ‘N’, ‘t’, ‘i’, ‘y’, ‘a’, ‘D’}
2. {‘v’, ‘N’, ‘t’, ‘I’, ‘y’, ‘a’, ‘D’, ‘ ‘}
3. {‘v’, ‘N’, ‘t’, ‘i’, ‘y’, ‘a’, ‘D’, ‘ ‘}
4. {‘v’, ‘t’, ‘i’, ‘y’, ‘a’, ‘D’, ‘ ‘, ‘N’}

a) 1
b) 1 and 3
c) 1, 2, 3
d) 3 and 4
e) All are correct

Answer: d) 3 and 4

Python for Data Science NPTEL Week 2 Answers

<< Prev- Python for Data Science Week 1 Assignment Solutions

>> Next- Python for Data Science Week 3 Assignment Solutions


Programming in Java NPTEL week 1 quiz answers

Nptel – Deep Learning assignment solutions

The above question set contains all the correct answers. But in any case, you find any typographical, grammatical or any other error in our site then kindly inform us. Don’t forget to provide the appropriate URL along with error description. So that we can easily correct it.

Thanks in advance.

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.

Leave a Comment

Your email address will not be published. Required fields are marked *