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
View Answer

Answer: b
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
View Answer

Answer: d
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
View Answer

Answer: b
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.
advertisement
advertisement

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()
View Answer

Answer: c
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
View Answer

Answer: b
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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

Answer: b
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)
View Answer

Answer: b
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]).
advertisement

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

Answer: d
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()
View Answer

Answer: c
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.
advertisement

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
View Answer

Answer: b
Explanation: The par(mfrow) function is handy for creating a simple multi-paneled plot, while layout should be used for customized panel plots of varying sizes. With the method par(), you can make the text horizontal.

Sanfoundry Global Education & Learning Series – Javascript Programming.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). 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!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.