R Programming in Data Science
R Programming in Data Science
R Programming in Data Science
DEPARTMENT OF
ARTIFICIAL INTELLINGENCE AND DATA SCIENCE
QUESTION BANK
V SEMESTER
1922502 – R PROGRAMMING IN DATA SCIENCE
Regulation – 2019
Academic Year 2022 – 2023 (ODD)
Prepared by
DEPARTMENT OF
ARTIFICIAL INTELLIGENCE AND DATA SCIENCE
QUESTION BANK
UNIT – I
PART- A (2 Marks)
Q. Questions BT Level Compete
No nce
1 Define R programming. Remembering BTL-1
2 Differentiate between Scalars, vector, list, Matrix and Understanding BTL-2
Data frame.
3 List out any five features of R. Remembering BTL-1
4 Differentiate between R and Python in terms of Understanding BTL-2
functionality.
5 What are the applications of R? Understanding BTL-2
6 Why do we use the command- Analyzing BTL-4
install.packages(file.choose(),repos=NULL)?
7 Summarize some packages in R, which can be used for Evaluating BTL-5
data imputation?
8 How to get the name of the current working directory in Applying BTL-3
R?
9 Write a R program to take input from the user (name Analyzing BTL-4
and age) and display the values. Also print the version
of R installation
10 What are the different values that can be assigned to a Analyzing BTL-4
numeric datatype in R?
11 What are the different data types in R? Analyzing BTL-4
12 Explain RStudio. Evaluating BTL-5
13 Compare R with other technologies. Understanding BTL-2
14 Write a R program to create three vectors numeric data, Evaluating BTL-5
character data and logical data. Display the content of
the vectors and their type.
15 Define Merging and accessing list elements. Remembering BTL-1
16 Demonstrate the simple 3X3 matrix. Applying BTL-3
17 How do you access the elements in the 2nd column and Applying BTL-3
4th row of a matrix?
18 Define slice a matrix. Remembering BTL-1
19 How to create a Matrix? Applying BTL-3
20 Write R program to create a blank matrix. Creating BTL-6
21 Write a program to add two matrices. Creating BTL-6
22 List out the operations on Matrices. Remembering BTL-1
23 Define order of a Matrix. Remembering BTL-1
24 Difference between Nominal and ordinal categorical Understanding BTL-2
variable.
PART – B (13 Marks)
1 i.Summarize the advantages and disadvantages (6) Remembering BTL-1
of R?
ii.Explain scalar and vector with an example. (7)
2 i.Write a R program to get the first 10 Fibonacci (6) Remembering BTL-1
numbers.
ii.Generate the following: (7)
a. Access the element at 3rd column and 1st
row in a matrix.
b. Access only the second row
c. Access the element at 2nd column and 4th
row in a matrix
3 Write a R program to find the maximum and the (13) Applying BTL-3
minimum value of a given vector. Explain the
functions with syntax.
4 Write a R program to find elements which are (13) Applying BTL-3
present in two given data frames
5 Write a R program to create a data frame using (13) Understanding BTL-2
two given vectors and display the duplicated
elements and unique rows of the data frame.
Explain with a syntax.
6 i. Illustrate the usage of all logical operator in R. (6) Understanding BTL-2
ii. Explain the use of length () and mean() (7)
function.
7 Elaborate the statistical and programming (13) Understanding BTL-2
features of R.
8 i. Write a R program to add a new item g4 = (6) Evaluating BTL-5
"Python" to a given list. g1=1:10,g2=”R (7)
Program”,g3=”HTML”.
ii. Explain Data frame operations.
9 Write a R program to add 3 to each element of (13) Analyzing BTL-4
the first vector. Print the original and new vector.
10 Write a R program to reverse the order of given Analyzing BTL-4
(13)
vector.
11 Check whether the value of the element of a Understanding BTL-2
(13)
given vector greater than 10 or not. Return
TRUE or FALSE.
12 Write a R program to create an ordered factor Analyzing BTL-4
(13)
from data consisting of the names of months.
13 Write a R program to create a correlation matrix Applying BTL-3
(13)
from a data frame of same datatype. Explain the
functions with syntax.
14 Create the following: Creating BTL-6
a. Create a matrix taking a given vector of (7)
numbers as input. Display the matrix.
b. To access the element at 3rd column and (6)
2nd row, only the 3rd row and 4th column
of a given matrix.
15 List out the properties of the following: Remembering BTL-1
a. Matrix subtraction (4)
b. Matrix Division (4)
(3)
c. Matrix addition (2)
d. Matrix multiplication
16 i. What is Factor in R and its function? (6) Remembering BTL-1
ii. Distinguish two types of variables with an (7)
example.
17 Explain categorical variables with an example. (13) Evaluating BTL-5
PART – C (15 Marks)
1 i. Explain main features to write R code that runs (8) Evaluating BTL-5
faster.
ii. Difference between package and library. With (7)
examples
2 a. i.Let’s create the following vectors: (7) Creating BTL-6
u <- 4
v <- 8
Use the elementary arithmetic operators +, -, *, /,
and ^ to:
add u and v
subtract v from u
multiply u by v
divide u by v
raise u to the power of v
ii. Write a R program to create a vector and find
the length and the dimension of the vector.
(8)
b. i. Suppose u and v are not scalars, but vectors
with multiple elements:
u <- c(4, 5, 6)
v <- c(1, 2, 3)
Without using R, write down what you expect as
the result of the same operations as in the previous
exercise:
add u and v
subtract v from u
multiply u by v
divide u by v
raise u to the power of v
ii. Create a Vector using : Seq() function
iii. Write R program to find Sum, Mean and
Product of a vector, ignore elements like NA or
NaN.
3 a. Write a R program to get all prime (5) Evaluating BTL-5
numbers up to a given number
b. Write a R program to count the number of (5)
NA values in a data frame column.
c. Create the following (5)
a. Creating a list
b. Naming list elements
c. Check whether a item exist or not
4 Perform the following operation in data frame: Evaluating BTL-5
a. Write a R program to add a new column in (4)
a given data frame.
b. Write a R program to add new row(s) to (4)
an existing data frame.
c. Write a R program to drop column(s) by (4)
name from a given data frame.
d. Write a R program to drop row(s) by (4)
number from a given data frame.
e. Write a R program to create inner, outer, (4)
left, right join(merge) from given two data
frames
5 Create the following: Creating BTL-6
a. Create factor variables (5)
b. Create ordered factor variables (5)
c. Adding and dropping levels in factor (5)
variable
PART – A (2-Marks)
Q. Questions BT Level Compete
No nce
(6)
ii.Convert the following expressions to separate
operations, and check that both approaches give
the same
result:
w <- (u + 0.5 * v) ^ 2
w <- (u + 2) * (u - 5) + v
w <- (u + 2) / ((u - 5) * v)
5 i.Create a simple data frame from 3 vectors. Order (5) Creating BTL-6
the entire data frame by the first column.
R Data Frame: Create, Append, Select, Subset. R sort a data Frame using Order (), R
Dplyr: Data manipulation and Cleaning, Merge Data Frames in R: Full and Partial
Match, Functions in R programming.
PART-A (2 Marks)
Q. Questions BT Level Compete
No nce
PART-A (2 Marks)
Q. Questions BT Level Compete
No nce
5 Create histogram using hist() function for the (15) Creating BTL-6
built-in dataset airquality which has “ Daily air
quality measurements in New York “.
UNIT – V – INTERFACING
R – CSV Files – Excel File – Binary Files – XML files – Web Data – Database –
Regression – Decision Tree – Random Forest, R Random Forest, Generalized Linear
Model in R with example, K- means Clustering in R with example
A1(2, 10), A2(2, 5), A3(8, 4), A4(5, 8), A5(7, 5),
A6(6, 4), A7(1, 2), A8(4, 9)