Data Visualization With Ggplot2 — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Data Visualization With Ggplot2 — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following code will drop the nth column?
Correct Answer: Option A — new <- old[-n,]
Detailed Academic Explanation:
new <- old[-n,] is the correct answer to “Which of the following code will drop the nth column”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following code drop the ith and jth column?
Correct Answer: Option C — new <- old[,-c(i,j)]
Detailed Academic Explanation:
new <- old[,-c(i,j)] is the correct answer to “Which of the following code drop the ith and jth column”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following statement find cases with no missing values?
Correct Answer: Option A — complete <- subset(data.df,complete.cases(data.df)
Detailed Academic Explanation:
complete <- subset(data.df,complete.cases(data.df) is the correct answer to “Which of the following statement find cases with no missing values”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following statement is normal distribution?
dnorm(x, mean=0, sd=1, log = FALSE) is the correct answer to “Which of the following statement is normal distribution”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
which of the following statement gives cumulative sum?
Correct Answer: Option A — cumsum(x,na=rm=TRUE)
Detailed Academic Explanation:
cumsum(x,na=rm=TRUE) is the correct answer to “which of the following statement gives cumulative sum”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
dunif(x, min=0, max=1, log = FALSE) is the correct answer to “Which of the following is uniform distribution”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following truncates real x to integers?
Correct Answer: Option B — as.integer(x)
Detailed Academic Explanation:
as.integer(x) is the correct answer to “Which of the following truncates real x to integers”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following tests each element of x for membership in y?
Correct Answer: Option D — x%in%y
Detailed Academic Explanation:
x%in%y is the correct answer to “Which of the following tests each element of x for membership in y”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following finds the maximum value in the vector x, exclude missing values?
Correct Answer: Option B — max(x, na.rm=TRUE)
Detailed Academic Explanation:
max(x, na.rm=TRUE) is the correct answer to “Which of the following finds the maximum value in the vector x, exclude missing values”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following produces the variance covariance matrix?
Correct Answer: Option D — var(x, na.rm=TRUE)
Detailed Academic Explanation:
var(x, na.rm=TRUE) is the correct answer to “Which of the following produces the variance covariance matrix”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following will reverse the order of values in x?
Correct Answer: Option A — rev(x)
Detailed Academic Explanation:
rev(x) is the correct answer to “Which of the following will reverse the order of values in x”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following finds row sums for each level of a grouping variable?
rowMeans(x, na.rm = FALSE, dims = 1) is the correct answer to “Which of the following finds row sums for each level of a grouping variable”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following statement applies the function (FUN) to either rows (1) or columns (2) on object X?
Correct Answer: Option D — apply(X, MARGIN, FUN, ...)
Detailed Academic Explanation:
apply(X, MARGIN, FUN, ...) is the correct answer to “Which of the following statement applies the function (FUN) to either rows (1) or columns (2) on object X”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following statement finds the maximum for each column?
Correct Answer: Option A — apply(x,2,max)
Detailed Academic Explanation:
apply(x,2,max) is the correct answer to “Which of the following statement finds the maximum for each column”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
which of the following statement tells the row with the minimum value for every column?
Correct Answer: Option A — which.min(x)
Detailed Academic Explanation:
which.min(x) is the correct answer to “which of the following statement tells the row with the minimum value for every column”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following may be used for linear regression?
Correct Answer: Option C — solve(A,B)
Detailed Academic Explanation:
solve(A,B) is the correct answer to “Which of the following may be used for linear regression”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following sets the size of the outer margins for the graph?
Correct Answer: Option C — par(omi=c(0,0,1,0) )
Detailed Academic Explanation:
par(omi=c(0,0,1,0) ) is the correct answer to “Which of the following sets the size of the outer margins for the graph”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following function is used for plotting histogram?
Correct Answer: Option A — hist()
Detailed Academic Explanation:
hist() is the correct answer to “Which of the following function is used for plotting histogram”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following will add the title "R language" to the graph?
Correct Answer: Option B — title( "R language")
Detailed Academic Explanation:
title( "R language") is the correct answer to “Which of the following will add the title "R language" to the graph”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . let's you perform SQL queries on your R data frames.
Correct Answer: Option B — plyr
Detailed Academic Explanation:
plyr is the correct answer to “. . . . . . . . let's you perform SQL queries on your R data frames.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . splits a data frame and results an array (hence the da). Hopefully you're getting the idea here.
Correct Answer: Option B — daply
Detailed Academic Explanation:
daply is the correct answer to “. . . . . . . . splits a data frame and results an array (hence the da). Hopefully you're getting the idea here.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . makes it incredibly easy to fit time series models like ARIMA, ARMA, AR, Exponential Smoothing, etc.
Correct Answer: Option C — forecast
Detailed Academic Explanation:
forecast is the correct answer to “. . . . . . . . makes it incredibly easy to fit time series models like ARIMA, ARMA, AR, Exponential Smoothing, etc.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . provides needed string operators in R.
Correct Answer: Option C — stringr
Detailed Academic Explanation:
stringr is the correct answer to “. . . . . . . . provides needed string operators in R.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following syntax is used to install forecast package?
Correct Answer: Option C — install.packages("forecast")
Detailed Academic Explanation:
install.packages("forecast") is the correct answer to “Which of the following syntax is used to install forecast package”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is similar to Moment.js?
Correct Answer: Option B — lubridate
Detailed Academic Explanation:
lubridate is the correct answer to “Which of the following is similar to Moment.js”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is a library for statistical quality control?
Correct Answer: Option B — qcc
Detailed Academic Explanation:
qcc is the correct answer to “Which of the following is a library for statistical quality control”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . specializes in converting data from wide to long format.
Correct Answer: Option C — reshape2
Detailed Academic Explanation:
reshape2 is the correct answer to “. . . . . . . . specializes in converting data from wide to long format.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . is used to convert wide data to long data.
Correct Answer: Option A — melt
Detailed Academic Explanation:
melt is the correct answer to “. . . . . . . . is used to convert wide data to long data.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . is used to view all packages installed.
Correct Answer: Option A — library()
Detailed Academic Explanation:
library() is the correct answer to “. . . . . . . . is used to view all packages installed.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . is used to get library location in R.
Correct Answer: Option C — .libPaths()
Detailed Academic Explanation:
.libPaths() is the correct answer to “. . . . . . . . is used to get library location in R.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . is used to view packages currently loaded.
Correct Answer: Option B — search()
Detailed Academic Explanation:
search() is the correct answer to “. . . . . . . . is used to view packages currently loaded.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
abc is the correct answer to “. . . . . . . . contains tools for Approximate Bayesian Computation (ABC).”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following package combine multi-dimensional arrays?
Correct Answer: Option C — abind
Detailed Academic Explanation:
abind is the correct answer to “Which of the following package combine multi-dimensional arrays”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following contains functions for processing uniaxial minute-to-minute accelerometer data?
Correct Answer: Option A — accelerometry
Detailed Academic Explanation:
accelerometry is the correct answer to “Which of the following contains functions for processing uniaxial minute-to-minute accelerometer data”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . is used for selecting regression transformations.
Correct Answer: Option C — avas()
Detailed Academic Explanation:
avas() is the correct answer to “. . . . . . . . is used for selecting regression transformations.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is an R package for the exploratory analysis of genetic and genomic data?
Correct Answer: Option B — adegenet
Detailed Academic Explanation:
adegenet is the correct answer to “Which of the following is an R package for the exploratory analysis of genetic and genomic data”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . specializes in functions for analytical Customer Relationship Management.
Correct Answer: Option C — aCRM
Detailed Academic Explanation:
aCRM is the correct answer to “. . . . . . . . specializes in functions for analytical Customer Relationship Management.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . searches for significant clusters in genetic data.
Correct Answer: Option C — bayesclust
Detailed Academic Explanation:
bayesclust is the correct answer to “. . . . . . . . searches for significant clusters in genetic data.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
G.S. is the correct answer to “. . . . . . . . Uses Grieg-Smith method on 2 dimensional spatial data.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . finds K best paths in a given graph.
Correct Answer: Option A — kBestShortestPaths
Detailed Academic Explanation:
kBestShortestPaths is the correct answer to “. . . . . . . . finds K best paths in a given graph.”. This question is standard in competitive examination syllabi for Data Visualization With Ggplot2.
💡Key Conceptual Anchor:Data Visualization With Ggplot2
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.