Genpact R Programming Interview Questions & Answers
Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Genpact hiring for R Programming roles
Genpact is a professional services company that began as a unit of General Electric in India. It provides business process management, finance and accounting operations, analytics, data and AI services. In India it hires for process associates, business analysts, data analysts, data engineers and data scientists.
For R Programming roles, this Genpact practice set focuses most on R Basics and Data Types (6), Data Visualization with ggplot2 (6), Modelling and Machine Learning in R (5), Functions and Functional Programming (4). It has 14 easy, 15 medium, 1 hard questions, so you can start easy and work up to the harder ones.
Company type
IT services
Headquarters
New York, USA
Main India offices
Gurugram, Hyderabad, Bengaluru, Noida, Kolkata
Genpact R Programming interview process
Online assessment (aptitude + English)
Technical or domain interview
Managerial round
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for GenpactStart 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
A numeric column in your data has been read as character. How do you fix it?
I first find the offending values, for example with unique(df$amount[is.na(as.numeric(df$amount))]), which reveals entries like '1,200', 'NA ' or '-'. Then I clean them, removing commas with gsub(',', '', x) and spaces with trimws(), and convert with as.numeric(). With readr I can also pass na = c('', '-', 'NA') and col_types so the column is parsed correctly at load time instead of being fixed later.
02
What is the difference between errors, warnings and messages in R?
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.
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.
04
What is the difference between if, ifelse() and dplyr's if_else()?
if is a control-flow statement that checks a single TRUE or FALSE value and runs one branch, used for program logic. ifelse() is vectorized and returns a vector of the same length as the condition, used for transforming data. dplyr::if_else() is a stricter vectorized version that requires both outputs to have the same type, preserves classes like dates and has a missing argument for NA conditions, making it safer than ifelse().
05
Reading a 2 GB CSV file with read.csv() is very slow. What would you do?
read.csv() is single-threaded and guesses types slowly. I would switch to data.table::fread() or readr::read_csv(), which are many times faster and multi-threaded. I would read only the needed columns with the select argument and set column types explicitly. If the file is reused, I convert it once to a binary format like Parquet with the arrow package, which loads in seconds and supports reading just a subset of columns.
06
What is vectorization in R and why does it matter?
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.
An array is a multi-dimensional generalization of a matrix, created with array(data, dim = c(rows, cols, layers)). All elements share one type. For example, array(1:24, dim = c(2, 3, 4)) has four layers of 2 by 3 matrices, and you index with arr[1, 2, 3]. Arrays are used for image data, simulation outputs and time by region by product cubes, though for business analysis long-format data frames are usually easier to work with.
apply() works over rows or columns of a matrix, lapply() applies a function to each element of a list and returns a list, sapply() simplifies the result to a vector or matrix when possible, vapply() is like sapply() but requires a declared output type, making it safer, and mapply() iterates over several vectors in parallel. tapply() applies a function by groups. For example, sapply(df, class) returns the class of each column.
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.
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.
11
How do you calculate ROC AUC and plot an ROC curve in R?
A factor stores categorical data as integer codes with a set of labels called levels. Factors are used for variables like gender, city or rating, and modelling functions such as lm() turn them into dummy variables automatically. Ordered factors, created with factor(x, levels = c('Low', 'Medium', 'High'), ordered = TRUE), support comparisons. A common pitfall is as.numeric() on a numeric factor, which returns codes; use as.numeric(as.character(f)) instead.
13
What is tidymodels and how does it compare with caret?
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.
14
Write code to show the distribution of order values using a histogram and a boxplot by category.
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.
Overfitting happens when a model learns noise in the training data, so it performs very well on training data but poorly on new data. Signs are a large gap between training and validation scores. Prevention includes using simpler models, regularization such as lasso or ridge, cross-validation for tuning, limiting tree depth, getting more data and removing leaky or irrelevant features. Underfitting is the opposite: the model is too simple to capture the pattern.
17
Why should R projects use Git and how does RStudio support it?
Git tracks every change to code, lets you revert mistakes, work on branches and collaborate through pull requests and reviews. RStudio has a built-in Git pane to stage, commit, diff, pull and push, and usethis::use_git() and use_github() set up repositories. Keep data files, secrets and outputs out of Git with .gitignore, commit the renv.lock file and write clear commit messages. Version control is expected even for analysis work.
R Markdown is a file format that combines narrative text written in Markdown with R code chunks. When rendered with knitr, the code runs and its output, such as tables and charts, is inserted into an HTML, PDF or Word document. This makes reports reproducible: when data changes, you re-render instead of copying charts manually. It is used for monthly reports, research papers, client deliverables and teaching material.
19
How do you write a function in R with default arguments?
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
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.
renv is a package that creates a project-specific library and records exact package versions in a renv.lock file. renv::init() sets up the project, renv::snapshot() updates the lockfile and renv::restore() installs the same versions on another machine or server. This prevents code from breaking when packages update, makes analysis reproducible months later and is essential before deploying scripts or Shiny apps to production.
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.
24
How do you interpret the summary output of an lm() model?
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.
25
What is the difference between Quarto and R Markdown?
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.
26
How do you save a ggplot chart for a report or presentation?
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)
27
How do you create sequences and repeated values in R?
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
28
Write dplyr code to find total and average sales by city, sorted by total.
I use colour-blind-safe palettes such as viridis with scale_colour_viridis_d() or the Okabe-Ito palette, and avoid red-green contrasts. I never rely on colour alone: I add direct labels, different shapes or line types, and facets. I limit categories to around six colours and highlight one key series while greying the rest. I also check charts with a colour-blindness simulator, such as the colorblindr package, before sharing.
plotly's ggplotly() converts an existing ggplot into an interactive chart with hover tooltips, zoom and legend toggling. ggiraph adds interactive tooltips and selection to ggplot geoms with fine control. highcharter and echarts4r wrap JavaScript charting libraries, and leaflet builds interactive maps. These outputs work in R Markdown or Quarto HTML reports and Shiny apps. For static PDF reports, standard ggplot2 is still the better choice.
Tips to crack the Genpact R Programming interview
Learn process improvement basics like Lean and Six Sigma, which have long been part of Genpact's operating style.
Revise Excel, SQL and basic statistics for analytics roles, with examples of reporting or automation you built.
Read about Genpact's origins at GE and its finance and accounting outsourcing business for company questions.
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; Genpact interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Genpact R Programming interview?
Candidates usually go through 4 stages: Online assessment (aptitude + English); Technical or domain interview; Managerial round; 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 Genpact R Programming interview?
This practice set leans on R Basics and Data Types (6), Data Visualization with ggplot2 (6), Modelling and Machine Learning in R (5), Functions and Functional Programming (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Genpact interviewers ask you to walk through real work.
Are these the exact questions asked at Genpact?
No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Genpact's. They are not a leaked or verified list of past questions.
Where does Genpact hire R Programming professionals in India?
Genpact has large teams in Gurugram, Hyderabad, Bengaluru, Noida, Kolkata. Openings and locations change often, so check the Genpact careers page and filter by city and experience.