100% found this document useful (2 votes)
2K views4 pages

Data Science With R Exam Questions: PG Program in Analytics

Questions involve writing R programs to create and manipulate data frames and lists, plot charts, perform linear and logistic regression modeling, decision trees, and k-means clustering. Datasets provided include mtcars, titanic, and USArrests.

Uploaded by

kPrasad8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views4 pages

Data Science With R Exam Questions: PG Program in Analytics

Questions involve writing R programs to create and manipulate data frames and lists, plot charts, perform linear and logistic regression modeling, decision trees, and k-means clustering. Datasets provided include mtcars, titanic, and USArrests.

Uploaded by

kPrasad8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PG Program in Analytics

Data Science with R Exam [Time: 2 hrs]


[Total Marks: 100]
Questions

Marks
Q1. Write an R program to create a sequence of numbers from 20 [3]
to 50 and find the mean of numbers from 20 to 60 and the
sum of numbers from 51 to 91.
Q2. A student scored 70 marks in English, 95 marks in Science, 80 [5]
marks in Maths and 74 marks in History. Write an R program
to plot a simple bar chart displaying the scores of the given
subjects.
Q3. Write a R program to create a data frame to store the [3]
following details of 5 employees.
Name Gender Age Designation SSN
Anastasia S M 23 Clerk 123-34-
2346
Dima R M 22 Manager 123-44-779

Katherine S F 25 Executive 556-24-433

JAMES A F 26 CEO 123-98-987

LAURA M 32 ASSISTANT 679-77-576


MARTIN

Q4. Write an R program to create a list of heterogeneous data, [3]


which includes character, numeric and logical vectors. Print
the list.
Q.5 Write an R program to convert a given matrix to a 1- [2]
dimensional array.
[,1] [,2] [,3] [,4]
PG Program in Analytics

[1,] 1 4 7 10
[2,] 2 5 8 11
[3,] 3 6 9 12

Q.6 Write a R program to create a list containing a given vector, a [5]


matrix, and a list and add an element at the end of the list
Vector: c("Red","Green","Black")
Matrix:
[,1] [,2] [,3]
[1,] 1 5 9
[2,] 3 7 11

List: ("Python", "PHP", "Java")


New Element: 4
Q.7 Write an R program to merge two given lists into one list. [5]
List1= list(1,2,3)
List2 = list("Red", "Green", "Black")
Q.8 Write an R program to convert a given data frame to a list by [8]
rows.
Name Score attempts qualify
Anastasia 12.5 1 yes
Dima 9.0 3 no
Katherine 16.5 2 yes
James 12.0 3 no
Emily 9.0 2 no
Michael 20.0 3 yes
Matthew 14.5 1 yes
Laura 13.5 1 no
Kevin 8.0 2 no

Q.9 Write an R program to create a correlation matrix from a data [2]


frame of the same data type.
PG Program in Analytics

d = data.frame(x1=rnorm(5),
x2=rnorm(5),
x3=rnorm(5))
Q.10 Write an R program to rotate a given matrix 90 degrees [8]
clockwise.
[,1] [,2] [,3]
[1,] 1 4 7

[2,] 2 5 8
[3,] 3 6 9

Q.11 Check for missing values in the ‘mtcars’ data set. [3]
Q.12 Check which attributes are important to determine the mpg of [8]
a car in the ‘mtcars’ data set.
Q.13 Build a simple linear model to predict the mpg of a car in the [8]
‘mtcars’ data set.
Q.14 Build a logistic regression model using the glm function to [8]
know the effect of admission into graduate school. The target
variable, admit/don't admit, is a binary variable
Use the given “binary.csv” dataset
Q.15 Use the given variables from the titanic dataset and build the [5]
decision tree on train data.
Variables from dataset: survived, embarked, sex, sibsp, parch,
fare
Q.16 Create a plot to display the result of decision tree. [5]
Q.17 Create the confusion matrix for the above model. [3]
Q.18 Perform k-means clustering on USArrest dataset. Scale the data [8]
before performing clustering.
Use the below code to load the data
PG Program in Analytics

data("USArrests")
Q.19 Print the cluster number for each observation and cluster size [3]
for the above k-means model.
Q.20 Plot the result of the k-means cluster. [5]

You might also like