Skip to content

R Programming Interview Questions in Bhubaneswar

36 practice questions with answers for R Programming interviews in Bhubaneswar.

R Programming jobs in Bhubaneswar

Bhubaneswar is eastern India's emerging IT hub, with campuses of large IT-services companies in Infocity and Info Valley. Freshers make up a big share of hiring, so fundamentals and aptitude rounds matter most.

Below are 36 questions that match the mix of service, product and domain employers hiring r data analysts in Bhubaneswar.

Solved for BhubaneswarStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

What is the grammar of graphics in ggplot2?

Save to ▾
Show answer
The grammar of graphics describes a plot as layers built from components: data, aesthetic mappings that link variables to visual properties like x, y and colour, geoms that draw shapes, stats that transform data, scales, coordinate systems, facets and themes. In ggplot2 you start with ggplot(data, aes(x, y)) and add layers with +, such as geom_point(). This makes complex charts systematic and easy to modify.
02

How do you add logging to a production R script?

Save to ▾
Show answer
The logger package gives levelled, timestamped logs written to the console or a file. library(logger) log_appender(appender_file('logs/etl.log')) log_threshold(INFO) log_info('ETL started') res <- tryCatch({ df <- load_orders() log_info('Loaded {nrow(df)} rows') df }, error = function(e) { log_error('Load failed: {conditionMessage(e)}') quit(status = 1) }) log_info('ETL finished')
03

Explain the difference between NA, NULL and NaN in R.

Save to ▾
Show answer
NA means a missing value and has a type, such as NA_integer_ or NA_character_. NULL means the absence of an object, has length 0 and disappears when combined with c(). NaN means not a number, the result of undefined maths like 0/0. is.na() returns TRUE for both NA and NaN, while is.nan() is TRUE only for NaN. For example, length(c(1, NULL, 3)) is 2 but length(c(1, NA, 3)) is 3.
04

What is the difference between geom_bar() and geom_col()?

Save to ▾
Show answer
geom_bar() counts rows for each x value by default using stat = 'count', so you give only x, for example the number of orders per city from raw data. geom_col() uses y values as they are, so you supply already summarised data, for example total sales per city. geom_bar(stat = 'identity') is equivalent to geom_col(). Using geom_bar() with a y aesthetic gives an error, which is a common beginner issue.
05

Your function gives correct results when you test it but wrong results in the main script. What could be the cause?

Save to ▾
Show answer
A common cause is that the function reads a variable from the global environment instead of taking it as an argument. During testing that global variable had one value, and in the main script it has another. Lexical scoping finds it silently. I would check the function body for names not defined as arguments or locally, for example using codetools::findGlobals(fn), and pass everything explicitly so the function is self-contained.
06

What is the tidyverse?

Save to ▾
Show answer
The tidyverse is a collection of R packages that share a common design and grammar for data science. Core packages include readr for importing, dplyr for transformation, tidyr for reshaping, ggplot2 for visualization, purrr for functional programming, stringr for text, forcats for factors and lubridate for dates. library(tidyverse) loads the core set. Its consistent function names and the pipe make analysis code readable, which is why most R analytics teams use it.
07

What are the atomic data types in R?

Save to ▾
Show answer
R has six atomic types: logical (TRUE/FALSE), integer (5L), double or numeric (3.14), character ('text'), complex (2+3i) and raw (bytes). typeof() returns the internal type while class() returns the class attribute used for method dispatch. For example, typeof(5) is 'double' but typeof(5L) is 'integer'. Knowing types matters because mixing them in one vector triggers coercion to the most flexible type.
08

How do you save a ggplot chart for a report or presentation?

Save to ▾
Show answer
ggsave() saves the last plot or a named plot with exact size and resolution. p <- ggplot(df, aes(city, sales)) + geom_col() ggsave('output/sales_by_city.png', plot = p, width = 8, height = 5, dpi = 300) ggsave('output/sales_by_city.pdf', plot = p, width = 8, height = 5) # vector, sharp at any zoom # svg for web use ggsave('output/sales_by_city.svg', plot = p)
09

In your regression, coefficient signs look wrong and standard errors are huge. What might be the problem?

Save to ▾
Show answer
This is a classic sign of multicollinearity, where predictors are highly correlated, for example total spend and online spend. The model cannot separate their effects, so coefficients become unstable. I check correlations and the variance inflation factor with car::vif(); values above 5 or 10 are a concern. Solutions are removing or combining correlated variables, using principal components or ridge regression. Prediction accuracy may be fine, but interpretation is unreliable.
10

