Data Science for Engineers Assignment 1 Nptel Answers

Are you looking for Nptel Data Science for Engineers Assignment 1 Answers . All weeks of Data Science for Engineers answers available here.


Nptel Data Science for Engineers Assignment 1 Answers
Nptel Data Science for Engineers Assignment 1 Answers

Nptel Data Science for Engineers Assignment 1 Answers (Jan-Apr 2025)

Course link: Click here


Que. 1) Which of the following variable names are INVALID in R?

a) 1_variable
b) variable_1
c) variable
d) variable@

View Answer


Que. 2) 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

View Answer


Consider the following code snippet and answer questions 3 and 4:

num_patient <- c(1, 2, 3, 4)  
ID <- c(1, 2, 3, 4)  
Patient_name <- c("Shyam", "Nandini", "Haya")  
patient_list <- list(num_patient, ID, Patient_name)

Que. 3) Which of the following commands is used to access the value “Shyam”?

a) print(patient_list[3][[2]])
b) print(patient_list[[3]][2])

View Answer


Que. 4) What does the following R code produce?

x <- "banana"  
x

a) "banana"
b) "cherry"
c) Error

View Answer


Que. 5) What is the output of the following code?

x <- 10 + 5  
typeof(x)

a) double
b) integer
c) list
d) None of the above

View Answer


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

View Answer


Que. 7) What does the following R code return?

x <- c(5, 10, 15, 20)  
y <- x[x > 10]

a) 5, 10, 15, 20
b) 15, 20
c) 10, 15, 20
d) Error

See also  Nptel Data Science for Engineers Assignment 4 Answers

View Answer


Que. 8) What is the output of the following R code?

x <- 1  
while (x <= 3) {  
  print(x)  
  x <- x + 1  
}

a) 1, 2, 3
b) Error

View Answer


Create the data frame using the code given below and answer questions 9 and 10:

student_data <- data.frame(
  student_id = c(1, 2, 3, 4),
  student_name = c("Ram", "Harish", "Pradeep", "Rajesh")
)

Que. 9) Choose the correct command to add a column named student_dept to the dataframe student_data:

a) student_data$student_dept = c("Commerce", "Biology", "English", "Tamil")
b) student_data["student_dept"] = c("Commerce", "Biology", "English", "Tamil")
c) student_dept = c("Commerce", "Biology", "English", "Tamil")
d) None of the above

View Answer


Que. 10) Choose the correct command to access the element “Tamil” in the dataframe student_data:

a) student_data[[4]][3]
b) student_data[[3]][4]
c) None of the above

View Answer


Que. 11) 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

View Answer


Que. 12) What will the following R code return?

mat <- matrix(1:9, nrow = 3)  
mat[2, 3]

a) 5
b) 9
c) Error

View Answer


Que. 13) What is the result of the following R code?

mat1 <- matrix(1:6, nrow = 2)  
mat2 <- matrix(7:12, nrow = 2)  
result <- mat1 + mat2  

a)

[1,]  8 10 12  
[2,] 14 16 18  

b)

8 10 12 14 16 18  

c)

[1,]  8  9 10  
[2,] 11 12 13  

d) Error

View Answer


Nptel Data Science for Engineers Assignment 1 Answers (July-Dec 2024)

Course name: Data Science for Engineers

Course Link: Click Here

For answers or latest updates join our telegram channel: Click here to join

These are Nptel Data Science for Engineers Assignment 1 Answers

See also  Data Science for Engineers Assignment 2 Nptel Answers

Q1. Which of the following variable names are INVALID in R?
1_variable
variable_1
_variable
variable@

View Answer


Q2.The function ls () in R will
set a new working directory path
list all objects in our working environment
display the path to our working directory
None of the above

View Answer


For answers or latest updates join our telegram channel: Click here to join

These are Nptel Data Science for Engineers Assignment 1 Answers


Q3.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”)
12345670
num.patient = 4
patient_list = list(num.patient, ID, Patient_name)

Which of the following command is used to access the value “Shyam”?
print(patient_list[3][2])
print(patient_list[[3]][1])
print(patient_list[[3]][2])
print(patient_list[[2]][2])

View Answer


Q4.The output of the code given below is
for (i in patient_list[1]){
for (jin i){ print(j) }
}

View Answer


For answers or latest updates join our telegram channel: Click here to join

These are Nptel Data Science for Engineers Assignment 1 Answers


Q5. What is the output of following code?
double
integer
list
None of the above

View Answer


Q6. State whether the given statement is True or False.
The library reshape2 is based around two key functions named melt and cast.
True
False

Answer: True


For answers or latest updates join our telegram channel: Click here to join

These are Data Science for Engineers Week 1 Assignment Nptel Answers


Q7. What is the output of following code?
A = matrix(c(9:1), 3, 3)
print(A[3, 2])

6
4
2
8

Answer: 6


Q8. 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’))

Choose the correct command to add a column named student dept to the dataframe student data.
student_datastudent dept=c(“Commerce”, “Biology”, “English”, “Tamil”)
student_data[“student dept”]= c(“Commerce”,“Biology”, “English”,“Tamil”)
student_dept= student data[c(“Commerce”,“Biology”,“English”,“Tamil”)]
None of the above

See also  Data Science for Engineers | Week 7

Answer: B)student_data[“student dept”]= c(“Commerce”,“Biology”, “English”,“Tamil”)


For answers or latest updates join our telegram channel: Click here to join

These are Data Science for Engineers Week 1 Assignment Nptel Answers


Q9. Choose the correct command to access the element Tamil in the dataframe student_data.
student_data[[4]]
student_data[[4]][3]
student_data[[3]][4]
None of the above

Answer: None of the above


Q10. The command to check if a value is of numeric data type is __.
typeof()
is.numeric()
as.numeric()
None of the above

Answer: is.numeric()


For answers or latest updates join our telegram channel: Click here to join

These are Nptel Data Science for Engineers Assignment 1 Answers

More Weeks of Data Science for Engineers: Click here

More Nptel Courses: https://progiez.com/nptel-assignment-answers


These are Data Science for Engineers Week 1 Assignment Nptel Answers