Python For Data Science
Python For Data Science
unit=16&assessment=141
Answer Submitted.
X
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
Week 0 () 1/6
1/4
Python Setup
Yes, the answer is correct.
Guide (unit?
Score: 1
unit=16&lesson
Accepted Answers:
=17)
7 / 24
Practice: Week
2) A manufacturing company is set up in two different locations. If the number of 1 point
0: Assignment
employees in one location are 663, and the average monthly salary for their employees is $13454,
0
(assessment? and the number of employees in the other location are 504, and the average monthly salary for their
name=141) employees is $17591. Find the combined arithmetic mean of the monthly salary?
Week 1 () $15804.33
$15522.5
Week 2 () $15240.67
None of these
Week 3 ()
Yes, the answer is correct.
Score: 1
1 of 5 04-09-2024, 12:54 pm
Python for Data Science - - Unit 3 - Week 0 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=16&assessment=141
Accepted Answers:
Week 4 () $15240.67
Supporting 3) Given 2 samples, Sample 1 = [13.3, 2.4, 10, 13.3, 11] and Sample 2 = [8.5, 7.1, 12.6, 1 point
material for 11.5, 10.3]. Find the sample which has a relatively greater spread of values from the mean?
Week 4 ()
Sample 1
Sample 2
Download
Videos () Both the samples are equally spread
None of these
Books ()
Yes, the answer is correct.
Score: 1
Text Accepted Answers:
Transcripts () Sample 1
4) Given below is tabular data on a test conducted recently to detect a new mutant of the 1 point
Problem
coronavirus.
Solving
Session -
July 2024 ()
Find the number of people who have not actually contracted the virus yet have been tested
positive?
138
227
284
173
5) Given a pie chart that indicates the expenditure of a manufacturing organization 1 point
towards various activities, what is the ratio of expenditure for the R & D department to the Marketing
department?
2 of 5 04-09-2024, 12:54 pm
Python for Data Science - - Unit 3 - Week 0 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=16&assessment=141
1 : 1.54
1 : 0.65
1 : 0.44
None of these
6) Ben is the customer relation manager at a hotel. Recently, Ben has been receiving 1 point
customer feedback saying that the customers had to wait too long to be served by a customer
service representative. Ben decides to note down the customer's waiting time in minutes. What kind
of graph would be appropriate to check the frequency distributions of customers' waiting time?
Line plot
Bar plot
Histogram
Scatter plot
3 of 5 04-09-2024, 12:54 pm
Python for Data Science - - Unit 3 - Week 0 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=16&assessment=141
7) 3 natural numbers are chosen at random. What is the probability that their product 1 point
yields an odd number?
1/8
1/6
2/3
1/2
n!
(n / 2) + 1
(n + 1) / 2
n2
9) 128 players are participating in a knockout tournament. How many games are required 1 point
to decide the winner?
Note: In a knockout tournament, whenever two people play, the loser is eliminated and the winner
advances to the next round.
124
127
64
130
10) Given [x1 , x2 , x3 , . . . , xn ] are the possible values of a random variable X, and 1 point
p1 , p2 , p3 , . . . , pn be the corresponding probabilities to each value of the random variable. The
mean is computed by the formula
∑ni=1 pi
∑ni=1 pi xi
∑ni=1 xi
n
4 of 5 04-09-2024, 12:54 pm
Python for Data Science - - Unit 3 - Week 0 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=16&assessment=141
None of these
5 of 5 04-09-2024, 12:54 pm
Python for Data Science
Week 1
(a) 36
(b) 121212
(c) 123
(d) Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’
Answer: (b)
(a) -1
(b) -2
(c) -1.28
(d) 1.28
Answer: (b)
1
3. Consider a following code snippet. What is a data type of y? [1 marks]
(a) int
(b) float
(c) str
(d) Code will throw an error.
Answer: (c)
(a) 1 variable
(b) variable 1
(c) variable1
(d) variable#
Answer: a, d
5. While naming the variable, use of any special character other than underscore( ) will
throw which type of error? [1 mark]
Answer: a
6. Let x = “Mayur”. Which of the following commands converts the ‘x’ to float datatype?
[1 mark]
(a) str(float,x)
(b) x.float()
(c) float(x)
(d) Cannot convert a string to float data type
Answer: d
2
7. Which Python library is commonly used for data wrangling and manipulation? [1
mark]
(a) Numpy
(b) Pandas
(c) scikit
(d) Math
Answer: b
(a) 12.0
(b) 12
(c) 11.667
(d) 11
Answer: b
9. 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? [1 point]
Answer: b
3
10. Let a = 5 (101 in binary) and b = 3 (011 in binary). What is the result of the following
operation? [1 mark]
(a) 3
(b) 7
(c) 5
(d) 1
Answer: d
4
Python for Data Science - - Unit 5 - Week 2 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=30&assessment=143
Answer Submitted.
X
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
1 of 3 04-09-2024, 12:51 pm
Python for Data Science - - Unit 5 - Week 2 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=30&assessment=143
Sequence_data Stationery[0].append('Notebook')
_part_3 (unit?
Stationery[0].insert(0,'Notebook')
unit=30&lesson
=34) Stationery[0][1] = "Notebook"
Stationery[0].extend('Notebook')
Sequence_data
_part_4 (unit? Yes, the answer is correct.
unit=30&lesson Score: 1
=35) Accepted Answers:
Stationery[0].insert(0,'Notebook')
Numpy (unit?
unit=30&lesson 3) The method to clear all the elements from a Set is:- 1 point
=36)
remove( )
Week 2 : discard( )
Lecture slides
clear( )
(unit?
unit=30&lesson delete()
=37)
Yes, the answer is correct.
Score: 1
Week 2 - FAQs
(unit? Accepted Answers:
unit=30&lesson
clear( )
=38) 4) Consider the list, 1 point
Practice: Week
2: Assignment Mylist =[‘a’, ‘a’, ‘b’, ‘b’, ‘b’, ‘c’, ‘c’, ‘d’, ‘e’]
2 (Non
Graded) The output of the code: Mylist.index(‘d’) is
(assessment?
name=143) 7
8
Quiz: Week 2 :
Assignment 2 4
(assessment? 6
name=147)
Yes, the answer is correct.
Week 2: Score: 1
Solution (unit? Accepted Answers:
unit=30&lesson 7
=124)
5) Which of the following python sequence data type is immutable? 1 point
Week 2
Feedback Form list
: Python for dictionary
Data Science tuple
(unit?
array
unit=30&lesson
=114) Yes, the answer is correct.
Score: 1
Week 3 () Accepted Answers:
tuple
Week 4 ()
2 of 3 04-09-2024, 12:51 pm
Python for Data Science - - Unit 5 - Week 2 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=30&assessment=143
Download
Videos ()
Books ()
Text
Transcripts ()
Problem
Solving
Session -
July 2024 ()
3 of 3 04-09-2024, 12:51 pm
Python for Data Science
Week 2
(a) tuple
(b) list
(c) dictionary
(d) 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])?
(a) [[1 2 3]
[4 5 6]
[7 8 9]]
(b) [1 2 3]
(c) [4 5 6]
(d) [7 8 9]
Answer: c
(a) [2, 3, 4, 5]
(b) [0 1 2 3]
1
(c) [1, 2, 3, 4]
(d) Will throw an error: Set objects are not iterable.
Answer: c
2
4. What is the output of the following code? [1 mark]
(a)
3
(b)
(c)
(d)
Answer: c
4
5. Which of the following code gives output My friend’s house is in Chennai? [1
mark]
(a)
(b)
(c)
(d)
Answer: a, d
6. Let t1 = (1, 2, “tuple”, 4) and t2 = (5, 6, 7). Which of the following will not give any
error after the execution? [1 mark]
(a) t1.append(5)
(b) x = t2[t1[1]]
(c) t3 = t1 + t2
(d) t3 = (t1, t2)
(e) t3 = (list(t1), list(t2))
Answer: (b, c, d, e)
7. Let d = {1 : “Pyhton”, 2 : [1, 2, 3]}. Which among the following will not give the error
after the execution? [1 mark]
(a) d[2].append(4)
5
(b) x = d[0]
(c) d[“one”] = 1
(d) d.update({‘one’ : 2})
Answer: (a, c, d)
8. Which of the following data type is immutable? [1 mark]
(a) list
(b) set
(c) tuple
(d) dictionary
Answer: (c)
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’}
(a) student.update({‘age’ : 26})
(b) student.update({‘age’ : 26, ‘phone’: ‘123-456’})
(c) student[‘phone’] = ‘123-456’
student.update({‘age’ : 26})
(d) None of the above
Answer: (b, c)
10. What is the output of the following code? [1 mark]
6
Python for Data Science - - Unit 6 - Week 3 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=41&assessment=144
Answer Submitted.
X
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
1 of 3 04-09-2024, 12:49 pm
Python for Data Science - - Unit 6 - Week 3 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=41&assessment=144
Pandas
Yes, the answer is correct.
Score: 1
Dataframes II
Accepted Answers:
(unit?
Fair
unit=41&lesson
=44) 3) In the churn.csv (https://drive.google.com/open? 1 point
Pandas id=14eJFzce4nMREzCsd4tCTewnFdz6GZAD4) dataframe, what are the total no. of missing values
Dataframes III for the variable TotalCharges?
(unit?
unit=41&lesson
10
=45) 23
15
Control
structures & 5
Functions Yes, the answer is correct.
(unit? Score: 1
unit=41&lesson Accepted Answers:
=46) 15
Exploratory 4) The command used for line plot from the package Matplotlib? 1 point
data analysis
(unit? plot( )
unit=41&lesson line( )
=47)
join( )
Data plt( )
Visualization-
Part I (unit? Yes, the answer is correct.
Score: 1
unit=41&lesson
=48) Accepted Answers:
plot( )
Data
Visualization- 5) The probability of two different events occurring at the same time is known as 1 point
Part II (unit?
Marginal probability
unit=41&lesson
=49) Conditional probability
Joint probability
Dealing with
missing data
Marginal and Joint probability
(unit? Yes, the answer is correct.
unit=41&lesson Score: 1
=50) Accepted Answers:
Joint probability
Datasets (unit?
unit=41&lesson
=51)
Check Answers and Submit
Week 3:
Lecture slides Your score is: 5/5
(unit?
unit=41&lesson
=52)
Week 3 - FAQs
(unit?
unit=41&lesson
2 of 3 04-09-2024, 12:49 pm
Python for Data Science - - Unit 6 - Week 3 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=41&assessment=144
=53)
Practice: Week
3: Assignment
3 (Non
Graded)
(assessment?
name=144)
Week 3
Feedback Form
: Python for
Data Science
(unit?
unit=41&lesson
=115)
Quiz: Week 3 :
Assignment 3
(assessment?
name=151)
Week 4 ()
Supporting
material for
Week 4 ()
Download
Videos ()
Books ()
Text
Transcripts ()
Problem
Solving
Session -
July 2024 ()
3 of 3 04-09-2024, 12:49 pm
Python for Data Science - - Unit 6 - Week 3 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=41&assessment=151
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
Reading data Assume a pandas dataframe df cars which when printed is as shown below. Based on this
(unit? information, answer questions 2 and 3.
unit=41&lesson
=42)
Pandas
Dataframes I
(unit?
unit=41&lesson
=43)
Pandas
1 of 5 04-09-2024, 12:02 pm
Python for Data Science - - Unit 6 - Week 3 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=41&assessment=151
Dataframes II
(unit?
unit=41&lesson
=44)
Pandas
Dataframes III
(unit?
unit=41&lesson
=45)
Control
structures &
Functions
(unit?
unit=41&lesson 2) Of the following set of statements, which of them can be used to extract the column 1 point
=46) Type as a separate dataframe?
Exploratory
df_cars[[‘Type’]]
data analysis
(unit? df_cars.iloc[[:, 1]
unit=41&lesson df_cars.loc[:, [‘Type’]]
=47) None of the above
Data Yes, the answer is correct.
Visualization- Score: 1
Part I (unit? Accepted Answers:
unit=41&lesson df_cars[[‘Type’]]
=48) df_cars.loc[:, [‘Type’]]
Data 3) The method df_cars.describe() will give description of which of the following column? 1 point
Visualization-
Part II (unit? Car name
unit=41&lesson Brand
=49)
Price (in lakhs)
Dealing with All of the above
missing data
(unit? Yes, the answer is correct.
Score: 1
unit=41&lesson
=50) Accepted Answers:
Price (in lakhs)
Datasets (unit?
unit=41&lesson 4) Which pandas function is used to stack the dataframes vertically? 1 point
=51)
pd.merge()
Week 3: pd.concat()
Lecture slides
join()
(unit?
unit=41&lesson
None of the above
=52) Yes, the answer is correct.
Score: 1
Week 3 - FAQs
Accepted Answers:
(unit?
pd.concat()
unit=41&lesson
=53) 5) Which of the following are libraries in Python? 1 point
2 of 5 04-09-2024, 12:02 pm
Python for Data Science - - Unit 6 - Week 3 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=41&assessment=151
Week 4 ()
Supporting
material for
Week 4 ()
Download
Videos ()
6) Which of the following variable have null values? 1 point
Books ()
ID
Text Company
Transcripts () Review Date
Rating
Problem
Yes, the answer is correct.
Solving Score: 1
Session -
Accepted Answers:
July 2024 () Review Date
7) Which of the following countries have maximum locations of cocoa manufacturing 1 point
companies?
U.K.
U.S.A.
Canada
France
8) After checking the data summary, which feature requires a data conversion considering 1 point
3 of 5 04-09-2024, 12:02 pm
Python for Data Science - - Unit 6 - Week 3 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=41&assessment=151
Rating
Review date
Company
Bean origin
1.00
5.00
3.18
4.00
4 of 5 04-09-2024, 12:02 pm
Python for Data Science - - Unit 6 - Week 3 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=41&assessment=151
[1, 2]
[1, 3, 5]
[1, 2, 3, 4, 5]
[5, 4, 3, 2, 1]
5 of 5 04-09-2024, 12:02 pm
Python for Data Science - - Unit 7 - Week 4 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=56&assessment=145
Answer Submitted.
X
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
1 of 3 04-09-2024, 12:47 pm
Python for Data Science - - Unit 7 - Week 4 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=56&assessment=145
Part I (unit? 3) A Linear Regression model is said to be good when the R-squared value tends to 1 point
unit=56&lesson
=58) 0
1
Case Study on
Classification -1
Part II (unit? 0.5
unit=56&lesson
Yes, the answer is correct.
=59)
Score: 1
Introduction to Accepted Answers:
Regression 1
Case Study
4) The Gini coefficient ranges from 1 point
(unit?
unit=56&lesson 0 to 1
=60)
-1 to 0
Case Study on -1 to 1
Regression
None of the above
Part I (unit?
unit=56&lesson Yes, the answer is correct.
=61) Score: 1
Accepted Answers:
Case Study on 0 to 1
Regression
Part II (unit? 5) What is heteroscedasticity as used to assess a Linear Regression model? 1 point
unit=56&lesson
=62) Linear regression with varying error terms
Linear regression with constant error terms
Case Study on
Regression
Linear regression with no error terms
Part III (unit? All the above
unit=56&lesson
Yes, the answer is correct.
=63) Score: 1
Data sets (unit? Accepted Answers:
unit=56&lesson Linear regression with varying error terms
=64)
Practice: Week
4: Assignment
4 (Non
Graded)
(assessment?
name=145)
Week 4
Feedback Form
: Python for
Data Science
(unit?
2 of 3 04-09-2024, 12:47 pm
Python for Data Science - - Unit 7 - Week 4 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=56&assessment=145
unit=56&lesson
=116)
Quiz: Week 4 :
Assignment 4
(assessment?
name=152)
Supporting
material for
Week 4 ()
Download
Videos ()
Books ()
Text
Transcripts ()
Problem
Solving
Session -
July 2024 ()
3 of 3 04-09-2024, 12:47 pm
Python for Data Science - - Unit 7 - Week 4 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=56&assessment=152
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
1 of 5 04-09-2024, 12:03 pm
Python for Data Science - - Unit 7 - Week 4 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=56&assessment=152
Data sets (unit? He has been given a data set, ‘ServiceTrain.csv (https://drive.google.com/file/
unit=56&lesson
d/1n1Hv9TtHTBUhU84z-S4wBBgoOOoKKrm7/view?usp=drive_link)’ that contains some attributes
=64)
of the car that can be easily measured and a conclusion that if a service is needed or not.
Case Study
codes (unit? Now for the cars they cannot check in detail, they measure those attributes and store them in
unit=56&lesson ‘ServiceTest.csv (https://drive.google.com/file/d/1h_Va9tkMB6UDSuqD6MzeYqgdph6yhtmy/view?
=65)
usp=drive_link)’
Practice: Week
4: Assignment Problem Statement:
4 (Non Graded)
(assessment? Use machine learning techniques to identify whether the cars require service or not.
name=145)
2 of 5 04-09-2024, 12:03 pm
Python for Data Science - - Unit 7 - Week 4 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=56&assessment=152
Books () Prepare the data by following the steps given below, and answer questions 5 and 6.
• Encode categorical variable, Service - Yes as 1 and No as 0 for both the train and test
Text datasets.
Transcripts () • Split the set of independent features and the dependent feature on both the train and test
datasets.
Problem • Set random state for the instance of the logistic regression class as 0.
Solving
Session - 5) After applying logistic regression, what is/are the correct observations from the 1 point
July 2024 () resultant confusion matrix?
6) The logistic regression model built between the input and output variables is checked 1 point
for its prediction accuracy of the test data. What is the accuracy range (in %) of the predictions
made over test data?
60 - 79
90 - 95
30 – 59
80 – 89
Standardization
Dummy variables
3 of 5 04-09-2024, 12:03 pm
Python for Data Science - - Unit 7 - Week 4 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=56&assessment=152
Correlation
None of the above
8) A regression model with the function y = 80 + 4.5x was built to understand the 1 point
impact of temperature x on ice cream sales y. The temperature this month is 10 degrees more than
the previous month. What is the predicted difference in ice cream sales?
56 units
45 units
80 units
None of the above
9) X and Y are two variables that have a strong linear relationship. Which of the 1 point
following statements are incorrect?
The Global Happiness Index report contains the Happiness Score data with multiple features
(namely the Economy, Family, Health, and Freedom) that could affect the target variable
value.
Prepare the data by following the steps given below, and answer question 10.
• Split the set of independent features and the dependent feature on the given dataset
• Create training and testing data from the set of independent features and dependent feature
by splitting the original data in the ratio 3:1 respectively, and set the value for random_state
of the training/test split method’s instance as 1
10) A multiple linear regression model is built on the Global Happiness Index dataset ‘GHI 1 point
Report.csv (https://drive.google.com/file/d/1c7UeZMZuYYfOXMMagI4UpvC-VrJ7MXc8/view?
usp=drive_link)’. What is the RMSE of the baseline model?
4 of 5 04-09-2024, 12:03 pm
Python for Data Science - - Unit 7 - Week 4 https://onlinecourses.nptel.ac.in/noc24_cs68/unit?unit=56&assessment=152
2.00
0.50
1.06
0.75
5 of 5 04-09-2024, 12:03 pm
Python for Data Science
WEEK 0 ASSIGNMENT QUESTIONS
1. The table above indicates that there were 3,193,886 confirmed Covid 19 cases at one point in
time around the world. The table also shows that 9,72,719 people recovered. What % of people
have recovered from COVID-19?
a) 30.45
b) 7.1
c) 37
d) 20.5
Answer: a 30.45
2. Out of the 3.1 million confirmed cases, what ----- % of people have lost their lives?
a) 30.5
b) 7.1
c) 37
d) 20.5
Answer: b 7.1
Answer: c) ½.
There are 3 red marbles ,2 blue marbles and 1 yellow marbles in a bag.
4. “Statistics and Probability “is the title of a book. If each letter was carved into a block and
dropped into a bag, what are the chances a person would draw either the letter A or I from the
bag?
a. 1/4
b. 3 /24
c. 1/6
d. 7/24
e. None of the above
Answer: d) 7/24
5. From a shuffled deck of 52 cards, a card is drawn randomly. What is the probability that the card
drawn is neither a Queen nor a Heart shaped card?
a. 14/52
b. 17 /62
c. 35/52
d. 9/13
e. None of the above
Answer: d) 9/13
Answers: b) 25
Answer: c) a and b
By assigning the variable with a random numeric value, the number of iterations can be decided. So,
in this case, both for loop and while loop will work.
8. Which of the following operators is used to check an “Equal to” relationship between variables?
a) <=
b) >==
c) =
d) ==
e) None of the above
Answer: d) ==
9. Find the median for from the following numbers: 13,42, 24, 9,11, 18, 11, 7
a) 12
b) 11
c) 13
d) 9
Answer: a) 12
Sorting numbers in order: 7,9,11,11,13,18,24,42
Median is - (11 + 13)/ 2 = 12
Answer Submitted.
X
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
Week 0 ()
1) Which of the following is/are valid variable naming convention(s) in Python? 1 point
Week 1 ()
ageEmp = 45
Introduction to AgeEmp = 45
Python for Data age_emp = 45
Science (unit?
AGE_EMP = 45
unit=19&lesson
=20) Yes, the answer is correct.
Score: 1
Introduction to Accepted Answers:
Python (unit? ageEmp = 45
unit=19&lesson AgeEmp = 45
=21)
age_emp = 45
Introduction to AGE_EMP = 45
Spyder - Part 1
2) Which of the following is not accepted as a representation of complex numbers in 1 point
(unit?
unit=19&lesson Python?
=22)
k = 2 + 3j
Introduction to k = complex(2, 3)
Spyder - Part 2
k = 2 + 3l
1 of 3 04-09-2024, 01:11 pm
Python for Data Science - - Unit 3 - Week 1 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=19&assessment=94
(unit? k = 2 + 3J
unit=19&lesson
=23) Yes, the answer is correct.
Score: 1
Variables and Accepted Answers:
Datatypes k = 2 + 3l
(unit?
unit=19&lesson 3) What is the output of the following expression, 7//2? 1 point
=24)
1
Operators 3
(unit?
7
unit=19&lesson
=25)
2
2 of 3 04-09-2024, 01:11 pm
Python for Data Science - - Unit 3 - Week 1 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=19&assessment=94
Week 2 ()
Week 3 ()
Week 4 ()
Non Graded
Assignment ()
Supporting
material for
Week 4 ()
Download
Videos ()
Books ()
Text
Transcripts ()
Non
Proctored
Exam(Mar 20)
Session 1
(10am - 1pm -
for Jan 2022)
()
Non
Proctored
Exam(Mar 20)
Session 2
(8pm - 11pm -
for Jan 2022)
()
3 of 3 04-09-2024, 01:11 pm
NPTEL
WEEK 1 ASSIGNMENT QUESTIONS
1) Which of the arithmetic operators given below cannot be used with ‘strings’ in Python?
A) *
B) –
C) +
D) All of the mentioned
a. Type Error
b. Syntax Error
c. Value Error
d. None of the above
3) Two variables X and 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
e. Both a and d
4) From the following set of statements, what will be the value of variable y in the final print
statement?
a. 8
b. 9
c. 1
d. Error
e. 16
5) Consider j = 5 and k = 11. We change the values from j = 7 and k remains constant.
a. 3,15
b. 15,15
c. 11,15
d. 15,7
e. None of the above
a. False
b. True
c. Not True
d. None of the above
a. 4, int
b. 0.0, float
c. 0, int
d. 1, int
e. None of the above
8) j = 6 and g = 3.3. If normal division and floor division was done between j and k, what would be
the type of the resultant variable?
a. int,int
b. float,float
c. float,int
d. int,float
e. None of the above
9) Consider two answers to a question; answer1 and answer2. What is the output of the following
set of statements?
a. True
b. False
c. 0
d. 1
10) Consider the list of instructions and resulting outputs given below. Pick the set that is incorrect.
1. print ("Good", end ="")
print ("Day")
Output -> GoodDay
2. word1 = "Trial"
print("Word is %s" %word1)
Output -> Trial
3. num1 = 23
print( " Number: %f " %num1 )
Output -> Number: 23.000000
4. print( "ready\nsteady\ngo")
Output -> ready
steady
go
a. 4
b. 2
c. 1,3,4
d. 3,4
e. All are correct.
Python for Data Science - - Unit 4 - Week 2 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=31&assessment=98
Answer Submitted.
X
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
Week 0 ()
1) Create a dictionary “Movie_A” with the following details of a movie: 1 point
Week 1 ()
Week 2 ()
Jupyter setup
(unit?
unit=31&lesson
=32)
The correct command to extract the movie’s year of release is___
Sequence_data
_part_1 (unit?
unit=31&lesson Movie_A[2019]
=33)
Movie_A[2]
Sequence_data Movie_A[‘Year’]
_part_2 (unit? Movie_A[3]
unit=31&lesson
=34) Yes, the answer is correct.
Score: 1
Sequence_data Accepted Answers:
_part_3 (unit? Movie_A[‘Year’]
1 of 3 04-09-2024, 01:13 pm
Python for Data Science - - Unit 4 - Week 2 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=31&assessment=98
unit=31&lesson 2) Which of the following is /are container(s) for sequential data? 1 point
=35)
Lists
Sequence_data
Dictionary
_part_4 (unit?
unit=31&lesson Strings
=36) Sets
2 of 3 04-09-2024, 01:13 pm
Python for Data Science - - Unit 4 - Week 2 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=31&assessment=98
Supporting
material for Check Answers and Submit
Week 4 ()
Your score is: 5/5
Download
Videos ()
Books ()
Text
Transcripts ()
Non
Proctored
Exam(Mar 20)
Session 1
(10am - 1pm -
for Jan 2022)
()
Non
Proctored
Exam(Mar 20)
Session 2
(8pm - 11pm -
for Jan 2022)
()
3 of 3 04-09-2024, 01:13 pm
NPTEL
WEEK 2 ASSIGNMENT QUESTIONS
1. 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.
2) 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?
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
5) When the following set of instructions are executed, how many times does the vowel “e” appear
in the result?
a. 1
b. “e” is not printed
c. 2
d. 4
e. None of the above
a. t = (2,2)
b. y =['h','4','3']
c. r = ('v',)
d. s = ('w')
e. All except b
a. dict1 = {}
b. tup1 = ()
c. st1 = set()
d. toy = "baseball"
gt_str = toy[2:2]
print(gt_str)
e. All of the above
8) Consider a dictionary city created with the following keys and values.
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
a. 2
b. 1
c. 3
d. 0
e. None of the above
10) A datastructure 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.
Python for Data Science - - Unit 5 - Week 3 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=42&assessment=99
Answer Submitted.
X
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
Week 0 ()
1) Which of the following parameter is an alias for ‘sep’ for the read_csv and read_table 1 point
Week 1 () functions from pandas?
index_col
Week 2 ()
skiprows
Week 3 () na_values
delimiter
Reading data
Yes, the answer is correct.
(unit?
Score: 1
unit=42&lesson
Accepted Answers:
=43)
delimiter
Pandas
2) What will be the output of code given below? 1 point
Dataframes I
(unit?
unit=42&lesson
=44)
Pandas
Dataframes II
(unit?
1 of 4 04-09-2024, 01:15 pm
Python for Data Science - - Unit 5 - Week 3 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=42&assessment=99
unit=42&lesson
=45)
Pandas
Dataframes III
(unit?
unit=42&lesson
=46)
Control
structures &
Functions
120
(unit?
unit=42&lesson -120
=47) 60
-60
Exploratory
data analysis Yes, the answer is correct.
(unit? Score: 1
unit=42&lesson Accepted Answers:
=48) 60
2 of 4 04-09-2024, 01:15 pm
Python for Data Science - - Unit 5 - Week 3 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=42&assessment=99
3: Practice Mean
Assignment 3
F1_score
(Non Graded)
(assessment? Median
name=99) Mode
Week 3:
Solutions (unit? Check Answers and Submit
unit=42&lesson
=92) Your score is: 5/5
Week 3
Feedback Form
: Python for
Data Science
(unit?
unit=42&lesson
=55)
Week 4 ()
Non Graded
Assignment ()
Supporting
material for
Week 4 ()
Download
Videos ()
Books ()
Text
Transcripts ()
Non
Proctored
Exam(Mar 20)
Session 1
(10am - 1pm -
for Jan 2022)
()
Non
Proctored
Exam(Mar 20)
3 of 4 04-09-2024, 01:15 pm
Python for Data Science - - Unit 5 - Week 3 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=42&assessment=99
Session 2
(8pm - 11pm -
for Jan 2022)
()
4 of 4 04-09-2024, 01:15 pm
NPTEL
WEEK 3 ASSIGNMENT QUESTIONS
1) Data from the file “brand_data.csv “has to be loaded into a pandas dataframe. A snippet of the
data is shown below:
What is the right instruction to read the file into a dataframe df_brand with 4 separate columns?
a)
b)
c)
d)
Answers: b) and d)
Option a) chooses the wrong column as index. When set with index_col = 0, the dataframe ends with
only 3 columns and brand becomes the index.
Option d) used read_table which can read csv files using the delimiter = ‘,’ setting. Note that the
header is also correctly marked. This is correct.
2) For the same file above “ brand_data.csv “, which parameter in pd.read_csv will help to load
dataframe df_brand with the selected columns as shown below?
a. index_col =[‘brand’,’Price’]
b. skiprows =[‘brand’,’Price’]
c. usecols =[‘brand’,’Price’]
d. None of the above
Answer: c) usecols. Returns a subset of the columns from the original file.
3) Data from the file “ weather.xlsx “ has to be loaded into a pandas dataframe df_weather which
when printed is as shown below:
Of the following set of statements which of them can be used to move the column “Direction” into a
separate dataframe
a.
b.
c.
d.
Answer: a and c.
Option a. ->
Option b ->
Option c ->
Option d ->
4) Referring to the same dataframe df_weather in Question (3), which statement/statements will
help to print the last row from the dataframe?
a.
b.
c.
d.
Answer: b and d
Answer: c). The third row has a temperature of 35, so it will return False.
a. len(df.columns)
b. len(df)
c. df.size
d. All of the above.
Answer: a) len(df) returns number of rows. df.size returns the number of elements.
7) A file “Students.csv” contains the attendance and total scores of three separate students. This
data is loaded into a dataframe df_study and a pandas crosstab is applied on the same dataframe
which results in the following output
Which student scored the maximum average score of all three subjects? Which subject has the best
average score for all three students?
a. Harini,Chemistry
b. Rekha,Physics
c. Harini,Physics
d. Rekha,Maths
a) 7,8
b) 8,9
c) 8.5,7
d) 8,8
e) None of the above
Answer: d) 8 is the central tendency for the above histogram. It is the mean, median and mode.
9) For the following box plot, which among the given options are the median and the outlier?
a. 15,52
b. 22, 52
c. 13.5, 29
d. 25, 50
Answer: b) Median is between 20 and 25, so 22 is the median. Outlier is between 50 and 55, hence
52 is the outlier.
Q1 -13.5 Q3 – 27.5
10) A dataframe df_logs has the following data.
All the NaN / Null values in the column C1 can be replaced by zero value by executing which of the
following statements?
a. df_logs['C1'].fillna(0,inplace = True)
b. df_logs.fillna(0,inplace = True)
c. df_logs.fillna(0,inplace = False)
d. df_logs['C1'].fillna(df_logs['B1'],inplace = True)
Option b). All the null values in the dataframe get replaced by zero value. Incorrect.
Option c). No changes are reflected in the dataframe. Incorrect.
Option d). Column C1 null values get replaced by Column B1 values. Incorrect.
Python for Data Science - - Unit 6 - Week 4 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=57&assessment=100
Answer Submitted.
X
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
Week 0 ()
1) The most linearly correlated feature set in the given dataset is? 1 point
Week 1 ()
Cdur and InRate
Age and Camt
Week 2 ()
Cdur and Camt
Week 3 () Camt and Ndepend
1 of 4 04-09-2024, 01:16 pm
Python for Data Science - - Unit 6 - Week 4 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=57&assessment=100
Case Study on
Regression
Part II (unit?
unit=57&lesson
=63)
Case Study on
Regression
Part III (unit?
unit=57&lesson
=64)
Case Study
codes (unit?
unit=57&lesson
=67)
Practice: Week
4: Practice
Assignment 4
(Non Graded)
(assessment?
name=100)
Quiz: Week 4:
Assignment 4
(assessment?
2 of 4 04-09-2024, 01:16 pm
Python for Data Science - - Unit 6 - Week 4 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=57&assessment=100
name=102)
Week 4:
Solutions (unit?
unit=57&lesson
=93)
Week 4
Feedback Form
: Python for
Data Science
(unit?
unit=57&lesson
=66)
Non Graded
Assignment ()
Supporting
material for
Week 4 ()
Download
Videos ()
Books ()
Text
Transcripts ()
Non
Proctored
Exam(Mar 20)
Session 1
(10am - 1pm -
for Jan 2022)
()
Non
Proctored
Exam(Mar 20)
Session 2
(8pm - 11pm -
for Jan 2022)
()
3 of 4 04-09-2024, 01:16 pm
Python for Data Science - - Unit 6 - Week 4 https://onlinecourses.nptel.ac.in/noc22_cs32/unit?unit=57&assessment=100
4 of 4 04-09-2024, 01:16 pm
NPTEL
WEEK 4 ASSIGNMENT QUESTIONS
Given Data: Credit Worthiness data containing 1000 observations of income details of
individuals comprising 21 attributes along the columns (Cbal, Cdur, Chist, Cpur, Camt, Sbal,
Edur, InRate, MSG, Oparties, Rdur, Prop, age, inPlans, Htype, NumCred, JobType, Ndepend,
telephone, foreign, creditScore)
Problem statement: By observing the features of the dataset, the problem statement can be
defined as a binary classification problem of classifying any individual into an appropriate
category of creditScore such as Good or Bad.
1) How many unique values are present in the Sbal feature; also, what is the most frequent value
within Sbal?
Answers: c)
All features of object type can be analyzed by describe (). MARKUP ON THE PICTURE.
2) Find the average age of those customers who have a credit history [Chist] wherein the dues are
not paid earlier.
a. 35.54
b. 38.44
c. 33.00
d. None of the above
Answer: b) 38.44
3) A Logistic Regression model is built in which none of the features used are standardized. The train
to test proportion is 75:25 and the random state is set to 1. The accuracy of the model is ________.
Answer: c)
4) Import StandardScaler() from the sklearn.preprocessing package to standardize the features. Use
the same train-test proportion and the random state should be set to 1. After standardizing the
logistic regression model, by what percentage has the misclassified samples changed?
a. 11.11%
b. 3.7%
c. 20%
d. 39.2%
Answer: a
After Standardizing:
Percentage change in misclassified samples : (56-63 /63)*100 = 11.11%
5) When KNN classification is applied on the same standardized data at the optimal value for k
nearest neighbours, the accuracy achieved is ______.
a. 64%
b. 78%
c. 76.4%
d. None of the above
Answer: b)
6) A multiple linear regression model is built on the Global Happiness Index dataset
“GHI_Report.csv”. What is the rmse of the baseline model?
a. 1.99
b. 0.85
c. 1.06
d. 0.33
Answer: b) 1.06
7) From the multiple linear regression model built on the GHI index, we get an R-squared value of
___ on the test data subset.
a. 55.63
b. 45.81
c. 75.59
d. 81.46
Answer: d)
a) Linear Regression assumes that there exists a linear relationship between the
independent variable and dependent variable.
b) The errors terms are assumed to be independent and normally distributed.
c) The percentage of variation in the dependent variable as explained by the independent
variable/variables is expressed by R-squared value.
d) Residuals are the product of the predicted value and the actual observed value.
a) Standardization
b) Dummy variables
c) Correlation
d) None of the above
Answer: b) Dummy variables can be used to encode the different values contained in a particular
categorical independent feature.