# JavaScript Questions & Answers – Enhanced JavaScript with R

«
»

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “Enhanced JavaScript with R”.

1. What is the purpose of the method plot()?
a) Displays symbols
b) Displays charts
c) Displays symbols and charts
d) Display characters

Explanation: The most used plotting function in R programming is the plot() function. It is a generic function, meaning, it has many methods which are called according to the type of object passed to plot(). The plot() function will display a different type of chart depending on the arguments that you pass into it.

2. How many parameters does the method plot() accept?
a) 6
b) 7
c) 8
d) 9

Explanation: Plot() is a generic function, meaning, it has many methods which are called according to the type of object passed to plot(). The method plot() accepts a total of 9 parameters.

3. What is the need for bubble charts?
a) Represent 2D data
b) Represent 3D data
c) Represent 2D and 3D data
d) Represents meta data

Explanation: A bubble plot is a scatterplot where a third dimension is added the value of an additional variable is represented through the size of the dots. They are used to represent three-dimensional data.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. Which of the following is the initial function used to create a bubble chart natively in R?
a) init()
b) chart(bubble)
c) symbols()
d) bchart()

Explanation: symbols() function draws symbols on a plot. One of six symbols; circles, squares, rectangles, stars, thermometers, and boxplots, can be plotted at a specified set of x and y coordinates. The method symbols() is used to create a bubble chart natively in R.

5. What is the purpose of the method symbols in R?
a) Draw symbols
b) Draw other shapes
c) Draw symbols and other shapes
d) Plotting symbols

Explanation: The symbols() function can be used to draw other shapes on a plot; for more information about this type ?symbols at the R console. One of six symbols; circles, squares, rectangles, stars, thermometers, and boxplots, can be plotted at a specified set of x and y coordinates.
Check this: MCA MCQs | Programming MCQs

6. How to save chart as a Window metafile?
a) metafile()
b) win.metafile()
c) file()
d) metawin()

Explanation: Metafile is a piece of graphical information stored in a format that can be exchanged between different systems or software. The method win.metafile([filename]) is used to save chart as a Window metafile.

7. Which is the method used to save chart as a ps file?
a) ps()
b) postscript()
c) script()
d) post(script)

Explanation: postscript starts the graphics device driver for producing PostScript graphics. The syntax for the method to save chart as a ps file is : postscript([filename]).

8. Which of the following are methods not used to save charts?
a) pdf()
b) jpeg()
c) bmp()
d) pmb()

Explanation: Since R runs on so many different operating systems, and supports so many different graphics formats, it’s not surprising that there are a variety of ways of saving your plots, depending on what operating system you are using, what you plan to do with the graph, and whether you’re connecting locally or remotely.

9. Which is the method used to draw a bar plot?
a) bar_plot()
b) plot(bar)
c) barplot()
d) plotbar()

Explanation: A bar chart represents data in rectangular bars with length of the bar proportional to the value of the variable. R uses the function barplot() to create bar charts.

10. What is the purpose of the method par()?
a) Makes the text vertical
b) Makes the text horizontal
c) Makes the text diagonal
d) Makes the text small