What is the difference between Pearson and Spearman correlation?

Save to ▾
Show answer
Pearson correlation measures the strength of a linear relationship between two numeric variables and is sensitive to outliers. Spearman correlation is computed on ranks, so it measures monotonic relationships and is robust to outliers and non-normal data. In R, cor(x, y, method = 'spearman') and cor.test() compute them. For example, ad spend and sales with diminishing returns may show a moderate Pearson value but a high Spearman value.
11

What does drop = FALSE do when subsetting?

Save to ▾
Show answer
When you subset a single column or row from a matrix or base data frame with [ ], R simplifies the result to a vector by default. Writing m[, 1, drop = FALSE] keeps it as a matrix or data frame. This matters inside functions, because code expecting a data frame breaks when a selection leaves only one column. Tibbles never drop dimensions, which is one reason developers prefer them in reusable code and packages.
12

How do you install and load a package, and what is the difference between library() and require()?

Save to ▾
Show answer
install.packages() downloads from CRAN once; library() loads it in every session. library() throws an error if the package is missing, while require() returns FALSE with a warning, so require() suits conditional checks. install.packages('dplyr') library(dplyr) if (!require('data.table')) { install.packages('data.table') library(data.table) }
13

How are dates and times handled in R?

Save to ▾
Show answer
Base R stores dates as the Date class, counting days since 1970-01-01, and date-times as POSIXct, counting seconds. as.Date('2026-03-15') parses ISO strings and format() controls output. The lubridate package simplifies parsing with ymd(), dmy() and mdy(), extracting parts with month() and wday(), and arithmetic like date + months(1). Time zones matter: Indian data usually uses 'Asia/Kolkata', and mixing UTC with IST can shift records across days.
14

When would you report the median instead of the mean?

Save to ▾
Show answer
The mean uses every value and is sensitive to outliers, while the median is the middle value and is robust to them. I report the median for skewed data such as salaries, house prices, order values or delivery times, where a few extreme values pull the mean up. For example, if most employees earn 6 LPA and a few earn 80 LPA, the median describes a typical employee better. The mode suits categorical data.
15

What is the difference between Quarto and R Markdown?

Save to ▾
Show answer
Quarto is the next-generation publishing system from Posit. It works with R, Python, Julia and Observable, and is a standalone command-line tool rather than an R package. It uses the same knitr engine for R and similar syntax, with chunk options written as #| comments. Quarto adds consistent support for websites, books, presentations and dashboards. R Markdown is still supported, but new projects increasingly use Quarto, especially in mixed R and Python teams.
16

How do you manage working directories and file paths in an R project?

Save to ▾
Show answer
getwd() shows and setwd() changes the working directory, but a hardcoded setwd() breaks on other machines. RStudio projects with the here package build paths relative to the project root. getwd() library(here) sales <- read.csv(here('data', 'sales.csv')) write.csv(summary_df, here('output', 'summary.csv'), row.names = FALSE) file.exists(here('data', 'sales.csv')) list.files(here('data'), pattern = 'csv$')
17

You need month-over-month sales growth for each product. How do you calculate it in R?

Save to ▾
Show answer
I first aggregate to one row per product and month with group_by() and summarise(). Then I group by product, arrange by month and use mutate(growth = (sales - lag(sales)) / lag(sales) * 100). The first month for each product becomes NA, which is correct. I make sure months with zero sales exist using tidyr::complete(), otherwise lag() compares non-consecutive months. Finally I round and format growth for reporting.
18

Tell me about a time your analysis did not support what a stakeholder hoped to see.

Save to ▾
Show answer
Situation: a marketing head expected a new campaign to have doubled sign-ups. Task: evaluate its impact. Action: my analysis in R using a pre-post comparison with a control region showed only a 6 percent lift, much of it seasonal. I presented the method and confidence interval openly, acknowledged what went well and suggested a cleaner randomized test. Result: the stakeholder accepted the finding, and the next campaign was run as a proper experiment.
19

Product wants to detect a lift in conversion from 5 to 5.5 percent. How many users do you need per group?

