PROGRAMMING IN R (UBCCDE51)
PROGRAMMING IN R (UBCCDE51)
PROGRAMMING IN R
(UBCCDE51)
Question Bank
Prepared by
1. In 1991, R was created by Ross Ihaka and Robert Gentleman in the Department of
2. What is R?
a. A stastical programming language b. A Spread Sheet Program
c. A Web development language d. An operating system
a. B b. B c. C++ d. S
4. Functions are defined using the_____ directive and are stores as R objects.
7. How can you assign the same value to multiple variables in one line?
a. 6 b. 5 c. 4 d. 3
a. D b. R c. L d. K
11. In R programming, the very basic data types are the R-objects called?
14. A data frame is a special type of list where every element of the list has ______ length.
15. A __________ is an R-object which can contain many different types of elements
inside it.
18. __________are Data frames which contain lists of homogeneous data in a tabular
format.
19. Which function takes a dim attribute which creates the required number of
dimensions?
a. S2 b. S3 c. S4 d. Reference Classes
PART – D
a. Blocks are evaluated until a new line is entered after the closing brace
b. Single statements are evaluated.
c. The if/else statement conditionally evaluates two statements
d. Break will execute a loop while a condition is true
c. Functions are also often written when code must be shared with others or the public
10. ________ loop over a list and evaluate a function on each element.
12. The __________ function returns a list of all the formal arguments of a function.
13. You can check to see whether an R object is NULL with the _________ function.
1. Draw the flow chart for the for loop and print the numbers from 1 to 10 using for
loop.
2. Write an R program to find a square for the given vector x->c (5, 12, 13).
3. Discuss about while statement with suitable example.
4. Define Repeat statement and discuss with suitable examples.
5. Write a note and draw the flow chart for the following Statement:
a) Break b) Next
6. Discuss about Looping Over Non-Vector Sets.
7. What are return values? Give an example for return values.
8. Write short notes on No Pointers in R.
9. Write R Code for Quick Sort.
10. Write R Code for Recursion.
11. Explain Functions are Objects in R.
12. Write R Code to return complex object.
13. Describe Default Values for Arguments with suitable example in R.
PART – D
2. Both mathematical and logical concepts are used in computer system in _____ form.
3. ________ generate random Normal variates with a given mean and standard deviation.
14. Which one will not performlinear algebraic operations on a given matrix?
18. _______function input a script and runs a script in the current session?
a. in() b. sink() c.append() d. source()
20. Which of the following argument denotes if the file has a header line?
a. header b. sep c. file d. footer
PART – B(Short Answer Questions)
PART – C
1. What are the different forms of doing Math and Simulation in R. List the different
types of Math with suitable examples in for each?
2. Explain Functions for Statistical Distribution in R.
3. Describe Linear Algebra Operation on Vectors and Matrices with suitable examples
in R.
4. Explain in detail about Set Operations with suitable examples in R.
5. Briefly Discuss about Accessing the Keyboard and Monitor with examples in R.
6. Mention how you can read and writing files with suitable examples in R.
Unit-IV
Part-A (MCQ questions)
2. Which facilities provide basic building blocks that can be used to build up graphs step
by step?
a. low-level graphics facilities b. high-level graphics facilities
c. calling functions d. sequence of functions
6. Which function call sets the limits for the x and y coordinates in the graph?
7. Which data structure is used to plot x-axis and y-axis in plot() function?
8. Which one is the workhorse or generic function for most of the graphical operations?
9. Which one are the correct parameters to use with plot function?
13. Which function is used to draw line graphs using vectors over plotted window?
15. Which arguments is used to produced empty plots with a call to plot () function?
1. Write about Scatter Plot and Histograms with examples? Explain its importance.
2. How to Plot multiple curves in same graph? Explain with examples.
3. Differentiate between Barplot () and Boxplot () function.
4. Explain Histogram () function in R with suitable examples.
5. Write short notes on Strip-Chart () function in R.
6. Explain Pie-Chart () function in R with suitable examples.
7. Explain in Bar-Plot () function in R.
8. Discuss in Box-Plot () function in w with suitable examples.
9. How to save a graph in R?
10. How to specifying through the Hexa-Decimal Values in R.
11. Explain in detail about Color Palette with suitable examples in R.
12. What is Box Plot? Explain importance of boxplot with example.
PART – D
2. The values of the coefficient of the correlation ‘r’ lies between _________.
3. It calculates the relationship between two variables and how one would change in
response to changes in the other ?
6. If there is a very strong correlation between two variables then the correlation
coefficient must be:
12. Which function used to create heat maps from lattice package?
13. ______ function used to create scatterplots, boxplots, and 3D surface plots
respectively.
14. _____ is a type of lattice graph that is used to display the values of afunction of two
variables over a rectangular region.
19. In conducting one way analysis of variance, which of the following test statistics would
be used ?
a. Z b. T c. X2 d.F
20. Which of the following best describes the purpose of using ANOVA in research?
1. Define Statistics.
2. Define Normal Distribution.
3. What is meant by Linear Regression?
4. How R is used in Linear Models?
5. X is the Vector C (5, 9.2, 3, 8.5,1, NA), what is the output of mean(X)?
6. Define ANOVA.
7. What are R Spines?
8. Write about Decision in R.
9. How to used Covariance in R?
10. Write about Logistic Regression in R.
11. Define Multiple Regressions.
12. Explain dnorm () function.
13. Write about Binomial Distribution.
14. Write about Poisson distribution.
15. What is the Probability Distribution in R?
16. How R is used in Logistic Regression?
PART – C