In this article, we will discuss about the answers for week 1 assignment of "Data Science for engineers". All the answers given here are provided as a resource for the students. The answers should be submitted by yourself at your own knowledge.
Data Science for engineers
Last Date Of Submission [ 2023-02-08 ]
1. The function "ls()" in R will be
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
2. Consider the following code
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".
3. Consider the code below to create a dataframe city_data:
Choose the correct answer based on the output expected on running the below code.
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”
4. Consider the code given below
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]
5. Consider the following code.
If we supply 4 as an argument to the function find.function, after executing the above code, the result displayed would be
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: [ d ] B is a matrix consisting of all elements of A excluding the second row
6. 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: [ c ] eliminates space between two strings
7. Consider the following code in R.
a. the numbers "1,2,3,4"
b. the numbers "1,4,9,16"
c. the numbers "4"
d. None of the above
Answer: [ b ] the numbers "1,4,9,16"
8. 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
9. The output of compiling and executing the following code in R would be
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.
10. 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.
I Request everyone to revisit the website on/before to last date for any re-verification of answers.
If you have any queries, contact me. I am very thankful to answer you.
NOTE: I'm answering these questions to the best of my knowledge.