JavaScript Questions & Answers – Getting Started with R – III

«
»

This set of JavaScript MCQs focuses on “Getting Started with R – III”.

1. What is the usage of the keyword ?? in R?
a) Help window
b) Extensive search
c) Error correction
d) Error detection
View Answer

Answer: b
Explanation: The ?? function scans the documentation for packages installed in your library. ?? (keyword) is generally used for a more extensive search when compared to the keyword ?.
advertisement

2. Which type of comment is not supported in R?
a) Single-line comments
b) Multi-line comments
c) Both Single-line & Multi-line comments
d) Multiple Comments
View Answer

Answer: b
Explanation: R supports single-line comments, but not multiline comments. # is used for making a single line comment.

3. What is the usage of the keyword ? in R?
a) Help window
b) Extensive search
c) Error correction
d) Error detection
View Answer

Answer: a
Explanation: ? is generally used to open the help window at any time. The help() function and ? help operator in R provides access to the documentation pages for R functions, data sets, and other objects, both for packages in the standard R distribution and for contributed packages.
advertisement
advertisement

4. Which symbol is used to start a comment?
a) /
b) $
c) #
d) ?
View Answer

Answer: c
Explanation: ‘#’ is used to comment a line. A single line comment can be made in R.

5. Which of the following is the assignment operator?
a) <-
b) ->
c) =
d) ==
View Answer

Answer: a
Explanation: The operators <- and = can be used, almost interchangeably, to assign to a variable in the same environment. The assignment operator is a left-pointing arrow, so creating and declaring variables looks like this:
foo <- bar
advertisement

6. Which of the following is a loosely-typed language?
a) R
b) T
c) S
d) Both R and S
View Answer

Answer: c
Explanation: R is an implementation of the S programming language combined with lexical scoping semantics, inspired by Scheme. [15] S was created by John Chambers in 1976, while at Bell Labs. R and S are loosely-typed languages and it supports all of the scalar data types you would expect: string, numbers, and booleans.

7. What is the limit to matrices in R?
a) One dimensional
b) Two dimensional
c) Three dimensional
d) No limit
View Answer

Answer: b
Explanation: Matrices are like strictly typed two-dimensional arrays. You create a matrix using the matrix function, which accepts five parameters: a vector to use as the content, the number of rows to shape the content into, the number of columns to shape the content into, an optional boolean value to indicate whether the content should be shaped by row or by column (the default is FALSE for by column), and a list that contains vectors for row names and column names:
matrix([content vector], nrow=[number of rows], ncol=[number of columns], byrow=[how to sort], dimnames=[vector of row names, vector of column names]).
advertisement

8. Which is the function used to add the vectors?
a) c()
b) add(vectors)
c) c(vectors)
d) vectors.add
View Answer

Answer: a
Explanation: The c() is a generic function which combines its arguments. It is used to add the vectors.

9. Which of the following list contains multiple data types?
a) Vectors
b) Data frames
c) Matrices
d) Arrays
View Answer

Answer: b
Explanation: Data frames are multidimensional lists that can contain multiple data types.
advertisement

10. Which function is used to create data frames?
a) data.frames()
b) frame.data()
c) data.frame()
d) frame(data)
View Answer

Answer: c
Explanation: Data frames are multidimensional lists that can contain multiple data types. A data frame is a table or a two-dimensional array-like structure in which each column contains values of one variable and each row contains one set of values from each column.

Sanfoundry Global Education & Learning Series – Javascript Programming.

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter