R Programming Interview Questions Hindi mein

R Programming कोर्स के 25 सवाल, हर सवाल के सही जवाब और explanation के साथ। जवाब देखने से पहले ख़ुद सोचें।

Getting Started with R

1. For which kind of work is R especially well known?

  1. Statistical analysis and data visualisation
  2. Operating system kernels
  3. Mobile game engines
  4. Device drivers
जवाब देखें

जवाब: Statistical analysis and data visualisation

R was designed for statistics and graphics and excels at them.

पाठ: What R Is For

2. What is the difference between install.packages() and library()?

  1. There is none
  2. library downloads; install.packages loads
  3. Both must be run before every line
  4. install.packages downloads a package once; library loads it into the current session
जवाब देखें

जवाब: install.packages downloads a package once; library loads it into the current session

Installation happens once per machine; loading happens in each R session.

पाठ: Installing R, IDEs, Packages and Projects

3. What does mean(c(72, NA, 90)) return?

  1. 81
  2. 0
  3. NA
  4. An error
जवाब देखें

जवाब: NA

Missing values propagate unless na.rm = TRUE is used.

पाठ: Assignment, Types and Basic Operations

Data Structures

4. In R, what does x[-2] return for x <- c(10, 20, 30)?

  1. 20
  2. 30
  3. c(10, 30)
  4. An error
जवाब देखें

जवाब: c(10, 30)

Negative indices exclude elements, so the second element is dropped.

पाठ: Vectors, Recycling and Indexing

5. For a list x, what is the difference between x["a"] and x[["a"]]?

  1. There is none
  2. x["a"] returns a sub-list; x[["a"]] returns the element itself
  3. x[["a"]] returns a sub-list
  4. Both throw errors
जवाब देखें

जवाब: x["a"] returns a sub-list; x[["a"]] returns the element itself

Single brackets keep the list container; double brackets extract the content.

पाठ: Lists, Factors and Matrices

6. What is a data frame in R?

  1. A list of equal-length column vectors forming a table
  2. A matrix of characters
  3. A plot type
  4. A package
जवाब देखें

जवाब: A list of equal-length column vectors forming a table

Each column is a vector, and all columns have the same length.

पाठ: Data Frames and Tibbles

Programming in R

7. Why is seq_along(x) preferred over 1:length(x) in loops?

  1. It correctly produces an empty sequence when x is empty
  2. It is faster for long vectors
  3. It sorts x
  4. It works only with lists
जवाब देखें

जवाब: It correctly produces an empty sequence when x is empty

1:length(x) gives c(1, 0) for an empty x, causing a loop to run when it should not.

पाठ: Control Flow and Vectorisation

8. What does the native pipe `x |> f(y)` mean?

  1. f(y, x)
  2. x(f, y)
  3. It assigns f to x
  4. f(x, y)
जवाब देखें

जवाब: f(x, y)

The pipe inserts the left-hand value as the first argument of the right-hand call.

पाठ: Functions, Defaults, Dots and Pipes

9. Which purrr function returns a numeric (double) vector, failing if any result is not a single number?

  1. map
  2. keep
  3. map_dbl
  4. reduce
जवाब देखें

जवाब: map_dbl

map_dbl guarantees a double vector output.

पाठ: The apply Family and purrr

Data Wrangling with the Tidyverse

10. Which function standardises messy column names such as "Order ID" into snake_case?

  1. read_csv
  2. glimpse
  3. janitor::clean_names
  4. pivot_longer
जवाब देखें

जवाब: janitor::clean_names

clean_names converts column names to consistent snake_case.

पाठ: Importing and Cleaning Data

11. What does group_by(city) |> summarise(revenue = sum(total)) produce?

  1. One row with total revenue
  2. One row per city with that city's total revenue
  3. The original rows sorted by city
  4. A plot
जवाब देखें

जवाब: One row per city with that city's total revenue

Grouping makes summarise produce one row per group.

पाठ: Transforming Data with dplyr

12. Which join returns rows from the left table that have no match in the right table?

  1. anti_join
  2. left_join
  3. inner_join
  4. full_join
जवाब देखें

जवाब: anti_join

anti_join is ideal for finding unmatched records during data checks.

पाठ: Tidy Data, Reshaping and Joins

Visualisation and Exploration

13. In ggplot2, what does aes() define?

  1. Mappings from data variables to visual properties such as x, y and colour
  2. The file format of the plot
  3. The theme only
  4. The number of bins
जवाब देखें