Save to ▾
Show answer
I use power analysis before the test starts. In R, power.prop.test(p1 = 0.05, p2 = 0.055, power = 0.8, sig.level = 0.05) gives roughly 31,000 users per group. Smaller lifts need far larger samples, since sample size scales with the inverse square of the effect. I would then convert the sample into test duration using daily traffic, round up to full weeks, and agree on the stopping rule in advance to avoid peeking bias.
20

Your function fails with 'the condition has length > 1' when given a vector. What is wrong?

Save to ▾
Show answer
An if statement can only check a single TRUE or FALSE value, and since R 4.2 a longer condition is an error. The function was written for one value but received a vector. I would replace if with a vectorized alternative such as ifelse(), dplyr::if_else() or case_when(). If the function is truly meant for single values, I validate the input length with stopifnot(length(x) == 1) or apply it over elements with purrr::map().
21

How do you test whether two categorical variables are related in R?

Save to ▾
Show answer
Use a chi-square test of independence on a contingency table; use Fisher's exact test when expected counts are small. tab <- table(survey$city_tier, survey$preferred_plan) tab res <- chisq.test(tab) res$p.value res$expected # check expected counts >= 5 fisher.test(tab) # for small samples # effect size library(rcompanion) cramerV(tab)
22

How would you impute missing values differently for each group?

Save to ▾
Show answer
I group by the relevant category, such as product category, and replace NAs with that group's median: group_by(category) %>% mutate(price = coalesce(price, median(price, na.rm = TRUE))) %>% ungroup(). Group medians are more realistic than a global value. I also add a flag column marking imputed rows so models and reviewers can see them. If a whole group is missing, I fall back to the overall median, and for important features I consider model-based imputation.
23

How do you build a linear regression model in R?

Save to ▾
Show answer
lm() fits linear models using formula syntax; summary() shows coefficients and fit. fit <- lm(sales ~ ad_spend + price + region, data = stores) summary(fit) coef(fit) confint(fit) # 95% CIs for coefficients predict(fit, newdata = new_stores, interval = 'prediction') par(mfrow = c(2, 2)); plot(fit) # diagnostic plots broom::tidy(fit) # coefficients as a tibble
24

Describe a disagreement with a teammate about a technical approach.

Save to ▾
Show answer
Situation: a teammate wanted to build our reporting pipeline in Excel macros, while I preferred R scripts. Task: agree on an approach quickly. Action: instead of arguing, we listed requirements together: refresh frequency, data size and who would maintain it. I built a small R prototype in a day to compare. Result: we chose R for the pipeline and kept an Excel output for users, and my teammate later helped improve the formatting.
25

How do you handle errors in R code?

Save to ▾
Show answer
tryCatch() catches errors and warnings so a script can recover or log them; finally runs cleanup. read_safe <- function(path) { tryCatch({ readr::read_csv(path, show_col_types = FALSE) }, warning = function(w) { message('Warning in ', path, ': ', conditionMessage(w)) NULL }, error = function(e) { message('Failed: ', path, ' - ', conditionMessage(e)) NULL }, finally = message('Done: ', path)) }
26

The same 40 lines of cleaning code are copied into ten scripts. What would you do?

Save to ▾
Show answer
I would extract the logic into well-named functions with arguments for the parts that differ, then move them into one shared file loaded with source() or, better, a small internal R package. A package gives documentation with roxygen2, tests with testthat and versioning, so every script uses the same tested logic. Fixing a bug then happens in one place. I would migrate the scripts gradually and compare outputs to confirm nothing changed.
27

How do you create, modify and combine lists in R?

Save to ▾
Show answer
Lists are built with list(), modified by name and combined or flattened when needed. emp <- list(name = 'Asha', skills = c('R', 'SQL'), exp = 3) emp$city <- 'Pune' # add element emp[['exp']] <- 4 # update emp$skills <- NULL # remove names(emp) parts <- lapply(1:3, function(i) data.frame(id = i, sq = i^2)) do.call(rbind, parts) # combine data frames unlist(list(a = 1, b = list(c = 2))) # flatten
28

Tell me about feedback you received in a code review and what you changed.

Save to ▾
Show answer
Situation: in my first quarter, a senior reviewed my R reporting script. Task: address the review comments. Action: the main feedback was that my 300-line script mixed data loading, cleaning and plotting with repeated code. I split it into small functions, added input checks and moved constants to a config file. Result: the next report took half the time to build, and I now structure every new script this way from the start.
29

