R Programming Language Certification — Questions and Answers
Question 1: What is the primary purpose of the `rvest` package in R?
- Sending HTTP POST requests to REST APIs
- Managing browser cookies and sessions
- Web scraping and parsing HTML/XML content (Correct answer)
- Generating HTML reports from R Markdown
Correct answer: Web scraping and parsing HTML/XML content
The rvest package provides tools for web scraping, allowing R users to read HTML pages and extract structured data using CSS selectors or XPath expressions.
Question 2: What is the primary purpose of regulatory compliance in R Programming Language Certification practice?
- To create bureaucratic burden
- To benefit regulators only
- To protect public safety, ensure quality standards, and maintain professional accountability (Correct answer)
- To limit competition
Correct answer: To protect public safety, ensure quality standards, and maintain professional accountability
This is fundamental to R Programming Language Certification practice. To protect public safety, ensure quality standards, and maintain professional accountability represents the professional standard for regulatory in the R Programming Language Certification certification framework.
Question 3: A finance stakeholder needs a table of summary statistics. Which R package produces publication-quality tables directly from data frames most efficiently?
- kableExtra or gt (Correct answer)
- cat()
- writeLines()
- base print()
Correct answer: kableExtra or gt
kableExtra and gt provide rich formatting options—column alignment, highlighting, footnotes—that turn R data frames into professional HTML or LaTeX tables.
Question 4: Which ggplot2 function controls the color palette for a discrete variable?
- theme_color()
- palette_discrete()
- geom_color()
- scale_fill_manual() (Correct answer)
Correct answer: scale_fill_manual()
scale_fill_manual() allows manual specification of fill colors for discrete variables by providing a named vector of color values.
Question 5: What is the first step in risk assessment for R Programming Language Certification professionals?
- Implementing controls immediately
- Delegating to others
- Identifying potential hazards and vulnerabilities in the specific context (Correct answer)
- Purchasing insurance
Correct answer: Identifying potential hazards and vulnerabilities in the specific context
This is fundamental to R Programming Language Certification practice. Identifying potential hazards and vulnerabilities in the specific context represents the professional standard for risk management in the R Programming Language Certification certification framework.
Question 6: Which R function performs a Wilcoxon rank-sum test (non-parametric equivalent of t-test)?
- mann.whitney()
- wilcox.test() (Correct answer)
- nonpar.test()
- ranksum()
Correct answer: wilcox.test()
wilcox.test() performs both the Wilcoxon signed-rank test (one-sample/paired) and the Wilcoxon rank-sum (Mann-Whitney) test for two independent samples.
Question 7: A data journalist wants to create a choropleth map of US state unemployment rates using ggplot2. After joining unemployment data to a spatial data frame, which geom renders filled polygons for each state?
- geom_map(aes(map_id=state, fill=unemployment_rate))
- geom_polygon(aes(fill=unemployment_rate))
- geom_sf(aes(fill=unemployment_rate)) (Correct answer)
- geom_tile(aes(fill=unemployment_rate))
Correct answer: geom_sf(aes(fill=unemployment_rate))
geom_sf() renders simple features (sf) spatial objects and respects their geometry automatically, making it the modern standard for maps in ggplot2.
Question 8: When running `gage.rr()` in R's `SixSigma` package, a %Contribution of measurement system above what threshold is generally considered unacceptable?
- 5%
- 10%
- 30% (Correct answer)
- 50%
Correct answer: 30%
A measurement system %Contribution (or %Study Variation) above 30% is generally unacceptable; below 10% is acceptable; 10–30% may be acceptable depending on context.
Question 9: In R, what is the primary purpose of Western Electric (WECO) rules applied via `qcc`?
- To calculate control limits using 2-sigma instead of 3-sigma bounds
- To normalize non-Gaussian process data before charting
- To detect non-random patterns beyond just points outside control limits (Correct answer)
- To set the AQL for acceptance sampling plans
Correct answer: To detect non-random patterns beyond just points outside control limits
WECO rules detect non-random patterns (runs, trends, stratification) within control limits that a single 3-sigma rule alone would miss.
Question 10: In ggplot2, which function sets fixed x and y axis limits on a plot?
- xlim() and ylim() (Correct answer)
- coord_range()
- set_limits()
- axis_range()
Correct answer: xlim() and ylim()
xlim() and ylim() (or limits= inside scale_x/y_continuous()) set the visible range of each axis in ggplot2.
Question 11: In R, `lavaan::sem()` is used for which type of analysis common in social science research?
- Spatial estimation modeling
- Sequential experimental modeling
- Survival analysis
- Structural Equation Modeling (Correct answer)
Correct answer: Structural Equation Modeling
The lavaan package's sem() function fits Structural Equation Models, allowing simultaneous estimation of multiple relationships.
Question 12: What does the aes() function do in ggplot2?
- Defines aesthetic mappings between data variables and visual properties (Correct answer)
- Exports plots to files
- Adjusts axis scales
- Sets color themes
Correct answer: Defines aesthetic mappings between data variables and visual properties
aes() (aesthetic mappings) maps data variables to visual properties like x, y, color, size, and shape.
Question 13: In the context of R-based financial modeling subject to SOX compliance, what is the primary purpose of maintaining version control for R scripts?
- To speed up code execution on production servers
- To provide an auditable change history satisfying internal control requirements (Correct answer)
- To enable parallel processing across multiple cores
- To automatically detect syntax errors before runtime
Correct answer: To provide an auditable change history satisfying internal control requirements
SOX (Sarbanes-Oxley) requires auditable evidence of internal controls; version control systems like Git provide a timestamped, attributed history of every code change.
Question 14: Which function computes summary statistics for each group after group_by()?
- aggregate()
- summarise() (Correct answer)
- reduce()
- collapse()
Correct answer: summarise()
summarise() (or summarize()) computes one or more summary statistics for each group defined by group_by().
Question 15: What argument in geom_bar() or geom_col() maps the fill color to a variable?
- fill inside aes() (Correct answer)
- hue= argument
- color= argument
- palette= argument
Correct answer: fill inside aes()
Mapping fill inside aes(), e.g. aes(fill = variable), assigns bar fill colors based on a data variable.
Question 16: Which function in R is used to perform a Wilcoxon rank-sum test (non-parametric alternative to t-test)?
- nonpar.test()
- kruskal.test()
- wilcox.test() (Correct answer)
- rank.test()
Correct answer: wilcox.test()
wilcox.test() performs the Wilcoxon rank-sum (Mann-Whitney) test or Wilcoxon signed-rank test for non-normal data.
Question 17: Which ggplot2 function allows you to arrange multiple separate plots in a grid layout?
- patchwork or gridExtra (Correct answer)
- layout()
- par(mfrow=)
- facet_grid()
Correct answer: patchwork or gridExtra
The patchwork package and gridExtra's grid.arrange() are commonly used to combine separate ggplot2 plots into one figure.
Question 18: What is a compliance management system in R Programming Language Certification practice?
- A structured framework of policies, procedures, and controls that ensure regulatory adherence (Correct answer)
- A government reporting requirement
- An optional business tool
- A software application only
Correct answer: A structured framework of policies, procedures, and controls that ensure regulatory adherence
This is fundamental to R Programming Language Certification practice. A structured framework of policies, procedures, and controls that ensure regulatory adherence represents the professional standard for regulatory in the R Programming Language Certification certification framework.
Question 19: In R, the `evd` package function `fpot()` is used to fit which model relevant to tail risk?
- ARMA model for volatility
- Peaks Over Threshold (POT) using the Generalized Pareto Distribution (Correct answer)
- Normal mixture model
- Logistic regression for default
Correct answer: Peaks Over Threshold (POT) using the Generalized Pareto Distribution
`fpot()` fits a Generalized Pareto Distribution to exceedances over a chosen threshold, central to Peaks-Over-Threshold analysis.
Question 20: The statements in the following program will be executed in the following order: <br> Line 1: print (''welcome'') <br> Line 2: printHello <- function() { <br> Line 3: print(''Hello'') <br> Line 4: } <br> Line 5: printHello() <br> Line 6: print(''done'')
- 1, 2, 3, 4, 5, 6
- 1, 5, 2, 3, 4, 6 (Correct answer)
- 5, 6, 1, 2, 3, 4
- 1, 2, 5, 6, 3, 4
Correct answer: 1, 5, 2, 3, 4, 6
R executes code sequentially. Line 1 prints immediately. Lines 2-4 define the function `printHello`, but the code inside the function body (Line 3) is not executed until the function is called. Line 5 calls `printHello()`, causing Line 3 to execute. Finally, Line 6 executes after the function call completes.
Question 21: In R, what is the correct way to perform a multi-variate control chart (T² chart) for monitoring two correlated quality characteristics simultaneously?
- T2chart(data, vars=c('x','y'))
- mqcc(data, type='T2') (Correct answer)
- qcc(data, type='multivariate')
- hotellingT2(data)
Correct answer: mqcc(data, type='T2')
`mqcc()` from the `qcc` package handles multivariate quality control, with `type='T2'` specifying the Hotelling T² control chart for correlated variables.
Question 22: Which dplyr function removes duplicate rows from a data frame?
- dedupe()
- unique_rows()
- filter_unique()
- distinct() (Correct answer)
Correct answer: distinct()
distinct() returns only unique rows from a data frame, optionally based on specified columns.
Question 23: Which R package is most widely used for creating layered, publication-quality graphics?
- plotly
- base graphics
- lattice
- ggplot2 (Correct answer)
Correct answer: ggplot2
ggplot2 implements the Grammar of Graphics, allowing users to build complex, publication-quality plots by layering geometric objects and aesthetics.
Question 24: R language's apply function requires __ arguments
- 3
- 4 (Correct answer)
- 1
- 5
Correct answer: 4
The `apply()` function in R is designed to apply a function to the margins (rows or columns) of a matrix or array. Its standard signature is `apply(X, MARGIN, FUN, ...)`, meaning it requires at least three arguments: the array/matrix `X`, the `MARGIN` (1 for rows, 2 for columns), and the `FUN`ction to apply. The `...` allows for passing additional arguments to `FUN`, making it a fourth conceptual argument slot.
Question 25: What does the dplyr function group_by() do?
- Groups rows for subsequent summarise operations (Correct answer)
- Merges two data frames
- Removes duplicate rows
- Sorts rows by a column
Correct answer: Groups rows for subsequent summarise operations
group_by() defines groups within a data frame so that subsequent operations like summarise() are applied to each group separately.
Question 26: Which R package is most widely used for creating advanced data visualizations based on the Grammar of Graphics?
- base graphics
- ggplot2 (Correct answer)
- plotly
- lattice
Correct answer: ggplot2
ggplot2, created by Hadley Wickham, implements the Grammar of Graphics and is the most popular R visualization package.
Question 27: Which function adds axis labels and a title to a ggplot2 plot?
- axis_labels()
- annotate()
- title()
- labs() (Correct answer)
Correct answer: labs()
labs() sets plot labels including title, subtitle, caption, and axis labels (x, y) in a single concise function call.
Question 28: What does the aes() function define in ggplot2?
- Theme settings
- Plot colors and fonts
- Axis labels and titles
- Aesthetic mappings between data variables and visual properties (Correct answer)
Correct answer: Aesthetic mappings between data variables and visual properties
aes() (aesthetics) maps data variables to visual properties like x/y position, color, size, and shape in a ggplot2 plot.
Question 29: Which ggplot2 function call adds a clear, descriptive title and axis labels to a plot before sharing with stakeholders?
- ggtitle() only
- annotate()
- xlab() and ylab() only
- labs(title = '...', x = '...', y = '...') (Correct answer)
Correct answer: labs(title = '...', x = '...', y = '...')
labs() is the unified ggplot2 function for setting title, subtitle, caption, and all axis labels in a single, readable call.
Question 30: Which R package provides tools for cross-validation and training machine learning models with a unified interface?
- mlr
- tidymodels
- caret (Correct answer)
- scikit
Correct answer: caret
caret (Classification And REgression Training) provides a unified interface for training, tuning, and evaluating hundreds of ML models.
Question 31: Which R function serializes an R object to a binary format for saving to disk?
- dump()
- write.csv()
- dput()
- saveRDS() (Correct answer)
Correct answer: saveRDS()
saveRDS() saves a single R object to a binary .rds file that can be restored with readRDS().
R Programming Language Certification
The R Programming Language Certification validates proficiency in statistical computing, data manipulation, visualization, and practical R programming skills used across data science and analytics workflows.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds