NPTEL Data Science For Engineers Assignment Answers

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

  • 1_variable
  • variable_1
  • _variable
  • variable@
Answer :- a. 1_variabled. variable@ In R, variable names must follow certain rules and conventions. The valid variable names in R can only contain letters (a-z, A-Z), numbers (0-9), and dots (.) or underscores (_). Variable names cannot start with a number or contain special characters other than dots or underscores.

2. 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
Answer :- b. list all objects in our working environment ls() stands for "list objects" and is used to display the names of objects (variables, functions, etc.) that are currently present in the working environment in R. It does not change the working directory or display the path to the working directory. Instead, it lists the objects available in the current R session.

Consider a following code snippet. Based on this, answer questions 3 and 4.

A1Q3 4

3. 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])
Answer :- c. print(patient_list[[3]][2]) In R, double square brackets [[ ]] are used to extract elements from a list. The first index [[3]] selects the third element of the list, which is itself another list. Then, the second index [2] selects the second element from this inner list, which is "Shyam". Therefore, patient_list[[3]][2] will give you the value "Shyam".

4The output of the code given below is
A1Q4

A1Q4a
A1Q4b
A1Q4c

d. Code will throw an error.

Answer :- c.

5. What is the output of following code?

  • double
  • integer
  • list
  • None of the above
Answer :- a. double

6. 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. The statement is true. The library reshape2 in R is built around two key functions: melt and dcast (formerly known as acast). These functions are used for reshaping data from wide to long format and vice versa. The melt function is used to transform data from a wide format to a long format, while dcast is used to transform data from a long format to a wide format.

7. What is the output of following code?

  • 6
  • 4
  • 2
  • 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’))

8. 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
Answer :- a. student_data$student_dept = c("Commerce", "Biology", "English", "Tamil")b. student data[“student dept”]= c(“Commerce”,“Biology”, “English”,“Tamil”)

9. 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 :- student_data[[3]][4] In R, double square brackets [[ ]] are used to extract elements from a list or dataframe. In this case, student_data[[3]] extracts the third column (which is a vector containing "Commerce", "Biology", "English", "Tamil"), and then [4] is used to access the fourth element in that vector, which is "Tamil". Therefore, student_data[[3]][4] will give you the value "Tamil".

10. 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() The is.numeric() function in R is used to determine whether a given value is of numeric data type or not. It returns TRUE if the value is numeric and FALSE otherwise. For example:

11. Are the vectors [−2 4], [7 −2] and [3 −6] linearly independent?

  • Yes
  • No
Answer :- b

12. Does the set, S={(1,1),(1,2)} spans R2?

  • Yes
  • No
Answer :- a

13. Consider the following system of linear equations of the form Ax=b:1
2x−3y+6z=14
x+y−2z=−3
Which among the following are correct?

  • [ 1−4 0 ] is a solution to Ax=b
  • [ 0 2 1 ] is a solution to Ax=b
  • [ 1 −4 0 ] is a solution to Ax=0
  • [ 0 2 1 ] is a solution to Ax=0
Answer :- a, d

Consider the following systerm of linear equation:
x+y+z=−2
x+2y−z=1
2x+ay+bz=2

14. Find the conditions on a and b for which the above system has no solution.

  • 2a+b−6=0
  • a≠4, 2a+b−6= 0
  • a=4, b = −2
  • 2a+b−6 ≠ 0
Answer :- b

15. Find the conditions on a and b for which the above system has a unique solution.

  • 2a+b−6=0
  • a≠4, 2a+b−6= 0
  • a=4, b = −2
  • 2a+b−6 ≠ 0
Answer :- d

16. Find the conditions on a and b for which the above system has infite number of solutions.

  • 2a+b−6=0
  • a≠4, 2a+b−6= 0
  • a=4, b = −2
  • 2a+b−6 ≠ 0
Answer :- c

17. Identify the number of free variable from the above rwo echelon matrix.

  • 0
  • 1
  • 2
  • 3
