Skip to content

Deloitte R Programming Interview Questions & Answers

Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.

About Deloitte hiring for R Programming roles

Deloitte is one of the Big Four professional services networks, offering audit, tax, consulting, risk advisory and financial advisory services. Its Indian entities, including Deloitte USI, support global clients with technology consulting, analytics, cyber and testing work. It hires in India for analyst and consultant roles in data analytics, business intelligence, QA, ERP and risk advisory.

For R Programming roles, this Deloitte practice set focuses most on Functions and Functional Programming (7), Data Visualization with ggplot2 (6), R Basics and Data Types (6), Data Wrangling with dplyr and tidyr (5). It has 3 easy, 21 medium, 6 hard questions, so you can start easy and work up to the harder ones.

Company type
Consulting
Headquarters
London, United Kingdom
Main India offices
Hyderabad, Bengaluru, Mumbai, Gurugram, Pune

Deloitte R Programming interview process

  1. Online assessment (aptitude + technical)
  2. Group discussion or case discussion
  3. Technical interview
  4. Partner or HR round

Typical pattern based on public candidate experiences. Rounds vary by role, team and year.

Solved for DeloitteStart 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

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

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

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

How do you apply the same transformation to many columns in dplyr?

Save to ▾
Show answer
across() applies one or more functions to a set of columns selected with tidyselect helpers. df %>% mutate(across(where(is.character), str_trim)) %>% mutate(across(starts_with('amt_'), ~ round(.x, 2))) df %>% group_by(region) %>% summarise(across(c(sales, profit), list(mean = mean, max = max), .names = '{.col}_{.fn}'))
05

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

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

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().
08

Describe a time you found a data quality issue in your analysis.

Save to ▾
Show answer
Situation: while preparing a monthly revenue dashboard, totals were 8 percent higher than finance figures. Task: find the cause before the review meeting. Action: I traced row counts after each step in my R script and found a join on customer ID that duplicated rows because some customers had two active addresses. I deduplicated the address table and added a row-count check. Result: numbers matched finance, and the check now runs in every refresh.
09

Your R session runs out of memory while processing a large dataset. What steps do you take?

Save to ▾
Show answer
I check object sizes with lobstr::obj_size() and remove large intermediates with rm() followed by gc(). I load only the needed columns and use data.table, which modifies by reference without copies. For data larger than RAM, I push computation into a database through dbplyr, or use arrow with Parquet files so filters and aggregations run before data enters R memory. Chunked reading with readr::read_csv_chunked() is another option for one-pass jobs.
10

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
11

What is the difference between %>% and |> in R?

Save to ▾
Show answer
%>% comes from the magrittr package and |> is the native pipe built into R since version 4.1. Both pass the left side as the first argument of the right side, so df |> filter(x > 1) equals filter(df, x > 1). The native pipe is faster and needs no package, but it uses _ as a named placeholder only, while %>% supports the dot placeholder anywhere. New code increasingly uses |>, and both work with dplyr.
12

What is the difference between errors, warnings and messages in R?

Save to ▾
Show answer
An error, raised with stop(), halts execution because something cannot continue. A warning, raised with warning(), lets code continue but signals a possible problem, such as NAs introduced by coercion. A message, from message(), is informational, such as progress updates. Messages go to stderr, so they can be suppressed with suppressMessages() without hiding results. Use print() or cat() for output the user requested, not for diagnostics.
13

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

How do you add labels and annotations to a ggplot chart?

Save to ▾
Show answer
Use geom_text() or geom_label() for data labels and annotate() for one-off notes. ggplot(city_sales, aes(reorder(city, sales), sales)) + geom_col(fill = 'steelblue') + geom_text(aes(label = scales::comma(sales)), hjust = -0.1, size = 3.5) + annotate('text', x = 2, y = 9e5, label = 'Festive season push') + coord_flip() + expand_limits(y = 1.1e6) + labs(x = NULL, y = 'Sales (INR)')
15

What are facets in ggplot2?

Save to ▾
Show answer
Facets split a plot into small multiples, one panel per category, sharing the same axes and geoms. facet_wrap(~ region) wraps panels for one variable, and facet_grid(rows = vars(segment), cols = vars(year)) creates a grid for two variables. scales = 'free_y' lets each panel have its own y-axis. Facets are often clearer than one chart with many overlapping coloured lines, for example comparing sales trends across ten states.
16

What is type coercion in R and how can it cause bugs?

Save to ▾
Show answer
Coercion is the automatic conversion of values to a common type when they are combined in an atomic vector. The order is logical, then integer, then double, then character. So c(1, 'a', TRUE) becomes the character vector '1', 'a', 'TRUE'. Explicit conversion uses as.numeric(), as.character() and similar functions. A common bug is a numeric column with one stray text value, which turns the whole column into character and breaks calculations.
17

Your dplyr pipeline is too slow on a 50 million row dataset. What are your options?

Save to ▾
Show answer
I can keep dplyr syntax but change the backend. dtplyr translates dplyr code to data.table, which is much faster in memory. duckdb with dbplyr runs the pipeline in an embedded columnar database, often handling data larger than RAM. arrow lets me query Parquet files with dplyr verbs lazily. I would also filter and select early, avoid row-wise operations and profile the pipeline to find the slow step before rewriting anything.
18

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)) }
19

A predictor such as pincode has 500 levels. How do you use it in a model?

