Hey Folks, Come on let us solve the Answers for NPTEL Data Science for engineers assignment for the week 1. Let us see the answers. Join the telegram for any doubts and for any updated solutions.
Join Telegram: CLICK HERE
Also Read: Nptel Joy of Computing Using Python
NPTEL Data Science for Engineers Assignment 1 July 2024
Last date: 2024-08-07, 23:59 IST
Q1. Which of the following variable names are INVALID in R?
A. 1_variable
B. variable_1
C. _variable
D. variable@
Answer: A, C, D
Reason:
Q2. 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. None of the above
Answer: [ B ] list all objects in our working environment
Reason:
Consider the following code snippet. Based on this, answer questions 3 and 4.
ID = c (1, 2, 3, 4)
Patient_name = c ("Ram", "Shyam", "Nandini", "Maya")
num.patient = 4
patient_list = list (num.patient, ID, Patient_name) {codeBox}
Q3. Which of the following command is used to access the value “Shyam”?
A. print(patient_list[3][2])
B. print(patient_list[[3]][1])
C. print(patient_list[[3]][2])
D. print(patient_list[[2]][2])
Answer: [ C ] print(patient_list[[3]][2])
Reason:
Q4. The output of the code given below is
for ( i in patient_list[ 1 ] ) {
for ( j in i ) {
print ( j )
}
} {codeBox}
Answer: [ C ]
[ 1 ] 4
Q5. What is the output of following code?
x = 10 + 5 %% 3
print ( typeof (x) ) {codeBox}
A. double
B. integer
C. list
D. None of the above
Answer: [ A ] double
Reason:
Q6. State whether the given statement is True or False.
The library reshape2 is based around two key functions named melt and cast.
A. True
B. False
Answer: [ A ] True
Q7. What is the output of following code?
A = matrix ( c ( 9:1 ), 3, 3 )
print ( A [ 3, 2] ) {codeBox}
A. 6
B. 4
C. 2
D. 8
Answer: [ 4 ]
Create the data frame using the code given below and answer questions 8 and 9.
student_data = data.frame(student_id=c(1:4), student_name=c(‘Ram’,‘Harish’,‘Pradeep’,‘Rajesh’))
Q8. Choose the correct command to add a column named student dept to the dataframe student data.
A. student_datastudent dept=c(“Commerce”, “Biology”, “English”, “Tamil”)
B. student_data[“student dept”]= c(“Commerce”,“Biology”, “English”,“Tamil”)
C. student_dept= student data[c(“Commerce”,“Biology”,“English”,“Tamil”)]
D. None of the above
Answer: [ A ], [ B ]
Q9. Choose the correct command to access the element Tamil in the dataframe student_data.
A. student_data[[4]]
B. student_data[[4]][3]
C. student_data[[3]][4]
D. None of the above
Answer: [ C ] student_data[[3]][4]
Q10. The command to check if a value is of numeric data type is ________.
A. typeof()
B. is.numeric()
C. as.numeric()
D. None of the above
Answer: [ B ] is.numeric()