Skip to content

R Programming Interview Questions in Hyderabad

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

R Programming jobs in Hyderabad

Hyderabad has large engineering and capability centres of global technology, banking and pharma companies around HITEC City and the Financial District. Many roles are with global capability centres that work with teams in the US and Europe.

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

Solved for HyderabadStart 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 difference between mapping and setting an aesthetic in ggplot2?

Save to ▾
Show answer
Mapping links an aesthetic to a variable inside aes(), so values change with the data and a legend is created, for example aes(colour = region). Setting fixes an aesthetic to a constant outside aes(), for example geom_point(colour = 'steelblue'). A common mistake is writing aes(colour = 'blue'), which treats 'blue' as a data value, creates a legend called blue and uses the default red colour instead.
02

How do you write a function in R with default arguments?

Save to ▾
Show answer
A function is created with the function keyword and returns the value of its last expression, or an explicit return(). gst_price <- function(price, rate = 0.18, round_to = 2) { if (!is.numeric(price)) stop('price must be numeric') round(price * (1 + rate), round_to) } gst_price(1000) # 1180 gst_price(1000, rate = 0.05) gst_price(c(100, 250)) # vectorized
03

How do you perform a t-test in R?

Save to ▾
Show answer
t.test() handles one-sample, two-sample and paired tests. Welch's test, which does not assume equal variances, is the default. # two independent groups t.test(score ~ batch, data = students) # paired: before vs after training t.test(after, before, paired = TRUE) # one-sample against a target of 30 minutes t.test(delivery_time, mu = 30, alternative = 'greater') res <- t.test(score ~ batch, data = students) res$p.value; res$conf.int
04

Why does correlation not imply causation?

Save to ▾
Show answer
Two variables can move together because of a third confounding variable, reverse causation or pure chance. For example, ice cream sales and drowning incidents are correlated because both rise in summer. To claim causation you need a randomized experiment such as an A/B test, or careful causal methods like difference-in-differences or regression with controls. In interviews, mention that observational correlations are useful for hypotheses but not proof of impact.
05

How do you validate inputs inside an R function?