Save to ▾
Show answer
Dummy-encoding 500 levels creates sparse, noisy features and overfits rare levels. I first lump rare levels into 'other' with step_other(). Then I consider target or effect encoding with the embed package, applied inside cross-validation to avoid leakage, or mapping pincodes to meaningful higher-level features such as city tier, region or distance to a warehouse. Tree models in some engines handle many levels better, but grouping by business meaning usually works best.
20

You are asked to forecast daily demand for the Diwali season. How do you approach it?

Save to ▾
Show answer
I gather at least two or three years of daily history, since festive peaks happen once a year and Diwali moves across October and November. I add holiday regressors for Diwali, Dussehra and sale events rather than relying on calendar seasonality alone. I compare models like ETS, ARIMA with regressors and prophet in fable, validating on past festive seasons. I report prediction intervals and review with business teams for planned promotions or stock limits.
21

What makes a chart misleading?

Save to ▾
Show answer
Common problems are a truncated y-axis on bar charts, which exaggerates differences because bar length should start at zero, inconsistent scales across panels, 3D effects, cherry-picked time ranges, dual axes with arbitrary ranges and too many colours. Area or bubble charts can mislead when size is mapped to radius instead of area. Good practice is to start bars at zero, label units, cite the data source and show context such as targets or prior periods.
22

Rendering a ggplot with 10 million points is extremely slow. What would you do?

Save to ▾
Show answer
I first question whether all points are needed. I aggregate before plotting, for example binning into hexagons with geom_hex() or summarising by time interval. If raw points are required, the scattermore package rasterizes millions of points quickly, and ggrastr rasterizes just the point layer while keeping text as vector. Saving as PNG instead of PDF also helps, because vector files with millions of shapes are huge and slow to open.
23

What is vectorization in R and why does it matter?

Save to ▾
Show answer
Vectorization means applying an operation to a whole vector at once instead of looping over elements. Most R functions, like +, sqrt() and ifelse(), are vectorized and implemented in C, so they are much faster than R-level for loops. For example, prices * 1.18 adds 18 percent GST to every price in one step. Writing vectorized code is the first optimization an R developer should try before parallel processing or Rcpp.
24

How do you create sequences and repeated values in R?

Save to ▾
Show answer
seq(), rep() and the colon operator build most vectors. 1:10 # integers 1 to 10 seq(0, 100, by = 10) # 0, 10, ..., 100 seq(1, 2, length.out = 5) # 5 evenly spaced values rep(c('A', 'B'), times = 3) # A B A B A B rep(c('A', 'B'), each = 2) # A A B B seq_along(c('x', 'y', 'z')) # 1 2 3, safe for empty vectors seq_len(0) # empty, unlike 1:0
25

Explain reactivity in Shiny.

Save to ▾
Show answer
Shiny uses reactive programming: outputs automatically update when the inputs they depend on change. Inputs are reactive sources, outputs such as renderPlot() are reactive endpoints, and reactive() expressions are cached intermediate results that recompute only when their dependencies change. For example, filtering data once in a reactive() and using it in three charts avoids filtering three times. Shiny tracks dependencies automatically, so you do not write explicit event handlers for most cases.
26

How do you customise scales, labels and themes in ggplot2?

Save to ▾
Show answer
Scales control how data maps to visuals, and themes control non-data elements. p + scale_y_continuous(labels = scales::label_percent()) + scale_fill_brewer(palette = 'Set2') + labs(title = 'Conversion by Channel', subtitle = 'FY 2025-26', caption = 'Source: CRM') + theme_minimal(base_size = 12) + theme(legend.position = 'bottom', plot.title = element_text(face = 'bold'), panel.grid.minor = element_blank())
27

What does copy-on-modify mean in R and how does it affect performance?

Save to ▾
Show answer
When you assign y <- x, both names point to the same object, and R makes a copy only when one of them is modified. tracemem() shows when copies happen. This is why growing a vector in a loop with x <- c(x, value) is slow, because each step can copy the whole vector. Preallocating with vector('numeric', n), using vectorized functions or data.table's modify-by-reference avoids repeated copies and memory spikes.
28

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

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
30

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.

Tips to crack the Deloitte R Programming interview

  • Practise guesstimates and simple business cases, since consulting interviews often test structured thinking alongside technical skills.
  • Be ready to explain dashboards or analyses you built in Excel, SQL, Power BI or Tableau and the business decisions they supported.
  • Read about Deloitte's service lines such as Risk Advisory and Consulting so you can say which practice suits you.
  • Keep a one-minute story ready for every project on your CV: problem, your part, tools, result.
  • Practise the hard questions on this page aloud; Deloitte interviewers usually ask follow-ups on your first answer.

Frequently asked questions

How many rounds are there in the Deloitte R Programming interview?

Candidates usually go through 4 stages: Online assessment (aptitude + technical); Group discussion or case discussion; Technical interview; Partner or HR round. The exact rounds change with the role, team, location and your experience, so confirm the process with the recruiter.

Which topics should I prepare for the Deloitte R Programming interview?

This practice set leans on Functions and Functional Programming (7), Data Visualization with ggplot2 (6), R Basics and Data Types (6), Data Wrangling with dplyr and tidyr (5). Revise those first, then practise explaining one or two of your own projects end to end, because most Deloitte interviewers ask you to walk through real work.

Are these the exact questions asked at Deloitte?

No. These are curated practice questions that match the skills and difficulty usually tested in consulting interviews like Deloitte's. They are not a leaked or verified list of past questions.

Where does Deloitte hire R Programming professionals in India?

Deloitte has large teams in Hyderabad, Bengaluru, Mumbai, Gurugram, Pune. Openings and locations change often, so check the Deloitte careers page and filter by city and experience.

R Programming questions for similar companies