Data Structures In R Programming — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Data Structures In R Programming — 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 is used for reading tabular data? > y <- data.frame(a = 1, b = "a") > dput(y, file = "y.R") > new.y <- dget("y.R") > new.y
Correct Answer: Option A — a b 1 1 a
Detailed Academic Explanation:
a b 1 1 a is the correct answer to “Which of the following is used for reading tabular data? > y <- data.frame(a = 1, b = "a") > dput(y, file = "y.R") > new.y <- dget("y.R") > new.y”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . is used for outputting a textual representation of an R object.
Correct Answer: Option A — dput
Detailed Academic Explanation:
dput is the correct answer to “. . . . . . . . is used for outputting a textual representation of an R object.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following function is identical to read .table?
Correct Answer: Option A — read.csv
Detailed Academic Explanation:
read.csv is the correct answer to “Which of the following function is identical to read .table”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- Sys.time() > class(x)
Correct Answer: Option A — "POSIXct" "POSIXt"
Detailed Academic Explanation:
"POSIXct" "POSIXt" is the correct answer to “What will be the output of the following R code? > x <- Sys.time() > class(x)”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . function is similar to the existing subset() function in R but is quite a bit faster.
Correct Answer: Option B — filter
Detailed Academic Explanation:
filter is the correct answer to “. . . . . . . . function is similar to the existing subset() function in R but is quite a bit faster.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is used for reading in saved workspaces?
Correct Answer: Option B — load
Detailed Academic Explanation:
load is the correct answer to “Which of the following is used for reading in saved workspaces”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- 1:4 > x > 2
Correct Answer: Option B — FALSE FALSE TRUE TRUE
Detailed Academic Explanation:
FALSE FALSE TRUE TRUE is the correct answer to “What will be the output of the following R code? > x <- 1:4 > x > 2”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following function is similar to summarize?
Correct Answer: Option C — group_by()
Detailed Academic Explanation:
group_by() is the correct answer to “Which of the following function is similar to summarize”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The . . . . . . . . operator is used to connect multiple verb actions together into a pipeline.
Correct Answer: Option A — pipe
Detailed Academic Explanation:
pipe is the correct answer to “The . . . . . . . . operator is used to connect multiple verb actions together into a pipeline.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- as.Date("1970-01-01") > x
Correct Answer: Option A — "1970-01-01"
Detailed Academic Explanation:
"1970-01-01" is the correct answer to “What will be the output of the following R code? > x <- as.Date("1970-01-01") > x”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . add new variables/columns or transform existing variables.
Correct Answer: Option A — mutate
Detailed Academic Explanation:
mutate is the correct answer to “. . . . . . . . add new variables/columns or transform existing variables.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Connections to text files can be created with the . . . . . . . . function.
Correct Answer: Option D — file
Detailed Academic Explanation:
file is the correct answer to “Connections to text files can be created with the . . . . . . . . function.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
.rda extension used when saving data with function . . . . . . . .
Correct Answer: Option C — save and save.image functions
Detailed Academic Explanation:
save and save.image functions is the correct answer to “.rda extension used when saving data with function . . . . . . . .”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- matrix(1:4, 2, 2) > y <- matrix(rep(10, 4), 2, 2) > x * y
[,1] [,2] [1,] 10 30 [2,] 20 40 is the correct answer to “What will be the output of the following R code? > x <- matrix(1:4, 2, 2) > y <- matrix(rep(10, 4), 2, 2) > x * y”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following R code creates a connection to 'foo.txt'?
Correct Answer: Option A — con <- file("foo.txt")
Detailed Academic Explanation:
con <- file("foo.txt") is the correct answer to “Which of the following R code creates a connection to 'foo.txt'”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The dplyr package can be installed from GitHub using the . . . . . . . . package.
Correct Answer: Option B — devtools
Detailed Academic Explanation:
devtools is the correct answer to “The dplyr package can be installed from GitHub using the . . . . . . . . package.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Multiple objects can be de parsed at once and read back using function . . . . . . . .
Correct Answer: Option A — source()
Detailed Academic Explanation:
source() is the correct answer to “Multiple objects can be de parsed at once and read back using function . . . . . . . .”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- as.Date("2012-03-01") > y <- as.Date("2012-02-28") > x-y
Correct Answer: Option B — Time difference of 2 days
Detailed Academic Explanation:
Time difference of 2 days is the correct answer to “What will be the output of the following R code? > x <- as.Date("2012-03-01") > y <- as.Date("2012-02-28") > x-y”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following opens connection to gz-compressed text file?
Correct Answer: Option B — con <- gzfile("words.gz")
Detailed Academic Explanation:
con <- gzfile("words.gz") is the correct answer to “Which of the following opens connection to gz-compressed text file”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- list(foo = 1:4, bar = 0.6) > x
$foo [1] 1 2 3 4 $bar [1] 0.6 is the correct answer to “What will be the output of the following R code? > x <- list(foo = 1:4, bar = 0.6) > x”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The . . . . . . . . function can be used to select columns of a data frame that you want to focus on.
Correct Answer: Option A — select
Detailed Academic Explanation:
select is the correct answer to “The . . . . . . . . function can be used to select columns of a data frame that you want to focus on.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- list(a = list(10, 12, 14), b = c(3.14, 2.81)) > x[[c(1, 3)]]
Correct Answer: Option B — 14
Detailed Academic Explanation:
14 is the correct answer to “What will be the output of the following R code? > x <- list(a = list(10, 12, 14), b = c(3.14, 2.81)) > x[[c(1, 3)]]”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > p <- as.POSIXlt(x) > names(unclass(p)) > p$wday
Correct Answer: Option A — 1
Detailed Academic Explanation:
1 is the correct answer to “What will be the output of the following R code? > p <- as.POSIXlt(x) > names(unclass(p)) > p$wday”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
There is an SQL interface for relational databases via the . . . . . . . . package.
Correct Answer: Option C — DBI
Detailed Academic Explanation:
DBI is the correct answer to “There is an SQL interface for relational databases via the . . . . . . . . package.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
dput() output is in the form of . . . . . . . .
Correct Answer: Option A — R code
Detailed Academic Explanation:
R code is the correct answer to “dput() output is in the form of . . . . . . . .”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Unlike writing out a table or CSV file, dump() and dput() preserve the . . . . . . . . so that another user doesn't have to specify the all over again.
Correct Answer: Option A — metadata
Detailed Academic Explanation:
metadata is the correct answer to “Unlike writing out a table or CSV file, dump() and dput() preserve the . . . . . . . . so that another user doesn't have to specify the all over again.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
initial <- read.table("datatable.txt", nrows = 100) is the correct answer to “Which of the following code would read 100 rows”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following code opens a connection to the file foo.txt, reads from it, and closes the connection when its done?
Correct Answer: Option A — data <- read.csv("foo.txt")
Detailed Academic Explanation:
data <- read.csv("foo.txt") is the correct answer to “Which of the following code opens a connection to the file foo.txt, reads from it, and closes the connection when its done”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- c(1, 2, NA, 4, NA, 5) > bad <- is.na(x) > print(bad)
FALSE FALSE TRUE FALSE TRUE FALSE is the correct answer to “What will be the output of the following R code? > x <- c(1, 2, NA, 4, NA, 5) > bad <- is.na(x) > print(bad)”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following statement will load the objects to the file named "mydata.RData"?
Correct Answer: Option B — load("mydata.RData")
Detailed Academic Explanation:
load("mydata.RData") is the correct answer to “Which of the following statement will load the objects to the file named "mydata.RData"”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . opens a connection to a file compressed with gzip.
Correct Answer: Option B — gzfile
Detailed Academic Explanation:
gzfile is the correct answer to “. . . . . . . . opens a connection to a file compressed with gzip.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > y <- data.frame(a = 1, b = "a") > dput(y)
Correct Answer: Option C — structure(list(a = 1, b = structure(1L, .Label = "a", class = "factor")), .Names\ = c("a", "b"), row.names = c(NA, -1L), class = "data.frame")
Detailed Academic Explanation:
structure(list(a = 1, b = structure(1L, .Label = "a", class = "factor")), .Names\ = c("a", "b"), row.names = c(NA, -1L), class = "data.frame") is the correct answer to “What will be the output of the following R code? > y <- data.frame(a = 1, b = "a") > dput(y)”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is example of vectorized operation as far as subtraction is concerned? > x <- 1:4 > y <- 6:9
Correct Answer: Option B — x-y
Detailed Academic Explanation:
x-y is the correct answer to “Which of the following is example of vectorized operation as far as subtraction is concerned? > x <- 1:4 > y <- 6:9”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following R code? > x <- matrix(1:6, 2, 3) > x[1, 2]
Correct Answer: Option A — 3
Detailed Academic Explanation:
3 is the correct answer to “What will be the output of the following R code? > x <- matrix(1:6, 2, 3) > x[1, 2]”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Individual R objects can be saved to a file using the . . . . . . . . function.
Correct Answer: Option A — save
Detailed Academic Explanation:
save is the correct answer to “Individual R objects can be saved to a file using the . . . . . . . . function.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If you have a lot of objects that you want to save to a file, we use . . . . . . . . function.
Correct Answer: Option B — save.image()
Detailed Academic Explanation:
save.image() is the correct answer to “If you have a lot of objects that you want to save to a file, we use . . . . . . . . function.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Multiple objects can be de parsed at once using the . . . . . . . . function.
Correct Answer: Option A — dput()
Detailed Academic Explanation:
dput() is the correct answer to “Multiple objects can be de parsed at once using the . . . . . . . . function.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
When you call serialize() on an R object, the output will be . . . . . . . . coded in hexadecimal format.
Correct Answer: Option A — raw vector
Detailed Academic Explanation:
raw vector is the correct answer to “When you call serialize() on an R object, the output will be . . . . . . . . coded in hexadecimal format.”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following code extracts 1st element of the 2nd element? > x <- list(a = list(10, 12, 14), b = c(3.14, 2.81))
Correct Answer: Option A — x[[c(2, 1)]]
Detailed Academic Explanation:
x[[c(2, 1)]] is the correct answer to “Which of the following code extracts 1st element of the 2nd element? > x <- list(a = list(10, 12, 14), b = c(3.14, 2.81))”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following object is masked from 'package: stats'?
Correct Answer: Option A — filter
Detailed Academic Explanation:
filter is the correct answer to “Which of the following object is masked from 'package: stats'”. This question is standard in competitive examination syllabi for Data Structures In R Programming.
💡Key Conceptual Anchor:Data Structures In R Programming
✓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.