Skip to main content

R Programming Basics — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on R Programming Basics — 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

An ordered collection of objects or components are called . . . . . . . .

Question 2 of 40
★ FPSC ★ PPSC

The . . . . . . . . function returns a list of densities (y) corresponding to bin values (x).

Question 3 of 40
★ FPSC ★ PPSC

Data frames can have additional attributes such as . . . . . . . .

Question 4 of 40
★ FPSC ★ PPSC

The . . . . . . . . function takes an arbitrary number of arguments and concatenates them one by one into character strings.

Question 5 of 40
★ FPSC ★ PPSC

All columns in a matrix must have the same mode and the . . . . . . . . length.

Question 6 of 40
★ FPSC ★ PPSC

The four most frequently used types of data objects in R are vectors, matrices, data frames and . . . . . . . .

Question 7 of 40
★ FPSC ★ PPSC

. . . . . . . .are Data frames which contain lists of homogeneous data in a tabular format.

Question 8 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- 1:3 > y <- 10:12 > rbind(x, y)

Question 9 of 40
★ FPSC ★ PPSC

To bind a row onto an already existing matrix, the . . . . . . . . function can be used.

Question 10 of 40
★ FPSC ★ PPSC

vectors can be one of two types namely atomic vectors and . . . . . . . .

Question 11 of 40
★ FPSC ★ PPSC

A . . . . . . . . is a set of elements appearing in rows and columns where the elements are of the same mode whether they are logical, numeric (integer or double), complex or character.

Question 12 of 40
★ FPSC ★ PPSC

Which function replicates elements of vectors?

Question 13 of 40
★ FPSC ★ PPSC

Which of the following statement changes column name to h and f?

Question 14 of 40
★ FPSC ★ PPSC

Which of the following is a 3-dimensional dataset?

Question 15 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > sqrt(-17)

Question 16 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- 1:3 > y <- 10:12 > cbind(x, y)

Question 17 of 40
★ FPSC ★ PPSC

Which of the following statement is invalid?

Question 18 of 40
★ FPSC ★ PPSC

Locator function gives output as . . . . . . . .

Question 19 of 40
★ FPSC ★ PPSC

Numbers in R are generally treated as . . . . . . . . precision real numbers.

Question 20 of 40
★ FPSC ★ PPSC

To extract a sublist, we use . . . . . . . . brackets.

Question 21 of 40
★ FPSC ★ PPSC

Using the . . . . . . . . vector, we create a species factor and bind it to the columns of iris.df.

Question 22 of 40
★ FPSC ★ PPSC

Which is the basic data structure of R containing the same type of data?

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > m <- matrix(1:6, nrow = 2, ncol = 3) > m

Question 24 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- data.frame(foo = 1:4, bar = c(T, T, F, F)) > ncol(x)

Question 25 of 40
★ FPSC ★ PPSC

Which of the following is invalid assignment?

Question 26 of 40
★ FPSC ★ PPSC

Which function takes a dim attribute which creates the required number of dimensions?

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- vector("list", length = 5) > x

Question 28 of 40
★ FPSC ★ PPSC

A . . . . . . . . is a two-dimensional rectangular data set.

Question 29 of 40
★ FPSC ★ PPSC

Which function is used to combine the elements into a vector?

Question 30 of 40
★ FPSC ★ PPSC

By what function we can create data frames?

Question 31 of 40
★ FPSC ★ PPSC

Which of the following statement would print "0" "1" "2" "3" "4" "5" "6" for the following R code? > x <- 0:6

Question 32 of 40
★ FPSC ★ PPSC

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

Question 33 of 40
★ FPSC ★ PPSC

What will be the Correct R code for the following output? foo bar 1 1 TRUE 2 2 TRUE 3 3 FALSE 4 4 FALSE

Question 34 of 40
★ FPSC ★ PPSC

. . . . . . . . function returns a vector of the same size as x with the elements arranged in increasing order.

Question 35 of 40
★ FPSC ★ PPSC

R has how many atomic classes of objects?

Question 36 of 40
★ FPSC ★ PPSC

Factors are created using the . . . . . . . . function.

Question 37 of 40
★ FPSC ★ PPSC

First component of the list can be accessed by . . . . . . . .

Question 38 of 40
★ FPSC ★ PPSC

Which function is used to enter in data at the terminal?

Question 39 of 40
★ FPSC ★ PPSC

Which are indexed by either row or column using a specific name or number?

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following R code? > x <- list(1, "a", TRUE, 1 + 4i) > x

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