SPPU | pune university BCA SEM 3 BIG DATA practical exam 2021 solved question

SPPU | pune university BCA SEM  3 BIG DATA  practical exam 2021 solved question

Q1. Write an R program to find the maximum and the minimum value of a given vector.

Answer:

num = c(10, 20, 30, 40, 50, 60)

print(num)  

print(paste("Maximum value of a given vector :",max(num)))

print(paste("Minimum value of a given vector :",min(num)))


 Q 2 Write a script in R to create two vectors of different lengths and give these vectors as

input to array and print addition and subtraction of those matrices

Answer :

m1 = matrix(c(1, 2, 3, 4, 5, 6), nrow = 2)

print("Matrix-1:")

print(m1)

m2 = matrix(c(0, 1, 2, 3, 0, 2), nrow = 2)

print("Matrix-2:")

print(m2)

result = m1 + m2

print("Result of addition")

print(result)

result = m1 - m2

print("Result of subtraction")

print(result)

 

Q.3 Write an R program to create a simple bar plot of five subject’s marks.

Answer:

marks = c(70, 95, 80, 74)

barplot(marks,

        main = "Comparing marks of 5 subjects",

        xlab = "Marks",

        ylab = "Subject",

        names.arg = c("English", "Science", "Math.", "Hist."),

        col = "darkred",

        horiz = FALSE)

 

Q.4 Write an R program to create a Dataframes which contain details of 5 employees and

display the details in ascending order.

Answer :

Employees = data.frame(Name=c("Saurabh S","Swati S","Kiran S", "Rajesh A","Anil Marathi"),

                      Gender=c("M","M","F","F","M"),

                      Age=c(23,22,25,26,32),

                      Designation=c("Clerk","Manager","Exective","CEO","ASSISTANT"),

                      SSN=c("123-34-2346","123-44-779","556-24-433","123-98-987","679-77-576")

                      )

print("Details of the employees:")                     

print(Employees)

 

Q. 5 Write an R program to change the first level of a factor with another level of a given

factor.

Answer:

v = c("a", "b", "a", "c", "b")

print("Original vector:")

print(v)

f = factor(v)

print("Factor of the said vector:")

print(f)

levels(f)[1] = "e"

print(f)

 

Q. 6. Write a script in R to create two vectors of different lengths and give these vectors as

input to array and print addition and subtraction of those matrices

Answer :

m1 = matrix(c(1, 2, 3, 4, 5, 6), nrow = 2)

print("Matrix-1:")

print(m1)

m2 = matrix(c(0, 1, 2, 3, 0, 2), nrow = 2)

print("Matrix-2:")

print(m2)

result = m1 + m2

print("Result of addition")

print(result)

result = m1 - m2

print("Result of subtraction")

print(result)

SPPU | pune university BCA SEM 3 BIG DATA practical exam 2021 solved question SPPU | pune university BCA SEM  3 BIG DATA  practical exam 2021 solved question Reviewed by technical_saurabh on April 28, 2021 Rating: 5

No comments:

Powered by Blogger.