Skip to main content

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
Question 1 of 40
★ 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

Question 2 of 40
★ FPSC ★ PPSC

. . . . . . . . is used for outputting a textual representation of an R object.

Question 3 of 40
★ FPSC ★ PPSC

Which of the following function is identical to read .table?

Question 4 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- Sys.time() > class(x)

Question 5 of 40
★ FPSC ★ PPSC

. . . . . . . . function is similar to the existing subset() function in R but is quite a bit faster.

Question 6 of 40
★ FPSC ★ PPSC

Which of the following is used for reading in saved workspaces?

Question 7 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- 1:4 > x > 2

Question 8 of 40
★ FPSC ★ PPSC

Which of the following function is similar to summarize?

Question 9 of 40
★ FPSC ★ PPSC

The . . . . . . . . operator is used to connect multiple verb actions together into a pipeline.

Question 10 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- as.Date("1970-01-01") > x

Question 11 of 40
★ FPSC ★ PPSC

. . . . . . . . add new variables/columns or transform existing variables.

Question 12 of 40
★ FPSC ★ PPSC

Connections to text files can be created with the . . . . . . . . function.

Question 13 of 40
★ FPSC ★ PPSC

.rda extension used when saving data with function . . . . . . . .

Question 14 of 40
★ 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

Question 15 of 40
★ FPSC ★ PPSC

Which of the following R code creates a connection to 'foo.txt'?

Question 16 of 40
★ FPSC ★ PPSC

The dplyr package can be installed from GitHub using the . . . . . . . . package.

Question 17 of 40
★ FPSC ★ PPSC

Multiple objects can be de parsed at once and read back using function . . . . . . . .

Question 18 of 40
★ 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

Question 19 of 40
★ FPSC ★ PPSC

Which of the following opens connection to gz-compressed text file?

Question 20 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- list(foo = 1:4, bar = 0.6) > x

Question 21 of 40
★ FPSC ★ PPSC

The . . . . . . . . function can be used to select columns of a data frame that you want to focus on.

Question 22 of 40
★ 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)]]

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > p <- as.POSIXlt(x) > names(unclass(p)) > p$wday

Question 24 of 40
★ FPSC ★ PPSC

There is an SQL interface for relational databases via the . . . . . . . . package.

Question 25 of 40
★ FPSC ★ PPSC

dput() output is in the form of . . . . . . . .

Question 26 of 40
★ 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.

Question 27 of 40
★ FPSC ★ PPSC

Which of the following code would read 100 rows?

Question 28 of 40
★ 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?

Question 29 of 40
★ 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)

Question 30 of 40
★ FPSC ★ PPSC

Which of the following statement will load the objects to the file named "mydata.RData"?

Question 31 of 40
★ FPSC ★ PPSC

. . . . . . . . opens a connection to a file compressed with gzip.

Question 32 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > y <- data.frame(a = 1, b = "a") > dput(y)

Question 33 of 40
★ FPSC ★ PPSC

Which of the following is example of vectorized operation as far as subtraction is concerned? > x <- 1:4 > y <- 6:9

Question 34 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- matrix(1:6, 2, 3) > x[1, 2]

Question 35 of 40
★ FPSC ★ PPSC

Individual R objects can be saved to a file using the . . . . . . . . function.

Question 36 of 40
★ FPSC ★ PPSC

If you have a lot of objects that you want to save to a file, we use . . . . . . . . function.

Question 37 of 40
★ FPSC ★ PPSC

Multiple objects can be de parsed at once using the . . . . . . . . function.

Question 38 of 40
★ FPSC ★ PPSC

When you call serialize() on an R object, the output will be . . . . . . . . coded in hexadecimal format.

Question 39 of 40
★ 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))

Question 40 of 40
★ FPSC ★ PPSC

Which of the following object is masked from 'package: stats'?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

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

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →