NPTEL Data Science for Engineers Week 1 Assignment 2025

This article provides you the answers for Week 1 Assignment of NPTEL Data Science for Engineers. The answers provided here are for free and all are verified with solutions. If any change in the answers, please join in the telegram link provided below. 

To join Telegram 👉 CLICK HERE 

Also Read: NPTEL Data science for Engineers Registration

NPTEL Data Science for Engineers Week 1 Assignment 2025

NPTEL Data Science for Engineers



The week 1 Assignment had been released and the last date of submission of the assignment is February  05, 2025

Come with us and solve the fruitful questions, 

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 ] 

Which of the following variable names are INVALID in R


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 

list all objects in our working environment



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

Which of the following command is used to access the value “Shyam”


Q4. What does the following R code produce?

        x <- c ("apple", "banana", "cherry" )
        x [2]  {codeBox}

 a. “apple”
 b. “banana”
 c.  “cherry”
 d.   Error

Answer: [ B ]  Banana

What does the following R code produce?



Q5. What is the output of following code?

 x <-  10 + 5%%3
 
 typeof (x) {codeBox}

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

Answer: [ a ]  double 

output of following code



State whether the given statement is True or False.

Q6. The library reshape2 is based around two key functions named melt and cast.
 
a. True
b. False

Answer: [ a ]  True 

The library reshape2 is based around two key functions named melt and cast.


Q7. What does the following R code return?

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

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

Answer: [ B ] 15, 20 

Q8. What is the output of the following R code?

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

 a. 1, 2, 3
 b. 0, 1, 2
 c. 1, 2, 3, 4
 d. Error

Answer: [ a ] 1,2,3

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

Q9. 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 ] 

student_datastudent_dept=c(“Commerce”, “Biology”, “English”, “Tamil”)
student_data[“student_dept”]= c(“Commerce”,“Biology”, “English”,“Tamil”)

Choose the correct command to add a column named student_dept to the dataframe student_data



Q10. 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]

Q11. 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()

The command to check if a value is of numeric data type is



Q12. What will the following R code return?

         mat <- matrix ( 1:9, nrow=3, ncol=3, byrow=TRUE ) 
         mat [2,3] {codeBox}

 a. 6
 b. 5
 c. 9
 d. Error

Answer: [ a ]  6

Q13. What is the result of the following R code?

        mat 1<- matrix ( 1:6, nrow=2, ncol=3)
        mat 2<- matrix ( 7:12, nrow=2, ncol=3)
        result <- mat1 + mat2
        result {codeBox }
         

 a.  [1]  8  10 12
      [2] 14 16 18
 b.  [1] 8 10 12 14 16 18
 c.  [1] 8 9 10 11 12 13
 d.  Error


Answer: 

What is the result of the following R code?

Conclusion 

I Request everyone to revisit the website on/before to last date for any re-verification of answers.

If you have any queries, contact on telegram 

To join Telegram 👉 CLICK HERE 


One Comment Please !

Post a Comment (0)
Previous Post Next Post