Save to ▾
Show answer
Fail early with clear messages using stopifnot(), stop() and match.arg(). summarise_kpi <- function(df, metric = c('revenue', 'orders', 'aov'), min_date = NULL) { stopifnot(is.data.frame(df), nrow(df) > 0) metric <- match.arg(metric) if (!is.null(min_date) && !inherits(min_date, 'Date')) { stop('min_date must be a Date', call. = FALSE) } required <- c('date', metric) missing <- setdiff(required, names(df)) if (length(missing)) stop('Missing columns: ', toString(missing)) # ... compute }
06

Bars in your chart appear in alphabetical order instead of by value. How do you fix it?

Save to ▾
Show answer
ggplot2 orders discrete axes by factor levels, which default to alphabetical. I reorder the factor by the value with forcats: aes(x = fct_reorder(city, sales), y = sales), and add coord_flip() or put the category on the y-axis for long labels. For a fixed custom order, such as months or ratings, I set levels explicitly with factor(x, levels = c(...)). fct_infreq() orders by frequency for count bars.
07

Why is ungroup() important in dplyr?

Save to ▾
Show answer
A grouped data frame stays grouped after mutate() and some other verbs, so later operations silently run per group. For example, a mutate(share = sales / sum(sales)) meant to compute share of grand total would compute share within each group instead. Calling ungroup() after grouped work, or using .groups = 'drop' in summarise() or the .by argument for one-off grouping, prevents these subtle bugs in long pipelines.
08

Write a tidymodels workflow to train and evaluate a random forest.

Save to ▾
Show answer
Split, preprocess, specify, fit and evaluate: library(tidymodels) set.seed(42) split <- initial_split(df, prop = 0.8, strata = churned) train <- training(split); test <- testing(split) rec <- recipe(churned ~ ., data = train) %>% step_impute_median(all_numeric_predictors()) %>% step_dummy(all_nominal_predictors()) rf <- rand_forest(trees = 500) %>% set_engine('ranger') %>% set_mode('classification') wf_fit <- workflow() %>% add_recipe(rec) %>% add_model(rf) %>% last_fit(split) collect_metrics(wf_fit)
09

How do you handle missing values in calculations in R?

Save to ▾
Show answer
Most summary functions return NA if any value is missing, so pass na.rm = TRUE or remove NAs first. x <- c(10, NA, 30, 40) mean(x) # NA mean(x, na.rm = TRUE) # 26.67 sum(is.na(x)) # count missing: 1 x[!is.na(x)] # drop NAs x[is.na(x)] <- median(x, na.rm = TRUE) # impute df[complete.cases(df), ] # rows with no NA
10

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.
11

What is tidymodels and how does it compare with caret?

Save to ▾
Show answer
tidymodels is a collection of packages for modelling with tidyverse principles: rsample for splitting and resampling, recipes for preprocessing, parsnip for a unified model interface, workflows to bundle them, tune for hyperparameter tuning and yardstick for metrics. caret, by the same original author, is an older single package that does similar work with one train() function. caret is stable and still widely used, but new development happens in tidymodels.
12

Explain environments and lexical scoping in R.

Save to ▾
Show answer
An environment is a collection of name-value bindings with a pointer to a parent environment. R uses lexical scoping: when a function looks up a variable, it searches its own environment, then the environment where it was defined, up through the global environment and attached packages. So a function defined inside another can read the outer function's variables, which enables closures. The <<- operator modifies a binding in a parent environment and should be used sparingly.
13

After merging two data frames you get more rows than expected. What happened?

Save to ▾
Show answer
Extra rows after a join usually mean the key is duplicated in one or both tables, so each match multiplies rows. I check uniqueness with df %>% count(key) %>% filter(n > 1) on both sides. Then I decide whether to deduplicate, aggregate before joining or join on a composite key such as customer_id plus month. In dplyr 1.1 and later, the relationship argument, for example 'many-to-one', makes the join fail loudly when this assumption breaks.
14

Finance says 120 transactions are missing from your report compared with their system. How do you find them?

Save to ▾
Show answer
I load both datasets and standardise the key, for example trimming spaces and matching data types for transaction_id. Then anti_join(finance, report, by = 'transaction_id') lists transactions in finance but not in my report, and the reverse anti_join shows extras. I examine the missing rows for patterns such as a date range, status or filter in my code. Usually the cause is a timezone cut-off or an excluded status.
15

What window functions does dplyr provide?

Save to ▾
Show answer
Window functions return one value per row while looking at other rows in the group. Common ones are lag() and lead() for previous or next values, row_number(), min_rank() and dense_rank() for ranking, cumsum() and cummean() for running totals, and ntile() for buckets. For example, group_by(product) %>% arrange(month) %>% mutate(prev = lag(sales)) gives the previous month's sales per product, which is the basis for growth calculations.
16

What is data.table and when would you use it?

Save to ▾
Show answer
data.table is a high-performance package for large tabular data. Its syntax DT[i, j, by] means filter rows with i, compute j, grouped by by. It updates columns by reference with :=, avoiding copies, and offers fast keyed joins and fread()/fwrite() for file IO. For example, DT[city == 'Delhi', .(avg_sal = mean(salary)), by = dept] filters and aggregates in one step. It is popular for datasets with tens of millions of rows.
17

A customer table has multiple records per customer. How do you keep only the latest record for each?

Save to ▾
Show answer
I group by customer_id and keep the row with the latest updated_at using slice_max(updated_at, n = 1, with_ties = FALSE), then ungroup. An alternative is arrange(desc(updated_at)) followed by distinct(customer_id, .keep_all = TRUE). I check that updated_at is a proper date-time and has no NAs, since missing timestamps would be dropped or mis-sorted. Finally I confirm that n_distinct(customer_id) equals the number of rows.
18

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.
19

Explain the different types of joins in dplyr.

Save to ▾
Show answer
left_join() keeps all rows of the left table and adds matching columns from the right, inner_join() keeps only matching rows, right_join() keeps all rows of the right table and full_join() keeps all rows from both, filling NA where there is no match. Keys are given with by = join_by(customer_id) or by = c('id' = 'cust_id') for different names. Left joins are most common when enriching a fact table with lookup details.
20

Tell me about a dashboard or app you built in R.

Save to ▾
Show answer
Situation: regional sales managers waited for a weekly emailed PDF and could not drill into their own data. Task: give them self-service access. Action: I built a Shiny app with filters by region, product and period, used pre-aggregated tables for speed and deployed it on the internal server with login. I ran a short demo and gathered feedback. Result: over 40 managers used it weekly, and ad hoc data requests to our team fell by about half.
21

Explain Type I and Type II errors.

Save to ▾
Show answer
A Type I error is rejecting a true null hypothesis, a false positive, and its probability is the significance level alpha, usually 0.05. A Type II error is failing to reject a false null hypothesis, a false negative, with probability beta; power is 1 - beta. For example, launching a feature that does not actually help is a Type I error, while dropping a feature that really works is Type II. Larger samples reduce Type II errors.
22

How do you debug an R function?

Save to ▾
Show answer
After an error, traceback() shows the call stack so I can see which function failed. I insert browser() inside a function to pause execution and inspect variables interactively, stepping with n and continuing with c. debug(fn) or debugonce(fn) enters the browser on the next call without editing code. options(error = recover) lets me choose a frame to inspect after an error. RStudio breakpoints offer the same features visually.
23

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)
24