Answer :- b

18. Which among the following is correct for the above system Ax= b?

  • It has infinite number of solutions.
  • It has a unique solution.
  • It has no solution.
Answer :- a

19. For what values of a are matrix not invertible?

  • a=1
  • a=−2
  • a=−1
  • a=2
Answer :- b, c

20. Which among the following is true for the determinant of a matrix?

  • The determinant of a diagonal matrix is the product of its diagonal entries.
  • If one row of a matrix is a scalar multiple of another, the determinant is 1.
  • If one row of a matrix is a scalar multiple of another, the determinant is 0.
  • The determinant of a permutation matrix can only be 1.
Answer :- a, c

21. Which among the following are the eigenvalues of matrix
a2q8

  • 1, 3, −3
  • 1, 3, 3
  • −1, 3, 3
  • 1, −3, −3
Answer :- d

23. Let A= [−1 2 2]. Suppose the eighen values corresponding to AAT are a,b and c, then find the value of ab+bc+ca.

  • 9
  • 0
  • 81
  • 18
Answer :- b

A six sided die is marked ‘1’ on one face, ‘2’ on two of its faces, and ‘3’ on the remaining three faces. The die is thrown twice. Let X denotes the total score in two throws.
Based on the above information, answer questions (1), (2).

24. Find the value of P(X>2.5|X<5). (Enter the answer correct to 2 decimal places).

Answer :- 0.86

25. Find the expected value of X.

Answer :- 3.22

26. Suppose X ∼ Normal(μ,4). For n=20 iid samples of X, the observed sample mean is 5.2. What conclusion would a z-test reach if the null hypothesis assumes μ=5 (against an alternative hypothesis μ≠5) at a significance level of α=0.05?
Use F−1z(0.025)=−1.9599

  • Accept H0
  • Reject H0
Answer :- a

27. A pharmaceutical company is testing a new drug. The probability that a patient experiencing a side effect from this drug is 0.100.10. If the drug is given to 55 patients, what is the probability that more than 1 patient will experience the side effect? (Enter the answer correct to 22 decimal places.)

Answer :- 0.08

28. Suppose X∼Normal(μ,9)(μ,9). For n=100 iid samples of X, the observed sample mean is 11.811.8. What conclusion would a z-test reach if the null hypothesis assumes μ=10.5μ (against an alternative hypothesis μ≠10.5μ≠10.5)?

  • Accept H0 at a significance level of 0.10.
  • Reject H0 at a significance level of 0.10.
  • Accept H0 at a significance level of 0.05.
  • Reject H0 at a significance level of 0.05.
Answer :- b, d

29. Let X and Y be two independent random variables with Var(X)=9 and Var(Y)=3, find Var(4X−2Y+6).

  • 100
  • 140
  • 156
  • None of the above
Answer :- c

30. The correlation coefficient of two random variable X and Y is −14, their variance is given by 3and 5. Compute Cov(X,Y).

  • -0.854
  • 0.561
  • -0.968
  • None of the above
Answer :- c

31. A sample of N observations are independently drawn from a normal distribution. The sample variance follows

  • Normal distribution
  • Chi-square with N degrees of freedom
  • Chi-square with N−1 degrees of freedom
  • t-distribution with N−1 degrees of freedom
Answer :- c

32. A car manufacturer purchases car batteries from two different suppliers. Supplier X provides 55% of the batteries and supplier Y provides the rest. 5%5% of all batteries from supplier X are defective and 4% of all batteries from supplier Y are defective. You select a battery from the bulk and you found it to be defective. What is the probability that it is from Supplier X?

  • 0.0455
  • 0.455
  • 0.0275
  • 0.018
Answer :- c

33. Find the t-statistic for the sample data, given that the population mean of the distribution is 8.

a3q10
  • -3.155
  • 8.33
  • -2.99
  • None of the above
Answer :- a

Leave a Comment