Explore topic-wise MCQs in R Programming.

This section includes 13 Mcqs, each offering curated multiple-choice questions to sharpen your R Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

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

A. con <- gzfiles(“words.gz”)
B. con <- gzfile(“words.gz”)
C. con <- gzfile2(“words.gz”)
D. con <- gzfiles2(“words.gz”)
Answer» C. con <- gzfile2(“words.gz”)
2.

Which of the following code opens a connection to the file foo.txt, reads from it, and closes the connection when its done?

A. data <- read.csv(“foo.txt”)
B. data <- read.csvo(“foo.txt”)
C. data <- readonly.csv(“foo.txt”)
D. data <- getonly.csv(“foo.txt”)
Answer» B. data <- read.csvo(“foo.txt”)
3.

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

A. con <- file(“foo.txt”)
B. open(con, “r”)
C. opencon(con, “r”)
D. ocon(con, “r”)
Answer» B. open(con, “r”)
4.

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

A. url
B. gzfile
C. bzfile
D. file
Answer» E.
5.

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

A. save(“mydata.RData”)
B. load(“mydata.RData”)
C. loadAll(“mydata.RData”)
D. put(“mydata.RData”)
Answer» C. loadAll(“mydata.RData”)
6.

Which of the following R statement will save the output to the file for following R code?

A. save(a, b, file = “mydata.rda”)
B. save_image(a, b, file = “mydata.rda”)
C. keep(a, b, file = “mydata.rda”)
D. keep_image(a, b, file = “mydata.rda”)View Answer
Answer» B. save_image(a, b, file = “mydata.rda”)
7.

WHICH_OF_THE_FOLLOWING_CODE_CREATES_A_CONNECTION_TO_‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚Àւ§FOO.TXT‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•_??$#

A. con <- file(“foo.txt”)
B. open(con, “r”)
C. opencon(con, “r”)
D. all of the mentioned
Answer» B. open(con, ‚Äö√Ñ√∂‚àö√ë‚àö‚à´r‚Äö√Ñ√∂‚àö√ë‚àöœÄ)
8.

Which_of_the_following_code_opens_a_connection_to_the_file_foo.txt,_reads_from_it,_and_closes_the$

A.
B. data <- read.csv(“foo.txt”)
C. data <- read.csvo(“foo.txt”)
Answer» C. data <- read.csvo(‚Äö√Ñ√∂‚àö√ë‚àö‚à´foo.txt‚Äö√Ñ√∂‚àö√ë‚àöœÄ)
9.

Connections to text files can be created with the ________ function?

A. url
B. gzfile
C. bzfile
D. file
Answer» B. gzfile
10.

________ opens a connection to a file compressed with gzip.

A. url
B. gzfile
C. bzfile
D. file
Answer» E.
11.

Which of the following statement will load the objects to the file named “mydata.RData” ?$

A. save(“mydata.RData”)
B. load(“mydata.RData”)
C. loadAll(“mydata.RData”)
D. all of the mentioned
Answer» B. load(‚Äö√Ñ√∂‚àö√ë‚àö‚à´mydata.RData‚Äö√Ñ√∂‚àö√ë‚àöœÄ)
12.

rda”)$

A. save_image(a, b, file = “mydata.rda”)
B. keep(a, b, file = “mydata.rda”)
C. all of the mentioned
Answer» C. all of the mentioned
13.

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

A. save
B. put
C. save_image
D. none of the mentioned
Answer» B. put