Explain the d, p, q and r functions for probability distributions in R.

Save to ▾
Show answer
Each distribution has four functions: d for density, p for cumulative probability, q for quantiles and r for random draws. dnorm(0) # density at 0 pnorm(1.96) # P(Z <= 1.96) = 0.975 qnorm(0.975) # 1.96 rnorm(5, mean = 50, sd = 10) dbinom(3, size = 10, prob = 0.2) # exactly 3 successes ppois(2, lambda = 4) # P(X <= 2) qt(0.975, df = 20) # t critical value
25

What are semi_join() and anti_join() used for?

Save to ▾
Show answer
They are filtering joins: they keep rows of the left table based on matches in the right table but add no columns. semi_join() keeps rows that have a match, and anti_join() keeps rows that have no match. For example, anti_join(customers, orders, by = 'customer_id') lists customers who never ordered. They are also safer than inner joins for filtering, since they never duplicate rows when the right table has repeated keys.
26

Tell me about the messiest dataset you have cleaned.

Save to ▾
Show answer
Situation: I received three years of vendor invoices from different branches in Excel files with inconsistent headers, merged cells and dates in four formats. Task: build one clean table for spend analysis. Action: I used readxl to read all sheets, janitor::clean_names() to standardise headers, lubridate to parse dates and a mapping table for vendor name variants. I wrote validation checks for totals. Result: a clean dataset of 180,000 rows that finance now refreshes monthly.
27

What tools does R offer for time series forecasting?

Save to ▾
Show answer
The forecast package provides auto.arima(), ets() for exponential smoothing and easy plotting of forecasts with intervals. The newer tidyverts family, with tsibble for time-series data frames, fable for models and feasts for features and decomposition, works with tidy data and fits many series at once. prophet handles strong seasonality and holidays. Typical steps are visualizing, decomposing trend and seasonality, fitting candidates and comparing accuracy on a holdout period.
28

What is the structure of an R package?

Save to ▾
Show answer
A minimal package has a DESCRIPTION file with metadata and dependencies, a NAMESPACE file listing exported functions, an R/ folder with function code, a man/ folder for documentation and usually tests/ for testthat tests. The usethis and devtools packages create and manage this: usethis::create_package(), use_r(), use_test(), and devtools::document(), test() and check(). Documentation is written as roxygen2 comments above each function. Internal packages are ideal for sharing team utilities.
29

How do you explain technical results to non-technical managers?

