Hello Everyone, Hope you are Doing well. In this article I am going to share answers of Nptel Data Science for Engineers Week 1 Assignment 2023. I am answering these questions to the best of my knowledge. I try to provide the proofs for each problem so that it can be understandable how I approached.
In week 1 the following topics are discussed.
Also Read: Data Science for Engineers Week 0 Assignment
If you are looking for 2025 NPTEL Assignment of Data Science for Engineers Week 1 Answers, then its easy, to get the solutions 👉👉 CLICK HERE
NPTEL Data Science for Engineers Week 1 Assignment July 2023
In this week 1, it is provided with two assignments, one is for practice which is not graded and another one is the quiz assignment.
- Introduction to R
- Variable and Data types in R
- Data Frames
- Arithmetic, logical and matrix operations in R
- Advanced Programming in R functions
- Data visualization in R basics.
Introduction to R
We are having R and R studio.
Definition:
R : R is an Open source programming language which is widely used as statistical software and data analysis tool. Generally, R comes with command line interface.
R Studio: It is a integrated development environment of R. It is a GUI where you can see the results and generate the codes.
Through R studio we can solve the given assignments.
Watch the remaining videos provided by the nptel for more understanding.
Let go with the Assignment
Practice Week 1 Assignment ( Ungraded )
Q1. R Script file has a extension ________.
A. Rp
B. R
C. S
D. None of the above
Answer: [ B ] .R
Q2. In the R code given below, the value of "i" at which the loop breaks is ____.
n=16x=seq(1,n,2)for(i in x){if(i==5){print(i)break}} {codeBox}
A. 3
B. 15
C. 5
D. 25
Answer: [ C ] 5
Q3. The output of the code given below is ____________.
x=c(1:4)y=c(6,3)x *y {codeBox}
A. Error!
B. 6 12 9 12
C. 6 6 8 8
D. 6 6 18 12
Answer: [ D ] 6 6 18 12
Q4. Which of the following function is can be used to list the installed packages in R ?
A. library()
B. library []
C. library{}
D. All the above
Answer: [ A ] library()
The library() function in R is used to load and attach packages, but it can also be used to list the installed packages. When called without any arguments, it displays a list of all the installed packages in your R environment.
Q5. The values(s) of "y" at the end of the program is given below is _______
x1=matrix(10:18,3,3)x2=matrix(11:19,3,3)m=cbind(apply(x1,1,min),apply(x2,1,max))print(m)y=apply(m,1,mean)print(y) {codeBox}
A. 11 12 13
B. 30 20 40
C. 13.5 14.5 15.5
D. 2 12
Answer: [ C ] 13.5 14.5 15.5
Week 1 Assignment
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 ]
1_variable, _variable, variable@
The above listed are invalid because variable cannot be start with the numbers, special characters and symbols.
Hence Variable_1 is valid variable.
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
Consider the Following code snippet , Based on this answer the questions 3 and 4
ID = c(1,2,3,4)Patient_name = c("Ram" , "Shyam" , "Nandini" , "Maya" )num.patient=4patient_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])
Shyam
Q4. The output of the given code is given below
for ( i in patient_list[1]){for ( j in i ) {print( j )}} {codeBox}
A. [ 1 ] "Ram"
[ 1 ] "Shyam"
[ 1 ] " Nandini"
[ 1 ] " Maya"
B. [ 1 ] 4
C. [ 1 ] 1
[ 2 ] 2
[ 3 ] 3
[ 4 ] 4
D. Code will throw an error
Answer: [ B ] 4
Run the for loop command in the code box, u can observe the output.
Q5. What is the output of the following code?
x = 10 + 5%%3print(typeof(x)) {codeBox}
A. Double
B. Integer
C. List
D. None of the above
Answer: [ B ] Integer
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: [ B ] 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: [ D ] None of the above
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: [ D ] None of the above
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()
If you are looking for 2025 NPTEL Assignment of Data Science for Engineers Week 1 Answers, then its easy, to get the solutions 👉👉 CLICK HERE
Conclusion
Join the telegram channel for more updates or any change in answers.
Visit on/ before last date for any change in the answers.