Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Top R Programming Questions and Answers

Rating
-
Sold
-
Pages
39
Grade
A+
Uploaded on
12-09-2025
Written in
2025/2026

This R Programming Q&A document is designed for students, data analysts, and job seekers preparing for interviews or exams. It covers frequently asked questions on R language features, data structures like vectors and data frames, installing and using packages, statistical computing, and data visualization techniques. The document provides clear answers supported by practical coding examples and explanations to help users understand key concepts easily. An invaluable resource for improving your R programming skills and acing technical interviews in data science and analytics domains.

Show more Read less
Institution
Course

Content preview

Statistical Computing and R Programming
SECTION A
I. Answer any 6 questions, each question carries 2 marks: (6x2=12)

1. What is a Lists?
Lists are a heterogeneous data structure and can contain many
different types of elements inside it. The elements of a list can be
numeric, characters, vectors, character vectors, matrices, arrays,
lists, and functions.
2. What is an array?
Arrays are n-dimensional homogeneous data structures. While
matrices are confined to two dimensions, arrays can be of any
number of dimensions. For example, an array of dimensions (2, 3,
3) contains 3 rectangular matrices each with 2 rows and 3 columns.
The array function takes a dim attribute which creates the required
number of dimension.
3. Mention two output statements in R?
Print() and cat().
4. What is a Package?
Packages in R are essential tools for expanding the capabilities of
R by adding new functions, datasets, and even compiled code.
They are a fundamental part of the R ecosystem, allowing users to
perform a wide range of tasks, from data manipulation to statistical
analysis and graphical representation.
5. What is probability?
Probability in R is the measure of the likelihood that an event will
occur. The probability of an event A, denoted as P(A), lies
between 0 and 1, where 0 indicates impossibility and 1 indicates
certainty.
6. What is Median and Mode?

The mean is the average of a data set.

, The mode is the most common number in a data set.
7. What is Error?
Errors most often occur when code is used in a way that it is not
intended to be used.
8. List two components of a hypothesis test?
H0 - Null Hypothesis
HA - Alternate Hypothesis
9. Mention any two method names for linear model selection?

Select a subset of features to include in a linear model.

Use shrinkage methods to constrain the flexibility of linear
models.

Reduce the dimensionality of the data for a linear model.


SECTION B
II. Answer any 4 questions, each question carries 6 marks: (4x6=24)

10. What is R? Describe the basic features of the R Program.
R is a free and open-source programming language and software
environment for statistical computing and graphics. The R
language is widely used among statisticians and data miners for
developing statistical software and data analysis.
Features:

 One of key strength of R is the ease with which a well-designed
and high-quality plots can be produced, including mathematical
symbols and formula wherever needed.
 R is an integrated suite of software facilities for data manipulation,
calculation and graphical display. It includes:
o An effective data handling and storage facility.
o A suite of operators for calculations on arrays, in particular
matrices.
o A large, coherent, integrated collection of intermediate tools for
data analysis.
o Graphical facilities for data analysis and display either on-screen or
on hard-copy.

, o A well-developed, simple and effective programming language
which includes conditionals, loops, user-defined recursive
functions and input and output facilities.
 R has its own LaTeX-like documentation format, which is used for
comprehensive documentation.
 R is available as Free Software under the terms of the Free
Software Foundation’s GNU General Public License in source code
form. It compiles and runs on a wide variety of UNIX platforms
and similar systems (including FreeBSD and Linux), Windows and
MacOS.


11. Write a note on Matrix data structure.
Matrices are two-dimensional, homogeneous data structures.
Matrices are not a separate type of object but simply an atomic
vector with dimensions; the number of rows and columns. As like
atomic vectors, the elements of a matrix must be of the same data
type.

A Matrix can be created using a vector input to the matrix function.

Example:
#creating a matrix
mat <- matrix( c(10, 20, 30, 40, 50, 60),
nrow = 2, ncol = 3,
byrow = TRUE)

#printing the matrix
print(mat)



The output of the above code will be:

[,1] [,2] [,3]
[1,] 10 20 30
[2,] 40 50 60

12. Explain any two if-statements in R with syntax and examples.
If Statement

The If statement is used to execute a block of code when the
condition is evaluated to be true. When the condition is evaluated
to be false, the program will skip the if-code block.

, Syntax
if (condition) {
statements
}

In the example below, the if code block is created which executes
only when the variable i is divisible by 3.
i <- 15
if (i %% 3 == 0){
sprintf("%d is divisible by 3.", i)
}

The output of the above code will be:
[1] "15 is divisible by 3."


If-else Statement

The else statement is always used with if statement. It is used to
execute block of codes whenever if condition gives false result.

Syntax
if (condition) {
statements
} else {
statements
}

In the example below, else statement is used to print a message if
the variable i is not divisible by 3.
i <- 16
if (i %% 3 == 0) {
sprintf("%d is divisible by 3.", i)
} else {
sprintf("%d is not divisible by 3.", i)
}

The output of the above code will be:
[1] "16 is not divisible by 3."

13. Explain poisson distribution in R.

Written for

Institution
Course

Document information

Uploaded on
September 12, 2025
Number of pages
39
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$14.39
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
monikan

Get to know the seller

Seller avatar
monikan St. Joseph\'s convent aided higher primary school
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
7 months
Number of followers
0
Documents
11
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions