β˜‘ MCQ PRACTICE

R Programming Unit 4

Practice objective questions for quick revision and examination preparation. Try answering each question before revealing the answer.

πŸ“š R Programming
πŸ“– Unit 4
🎯 MCQs
MCQ Practice

R Programming β€” Unit 4

Practice the following objective questions. Click β€œShow Answer” whenever you want to check your answer.

01

Which function is used to create a factor in R?

A level()
B factor()
C makefactor()
D levels()
Correct Answer factor()
02

Factors in R are used to handle _____ data.

A numeric
B logical
C categorical
D character only
Correct Answer categorical
03

Which function retrieves the levels of a factor?

A levels()
B factor()
C categories()
D classes()
Correct Answer levels()
04

What function is commonly used to tabulate the counts of factor levels?

A count()
B table()
C freq()
D tally()
Correct Answer table()
05

How do you change the order of levels in a factor?

A factor()
B levels()
C relevel()
D order()
Correct Answer relevel()
06

Which of the following is NOT a valid operation on factors?

A Sorting
B Summation
C Tabulation
D Level changing
Correct Answer Summation
07

In R, a table is mainly used to represent:

A Logical operations
B Frequency counts
C String manipulations
D Mathematical equations
Correct Answer Frequency counts
08

Which function is used to create a contingency table?

A ctable()
B cross()
C table()
D xtabs()
Correct Answer xtabs()
09

How do you extract a subtable from a table?

A subset()
B subtable()
C extract()
D slice()
Correct Answer subset()
10

To find the largest cell value in a table, we use:

A max()
B which.max()
C largest()
D findmax()
Correct Answer which.max()
11

To get the total number of elements in a table, use:

A sum()
B total()
C length()
D count()
Correct Answer sum()
12

How do you find the cumulative sum of a numeric vector?

A cumulate()
B cumsum()
C sum()
D accsum()
Correct Answer cumsum()
13

Which function finds the cumulative product?

A cumprod()
B cummult()
C prod()
D accumulate()
Correct Answer cumprod()
14

What function in R finds the minimum value in a vector or table?

A min()
B minimum()
C minval()
D findmin()
Correct Answer min()
15

What function finds the maximum value in a set of numbers?

A max()
B maximum()
C maxval()
D findmax()
Correct Answer max()
16

Which function in R is used for integration (basic calculus)?

A integrate()
B calculus()
C integral()
D deriv()
Correct Answer integrate()
17

Which function computes the derivative of a function?

A deriv()
B diff()
C derive()
D integrate()
Correct Answer deriv()
18

To calculate probability density for a normal distribution, we use:

A pnorm()
B dnorm()
C qnorm()
D rnorm()
Correct Answer dnorm()
19

Which function generates random numbers from a normal distribution?

A pnorm()
B dnorm()
C rnorm()
D qnorm()
Correct Answer rnorm()
20

What does pnorm() compute?

A Random value
B Density
C Cumulative probability
D Quantile
Correct Answer Cumulative probability
21

Which function finds the quantile function of a normal distribution?

A rnorm()
B dnorm()
C pnorm()
D qnorm()
Correct Answer qnorm()
22

Which function would you use to find cumulative probabilities for binomial distribution?

A pbinom()
B dbinom()
C rbinom()
D qbinom()
Correct Answer pbinom()
23

What does dbinom() return?

A Quantile
B Cumulative probability
C Probability mass
D Random variate
Correct Answer Probability mass
24

To calculate probabilities for the Poisson distribution, we use:

A ppois()
B dpois()
C rpois()
D qpois()
Correct Answer dpois()
25

rpois() function is used to:

A Find cumulative probabilities
B Find probability mass
C Generate random numbers
D Find quantiles
Correct Answer Generate random numbers
26

qpois() function in R is used for:

A Probability density
B Random generation
C Quantile calculation
D Summation
Correct Answer Quantile calculation
27

The function ppois() returns:

A Probability density
B Random number
C Cumulative probability
D Quantile
Correct Answer Cumulative probability
28

Which function would you use to calculate cumulative sum for a table column?

A sum()
B cumsum()
C cumprod()
D accumulate()
Correct Answer cumsum()
29

The function to compute the factorial of a number in R is:

A factorial()
B fact()
C factorials()
D factorialnum()
Correct Answer factorial()
30

What function is used to find differences between successive elements?

A diff()
B deriv()
C delta()
D differences()
Correct Answer diff()
← Back to All MCQs