[Week 3] NPTEL Python For Data Science Assignment Answer 2023

Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

NPTEL Python For Data Science Assignment Answer

NPTEL Python For Data Science Assignment Answer 2023

NPTEL Python For Data Science Week 3 Assignment Answer 2023

1. Which of the following is the correct approach to fill missing values in case of categorical variable?

  • Mean
  • Median
  • Mode
  • None of the above
Answer :- For Answer Click Here

2. Of the following set of statements, which of them can be used to extract the column Type as a separate dataframe?

  • df_cars[[‘Type’]]
  • df_cars.iloc[[:, 1]
  • df_cars.loc[:, [‘Type’]]
  • None of the above
Answer :- For Answer Click Here

3. The method df_cars.describe() will give description of which of the following column?

  • Car name
  • Brand
  • Price (in lakhs)
  • All of the above
Answer :- For Answer Click Here

4. Which pandas function is used to stack the dataframes vertically?

  • pd.merge()
  • pd.concat()
  • join()
  • None of the above
Answer :- For Answer Click Here

5. Which of the following are libraries in Python?

  • Pandas
  • Matplotlib
  • NumPy
  • All of the above
Answer :- For Answer Click Here

6. Which of the following variable have null values?

  • ID
  • Company
  • Review Date
  • Rating
Answer :- For Answer Click Here

7. Which of the following countries have maximum locations of cocoa manufacturing companies?

  • U.K.
  • U.S.A.
  • Canada
  • France
Answer :- For Answer Click Here

8. After checking the data summary, which feature requires a data conversion considering the data values held?

  • Rating
  • Review date
  • Company
  • Bean origin
Answer :- For Answer Click Here

9. What is the maximum rating of chocolates?

  • 1.00
  • 5.00
  • 3.18
  • 4.00
Answer :- For Answer Click Here

10. What will be the output of the following code?
[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • [bool, int, float, float, str]
  • [str, int, float, float, str]
  • [bool, int, float, int, str]
  • [bool, int, int, float, str]
Answer :- For Answer Click Here

NPTEL Python For Data Science Week 2 Assignment Answer 2023

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

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

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])?

  • [[1 2 3]
    [4 5 6]
    [7 8 9]
  • [1 2 3]
  • [4 5 6]
  • [7 8 9]
Answer :- [4 5 6]

3. What is the output of the following code?

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

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

4. What is the output of the following code?
[Week 3] NPTEL Python For Data Science Assignment Answer 2023

[Week 3] NPTEL Python For Data Science Assignment Answer 2023
[Week 3] NPTEL Python For Data Science Assignment Answer 2023
[Week 3] NPTEL Python For Data Science Assignment Answer 2023
[Week 3] NPTEL Python For Data Science Assignment Answer 2023
Answer :- c.   [[ 0  1  2  3  4]
                        [ 5  6  7  8  9]
                       [10 11 12 13 14]]

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

[Week 3] NPTEL Python For Data Science Assignment Answer 2023
[Week 3] NPTEL Python For Data Science Assignment Answer 2023
[Week 3] NPTEL Python For Data Science Assignment Answer 2023
[Week 3] NPTEL Python For Data Science Assignment Answer 2023
Answer :- place = 'Chennai'
print("My friend's house is in {}".format(place))

print("My friend's house is in {}".format("Chennai"))

6. 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 :- x=t2[t1[1]]

t3=t1+t2

t3=(t1,t2)

t3=(
list(t1)
, list(t2))

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’ : 22})
Answer :- d[2]
.append(4)

d[
“one”]=1

d.
update({‘one’ : 2
})

8. Which of the following data type is immutable?

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

Tuples are immutable, meaning their elements cannot be changed after creation. Once a tuple is created, its contents remain fixed. In contrast, lists, sets, and dictionaries are mutable data types, which means their elements or values can be modified after they are created.

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 :- student.update({‘age’ : 26, ‘phone’: ‘123-456’}) 

student[‘phone’] = ‘123-456’

student.update({‘age’ : 26})

10. What is the output of the following code?
[Week 3] NPTEL Python For Data Science Assignment Answer 2023

[‘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 :- a. ['M', 'A', 'H', 'E', 'S', 'H']

NPTEL Python For Data Science Week 1 Assignment Answer 2023

1. What is the output of the following code?
[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • 36
  • 121212
  • 123
  • Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’
Answer :- 121212

2. What is the output of the following code?
[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • -1
  • -2
  • -1.28
  • 1.28
Answer :-  -2

3. Consider a following code snippet. What is a data type of y?
[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • int
  • float
  • str
  • Code will throw an error.
Answer :- str

4. Which of the following variable names are INVALID in Python?

  • 1_variable
  • variable_1
  • variable1
  • variable#
Answer :- 1_variable, variable# 

5. While naming the variable, use of any special character other than underscore(_) ill throw which type of error?

  • Syntax error
  • Key error
  • Value error
  • Index error
Answer :- Syntax error

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

7. Which Python library is commonly used for data wrangling and manipulation?

  • Numpy
  • Pandas
  • scikit
  • Math
Answer :- Pandas

8. Predict the output of the following code.
[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • 12.0
  • 12
  • 11.667
  • 11
Answer :- 12

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?

  • int, int
  • float, float
  • float, int
  • int, float
Answer :- float, float

10. Let a = 5 (101 in binary) and b = 3 (011 in binary). What is the result of the following operation?
[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • 3
  • 7
  • 5
  • 1
Answer :- 1
Course NamePython For Data Science
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

Important Links

Follow us & Join Our Groups for Latest Information
Updated by US
🔥Follow US On Google NewsClick Here
🔥WhatsApp Group Join NowClick Here
🔥Join US On TelegramClick Here
🔥WebsiteClick Here

Leave a comment