Skip to main content

Data Structures In R Programming — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Data Structures In R Programming — Part 1 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 data structure in R is used to store an ordered collection of elements?

Question 2 of 40
★ FPSC ★ PPSC

What does the matrix() function create in R?

Question 3 of 40
★ FPSC ★ PPSC

In R, how do you create a list named my_list with three elements: 1, "hello", and TRUE?

Question 4 of 40
★ FPSC ★ PPSC

What is the primary data structure used for storing tabular data in R?

Question 5 of 40
★ FPSC ★ PPSC

How is a vector different from a list in R?

Question 6 of 40
★ FPSC ★ PPSC

In R, how is a matrix initialized with values 1 to 9 arranged in three rows?

Question 7 of 40
★ FPSC ★ PPSC

How do you create a factor in R named color with levels "red", "green", and "blue"?

Question 8 of 40
★ FPSC ★ PPSC

What is the purpose of the data.frame() function in R?

Question 9 of 40
★ FPSC ★ PPSC

In R, how do you create a named list with elements "apple", "orange", and "banana"?

Question 10 of 40
★ FPSC ★ PPSC

What is the correct way to access the second element of a vector named my_vector in R?

Question 11 of 40
★ FPSC ★ PPSC

How do you check the structure of a data frame named my_data in R?

Question 12 of 40
★ FPSC ★ PPSC

In R, what is the purpose of the names() function?

Question 13 of 40
★ FPSC ★ PPSC

What function is used to convert a factor to a character vector in R?

Question 14 of 40
★ FPSC ★ PPSC

How is a data frame column named Age selected in R?

Question 15 of 40
★ FPSC ★ PPSC

In R, how do you add a new column named Height to a data frame named my_data?

Question 16 of 40
★ FPSC ★ PPSC

How do you create a character vector with the elements "apple", "orange", and "banana" in R?

Question 17 of 40
★ FPSC ★ PPSC

What does the str() function do in R?

Question 18 of 40
★ FPSC ★ PPSC

In R, how do you create a data frame named my_df with columns Name and Age?

Question 19 of 40
★ FPSC ★ PPSC

What is the result of length(unique(c(1, 2, 3, 1, 2))) in R?

Question 20 of 40
★ FPSC ★ PPSC

In R, how is a factor converted to a numeric vector using the as.numeric() function?

Question 21 of 40
★ FPSC ★ PPSC

How do you extract the first row of a data frame named my_data in R?

Question 22 of 40
★ FPSC ★ PPSC

In R, what is the purpose of the table() function?

Question 23 of 40
★ FPSC ★ PPSC

How do you remove a column named Income from a data frame named my_data in R?

Question 24 of 40
★ FPSC ★ PPSC

In R, what does the unlist() function do?

Question 25 of 40
★ FPSC ★ PPSC

How is a character string converted to a numeric vector in R using the as.numeric() function?

Question 26 of 40
★ FPSC ★ PPSC

In R, what is the purpose of the subset() function?

Question 27 of 40
★ FPSC ★ PPSC

How do you add a new row to a data frame named my_data with values "Alice" and 28 for columns Name and Age?

Question 28 of 40
★ FPSC ★ PPSC

What function is used to concatenate two vectors in R?

Question 29 of 40
★ FPSC ★ PPSC

In R, what does the slice() function do?

Question 30 of 40
★ FPSC ★ PPSC

How do you create a named numeric vector with values 1, 2, and 3 named "one", "two", and "three" in R?

Question 31 of 40
★ FPSC ★ PPSC

Which of the following code represents internal representation of a Date object?

Question 32 of 40
★ FPSC ★ PPSC

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

Question 33 of 40
★ FPSC ★ PPSC

Which of the following extracts first four element from the following R vector? > x <- c("a", "b", "c", "c", "d", "a")

Question 34 of 40
★ FPSC ★ PPSC

The . . . . . . . . function is used to generate summary statistics from the data frame within strata defined by a variable.

Question 35 of 40
★ FPSC ★ PPSC

Main way to read the data back in (parsing it) using the function.

Question 36 of 40
★ FPSC ★ PPSC

If we want to save individual R objects to a file, we use the . . . . . . . . function.

Question 37 of 40
★ FPSC ★ PPSC

load() is used for . . . . . . . .

Question 38 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- 1:4 > y <- 6:9 > z <- x + y > z

Question 39 of 40
★ FPSC ★ PPSC

Which of the following extracts first element from the following R list? > x <- list(foo = 1:4, bar = 0.6)

Question 40 of 40
★ FPSC ★ PPSC

Columns can be arranged in descending order too by using the special . . . . . . . . operator.

✓ 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 →