जवाब: Mappings from data variables to visual properties such as x, y and colour

Aesthetic mappings connect data columns to visual channels.

पाठ: The Grammar of Graphics with ggplot2

14. What does facet_wrap(~ city) do?

  1. Changes the colour palette
  2. Sorts the data
  3. Saves the plot
  4. Creates small multiples: one panel per city
जवाब देखें

जवाब: Creates small multiples: one panel per city

Faceting splits the data into panels by a variable.

पाठ: Facets, Scales, Labels and Themes

15. What is the main goal of exploratory data analysis?

  1. To produce the final published report immediately
  2. To train deep learning models
  3. To understand structure, quality, distributions and relationships in the data before modelling
  4. To delete missing data
जवाब देखें

जवाब: To understand structure, quality, distributions and relationships in the data before modelling

EDA builds understanding and uncovers data problems early.

पाठ: Exploratory Data Analysis

Statistics and Modelling

16. Which R function gives the cumulative probability P(X <= x) for a normal distribution?

  1. dnorm
  2. qnorm
  3. pnorm
  4. rnorm
जवाब देखें

जवाब: pnorm

p-functions return cumulative probabilities; d is density, q is quantile, r is random draws.

पाठ: Descriptive Statistics and Distributions

17. What does a p-value of 0.03 mean?

  1. There is a 3% chance the null hypothesis is true
  2. If the null hypothesis were true, results at least this extreme would occur about 3% of the time
  3. The effect is large
  4. The result is certainly important
जवाब देखें

जवाब: If the null hypothesis were true, results at least this extreme would occur about 3% of the time

p-values are computed assuming the null is true; they are not the probability of the null.

पाठ: Hypothesis Tests and Confidence Intervals

18. Which call fits a logistic regression for a binary outcome in R?

  1. glm(y ~ x, family = binomial)
  2. lm(y ~ x)
  3. t.test(y, x)
  4. cor(y, x)
जवाब देखें

जवाब: glm(y ~ x, family = binomial)

glm with the binomial family fits logistic regression.

पाठ: Linear and Logistic Regression

Strings, Dates, Objects and Performance

19. Which lubridate function parses "03/10/2026" written as day/month/year?

  1. dmy
  2. ymd
  3. mdy
  4. ydm
जवाब देखें

जवाब: dmy

The function name follows the order of components in the input.

पाठ: Strings with stringr and Dates with lubridate

20. How does S3 method dispatch decide which function to call for print(x)?

  1. It always calls print.default
  2. It uses the first argument's length
  3. S3 does not support dispatch
  4. It looks for print.<class of x>, falling back to print.default
जवाब देखें

जवाब: It looks for print.<class of x>, falling back to print.default

S3 generics dispatch on the class attribute to methods named generic.class.

पाठ: Functions as Objects, Environments and S3/R6 Classes

21. Which approach lets dplyr code query a folder of Parquet files larger than memory?

  1. read.csv on each file
  2. Converting everything to a matrix
  3. arrow::open_dataset with dplyr verbs and collect() at the end
  4. Using for loops
जवाब देखें

जवाब: arrow::open_dataset with dplyr verbs and collect() at the end

arrow datasets push filtering and aggregation down to efficient readers before collecting results.

पाठ: Performance and Big Data in R

Reports, Apps, Workflow and Revision

22. What is the main benefit of a Quarto or R Markdown report?

  1. It makes R run faster
  2. It replaces databases
  3. Rerunning it regenerates every result from the data, avoiding copy-paste errors
  4. It only produces PDFs
जवाब देखें

जवाब: Rerunning it regenerates every result from the data, avoiding copy-paste errors

Reproducible documents tie narrative and results directly to code and data.

पाठ: Reproducible Reports with Quarto and R Markdown

23. What does a reactive() expression provide in Shiny?

  1. A static value computed once at start-up
  2. A cached result that recomputes only when the inputs it reads change, and can be shared by several outputs
  3. A way to write JavaScript
  4. A database connection
जवाब देखें

जवाब: A cached result that recomputes only when the inputs it reads change, and can be shared by several outputs

reactive() expressions cache derived data and update when their dependencies change.

पाठ: Interactive Apps with Shiny

25. Which dplyr verb adds or modifies columns?

  1. filter
  2. arrange
  3. summarise
  4. mutate
जवाब देखें

जवाब: mutate

mutate creates or changes columns; filter keeps rows; summarise reduces groups.

पाठ: Revision and Interview Questions

← कोर्स पर वापस जाएँ