Save to ▾
Show answer
I start with the business question and the answer in one sentence, then show one or two clear charts instead of tables of coefficients. For example, in a college project on customer churn, I said that customers with more than three complaints were twice as likely to leave, showed a simple bar chart and suggested a follow-up call process. I keep technical details in an appendix and invite questions so managers can decide confidently.
30

Tell me about a chart or visualization that changed a business decision.

Save to ▾
Show answer
Situation: the operations team believed late deliveries were spread evenly across the week. Task: I was asked to review delivery data. Action: in R I built a heatmap of late deliveries by weekday and hour with ggplot2, which showed a sharp cluster on Monday mornings linked to weekend order backlog. Result: management added a Sunday evening shift, and late deliveries dropped by about 18 percent the next quarter.
31

What is a tibble and how does it differ from a base data frame?

Save to ▾
Show answer
A tibble is the tidyverse version of a data frame. It prints only the rows and columns that fit the screen along with column types, never converts strings to factors, never changes column names, does not partially match with $ and always returns a tibble when subsetting with [ ]. It also supports list-columns easily. You convert with as_tibble(). Tibbles prevent many silent bugs, though some older packages expect base data frames.
32

Your Shiny dashboard becomes very slow when 50 users open it at once. How do you improve it?

Save to ▾
Show answer
I profile with profvis and reactlog to find slow reactives. I move heavy data loading outside the server function so it runs once per process, pre-aggregate data instead of computing on raw rows, and cache results with bindCache(). I use bindEvent() so expensive work runs only on a button click. Long computations can go to background tasks with ExtendedTask and promises. Finally I scale out with multiple R processes on Posit Connect or Shiny Server Pro.
33

How do you write unit tests for an R function?

Save to ▾
Show answer
testthat organises tests into files under tests/testthat/ using expectations. # tests/testthat/test-gst.R test_that('gst_price adds 18 percent by default', { expect_equal(gst_price(100), 118) expect_equal(gst_price(c(100, 200)), c(118, 236)) }) test_that('gst_price rejects text input', { expect_error(gst_price('abc'), 'numeric') }) # run all tests devtools::test()
34

The finance team wants the daily output as a formatted Excel file, not a CSV. How do you produce it?

Save to ▾
Show answer
I use openxlsx2 or openxlsx to write a workbook with multiple sheets, formatted headers, number formats for INR, column widths, frozen panes and conditional formatting, all from R. writexl is a lightweight option for plain sheets without formatting. I create a template once with the team's preferred layout and generate the file in the scheduled script, then email or upload it to a shared drive. This removes manual formatting every day.
35

What is the purrr map family?

Save to ▾
Show answer
purrr's map() applies a function to each element of a list or vector and always returns a list. Typed variants return specific types: map_dbl(), map_chr(), map_lgl() and map_int(), and they error if a result has the wrong type, which is safer than sapply(). map2() iterates over two inputs, pmap() over many, and walk() is used for side effects like saving files. Formula shortcuts such as ~ .x * 2 keep code short.
36

Write a minimal Shiny app that filters sales by region and plots them.

Save to ▾
Show answer
A ui with an input and an output, and a server that reacts to the input: library(shiny); library(ggplot2); library(dplyr) ui <- fluidPage( selectInput('region', 'Region', choices = unique(sales$region)), plotOutput('trend') ) server <- function(input, output, session) { filtered <- reactive(filter(sales, region == input$region)) output$trend <- renderPlot({ ggplot(filtered(), aes(month, revenue)) + geom_line() }) } shinyApp(ui, server)

Companies with offices in Hyderabad (10)

Frequently asked questions

Which companies hire R Programming professionals in Hyderabad?

Companies with large offices in Hyderabad include Tiger Analytics, Genpact, Deloitte, Accenture, TCS, Cognizant, EY, KPMG, HSBC, Amazon. Use their company pages below to practise employer-specific sets.

Are R Programming interviews in Hyderabad different from other cities?

The questions depend more on the company than the city. Hyderabad's mix of employers decides the style: Many roles are with global capability centres that work with teams in the US and Europe

How do I find R Programming jobs in Hyderabad?

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