Data Science for Engineers | Week 1

Course Name: Data Science for Engineers

Course Link: Click Here

These are NPTEL Data Science for Engineers Assignment 1 Answers


Q1) The function “ ls()” in R will
a. set a new working directory path
b. list all objects in our working environment
c. display the path to our working directory
d. list all files in our working directory

Answer: b. list all objects in our working environment


Q2) Consider the following code:

image 11

If a room temperature of 20 degree Celsius is input to the above code, choose the output displayed:
a. “The room is chilly. Please turn the heater on!”
b. “The room is warm” “Enjoy the stay!”
c. “The room is hot” “Please turn the air conditioning on!”
d. None of the above

Answer: b. “The room is warm” “Enjoy the stay!”


These are NPTEL Data Science for Engineers Assignment 1 Answers


Q3) Consider the code below to create a dataframe city_data:

image 12

Choose the correct answer based on the output expected on running the below code.

image 13

a. In the column weather in dataframe city_data, “Rain” is replaced by “Snowy”
b. In the column name in dataframe city_data, “City C” is replaced by “Snowy”
c. No change occurs to the entries in the dataframe city_data
d. The code raises an error

Answer: a. In the column weather in dataframe city_data, “Rain” is replaced by “Snowy”


These are Data Science for Engineers Week 1 Assignment Answers


Q4) Consider the code given below.

image 10

Choose the correct command to access the variable “Cloudy”
a. city_weather[[4]][2]
b. city_weather[[5]]
c. city_weather[[2]][2]
d. None of the above

Answer: a. city_weather[[4]][2]


These are NPTEL Data Science for Engineers Assignment 1 Answers


Q5) Consider the following code.
A = matrix(c(1:42), nrow = 6, ncol = 7, byrow = T)
B = A[-2,]
Based on the output of the above code, choose the correct options from the following

a. B is a matrix consisting of only elements of the second row of matrix A
b. B is a matrix consisting of same elements as that of A
c. The code raises an error
d. B is a matrix consisting of all elements of A excluding the second row

Answer: a. B is a matrix consisting of only elements of the second row of matrix A


Q6) The parameter “collapse” in the function paste()
a. adjusts the display of the string to left, right or center
b. add space in between two strings
c. eliminates the space in between two strings
d. eliminates the space within two words in a string

Answer: b. add space in between two strings


These are NPTEL Data Science for Engineers Assignment 1 Answers


Q7) Consider the following code in R.

image 14

If we supply 4 as an argument to the function find.function, after executing the above code, the result displayed would be
a. the numbers “1,2,3,4”
b. the numbers “1,4,9,16”
c. the number “4”
d. None of the above

Answer: b. the numbers “1,4,9,16”


Q8) The operator %in% is used for
a. multiplication of a matrix with its transpose
b. generating a sequence of numbers in a vector
c. identifying if an element belongs to a vector
d. none of the above

Answer: c. identifying if an element belongs to a vector


These are NPTEL Data Science for Engineers Assignment 1 Answers


Q9) The output of compiling and executing the following code in R would be

image 15

a. The term “Green” “apple” printed 5 times.
b. The term “Green apple” printed 3 times.
c. The term “Green” printed 4 times
d. The term “Green” “apple” printed 4 times.

Answer: d. The term “Green” “apple” printed 4 times.


Q10) The “next” statement in R programming is useful
a. for skipping the current iteration of a loop without terminating it.
b. for terminating the current iteration of a loop.
c. for evaluating the current iteration of a loop without terminating it.
d. None of the above

Answer: a. for skipping the current iteration of a loop without terminating it.


These are NPTEL Data Science for Engineers Assignment 1 Answers


* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first. COPYING MATERIALS IS STRICTLY PROHIBITED.


These are NPTEL Data Science for Engineers Assignment 1 Answers

More Solutions of Data Science for Engineers: Click Here

More NPTEL Solutions: https://progiez.com/answers/nptel/


More from PROGIEZ

These are NPTEL Data Science for Engineers Assignment 1 Answers
These are NPTEL Data Science for Engineers Assignment 1 Answers