0% found this document useful (0 votes)
3 views2 pages

Mid - 1 - 2021-22 (R&Python)

This document outlines a mid-term examination for a B.Sc. course on Programming with R and Python at Jatiya Kabi Kazi Nazrul Islam University. It includes questions on R commands, matrix definitions, distinctions between data frames and lists, and the syntax for control statements and functions in R. The exam is designed to assess students' understanding of programming concepts and their application in R.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Mid - 1 - 2021-22 (R&Python)

This document outlines a mid-term examination for a B.Sc. course on Programming with R and Python at Jatiya Kabi Kazi Nazrul Islam University. It includes questions on R commands, matrix definitions, distinctions between data frames and lists, and the syntax for control statements and functions in R. The exam is designed to assess students' understanding of programming concepts and their application in R.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Jatiya Kabi Kazi Nazrul Islam University

Department of Statistics
B. Sc. 2nd Year 2nd Semester Mid-I
Course Code: STAT-217, Course Title: Programming with R and Python

Times: 45 Minutes Full Marks: 10


a) If the following commands were type into the console window of R, write down the response 3
if any,
(i) if x<-c(1, 2, 3, 10, 8), then find sort(x, descending=T)
(ii) if x=5, y=3, then find (x/2+5)%%y, x%/%y and sqrt(y^2+2*x-4)
(iii) if x<-c(1, 2, NA, 3, 5, 8, 13)
x[[Link](x)]<-0
y<-x[-1]-x[-length(x)]
b) Define matrix in R with example. Distinguish between data frame and list. When to use the 3
function which(), rbind (), and cbind in R?
c) When do you use and write down the syntax of if statement, ifelse statement, and for loop 4
statement? Briefly describe different components of function in R. Write a R function to
calculate the variance of a random variable.

Jatiya Kabi Kazi Nazrul Islam University


Department of Statistics
B. Sc. 2nd Year 2nd Semester Mid-I
Course Code: STAT-217, Course Title: Programming with R and Python

Times: 45 Minutes Full Marks: 10


a) If the following commands were type into the console window of R, write down the 3
response if any,
(iv) if x<-c(1, 2, 3, 10, 8), then find sort(x, descending=T)
(v) if x=5, y=3, then find (x/2+5)%%y, x%/%y and sqrt(y^2+2*x-4)
(vi) if x<-c(1, 2, NA, 3, 5, 8, 13)
x[[Link](x)]<-0
y<-x[-1]-x[-length(x)]
b) Define matrix in R with example. Distinguish between data frame and list. When to use the 3
function which(), rbind (), and cbind in R?
c) When do you use and write down the syntax of if statement, ifelse statement, and for loop 4
statement? Briefly describe different components of function in R. Write a R function to
calculate the variance of a random variable.

You might also like