How is a matrix different from a data frame?

Save to ▾
Show answer
A matrix is a two-dimensional atomic vector, so all elements share one type, usually numeric. A data frame allows a different type per column. Matrices are faster for linear algebra, such as %*% multiplication, solve() and distance calculations, while data frames suit mixed real-world data. For example, the output of cor() is a matrix, while customer records with names, dates and amounts belong in a data frame. as.matrix() and as.data.frame() convert between them.
30

How do you interpret the summary output of an lm() model?

Save to ▾
Show answer
Each coefficient is the expected change in the outcome for a one-unit increase in that predictor, holding others constant. The p-value tests whether the coefficient differs from zero. R-squared is the share of variance explained, and adjusted R-squared penalizes extra predictors. Residual standard error shows typical prediction error in outcome units. The F-statistic tests whether the model beats an intercept-only model. For factors, coefficients are differences from the reference level.
31

You notice database passwords hardcoded in a shared R script. What do you do?

Save to ▾
Show answer
I remove them immediately, inform the owner and ask for the password to be rotated, since it may exist in version history. Then I store credentials outside the code, in a user-level .Renviron file read with Sys.getenv(), the keyring package backed by the operating system's credential store, or the server's secret management, such as environment variables in Posit Connect. I make sure .Renviron is listed in .gitignore and scan the repository history.
32

What is Shiny and how is a Shiny app structured?

Save to ▾
Show answer
Shiny is an R package for building interactive web applications without writing HTML or JavaScript. An app has a ui that defines layout and inputs such as dropdowns and sliders, and a server function that contains R logic and creates outputs such as plots and tables. shinyApp(ui, server) runs the app. Analytics teams use Shiny for internal dashboards, what-if calculators and tools that let business users explore data.
33

What are the principles of tidy data?

Save to ▾
Show answer
Tidy data follows three rules: each variable is a column, each observation is a row and each type of observational unit forms a table. For example, a sales sheet with separate columns for Jan, Feb and Mar is not tidy, because month is a variable spread across columns. Reshaping it into month and sales columns makes it tidy. Tidy data works directly with dplyr, ggplot2 and modelling functions, reducing reshaping effort later.
34

Overall, treatment A has a higher success rate than B, but B is better in every hospital. How is that possible?

Save to ▾
Show answer
This is Simpson's paradox. It happens when a confounding variable, here hospital or patient severity, is unevenly distributed between groups. If A was used mostly in hospitals with easier cases, its overall rate looks better even though B wins within each hospital. In R I would group by hospital and compare rates, then use a stratified analysis or regression with hospital as a covariate to estimate the adjusted effect.
35

Write a recursive function in R to calculate factorial and Fibonacci numbers.

Save to ▾
Show answer
A recursive function calls itself with a smaller input and needs a base case. fact <- function(n) { if (n <= 1) return(1) n * fact(n - 1) } fact(5) # 120 fib <- function(n) { if (n <= 2) return(1) fib(n - 1) + fib(n - 2) } fib(10) # 55 # vectorized and efficient alternative factorial(5); cumprod(1:5)
36

Code reviews show inconsistent R code style across the team. How would you standardise it?

Save to ▾
Show answer
I would adopt the tidyverse style guide as the team standard, then automate it rather than relying on reviewers. styler reformats code automatically, including an RStudio add-in, and lintr flags issues such as long lines, unused variables and inconsistent naming. I add lintr to a pre-commit hook or a GitHub Actions check so pull requests are checked automatically. A short template for new scripts and projects helps new joiners follow the same structure.

Few big employers listed in Bhubaneswar?

Many Bhubaneswar candidates also apply to teams in Kolkata and to remote or hybrid roles. Practise the Kolkata set as well.

Frequently asked questions

Which companies hire R Programming professionals in Bhubaneswar?

Companies with large offices in Bhubaneswar include many IT services and product firms. Use their company pages below to practise employer-specific sets.

Are R Programming interviews in Bhubaneswar different from other cities?

The questions depend more on the company than the city. Bhubaneswar's mix of employers decides the style: Freshers make up a big share of hiring, so fundamentals and aptitude rounds matter most

How do I find R Programming jobs in Bhubaneswar?

Shortlist companies with Bhubaneswar offices, keep your CV focused on R Programming projects, apply on company career pages and job portals with the Bhubaneswar filter, and practise the questions on this page before each interview.