☑ MCQ PRACTICE

R Programming Unit 5

Practice objective questions for quick revision and examination preparation. Try answering each question before revealing the answer.

📚 R Programming
📖 Unit 5
🎯 MCQs

R Programming — Unit 5

Graphics, Plotting, Debugging and Error Handling

1

Which function in R is used to create a basic plot?

Agraph()
BcreatePlot()
Cplot()
Ddraw()
Correct Answerplot()
2

To add a title to a plot, which function is used?

AaddTitle()
Btext()
Ctitle()
Dheading()
Correct Answertitle()
3

Which function is used to create a histogram in R?

Ahist()
Bplot()
Cchart()
Ddiagram()
Correct Answerhist()
4

In R, which function is used to create a boxplot?

Aboxplot()
Bplotbox()
Cboxgraph()
Dplot()
Correct Answerboxplot()
5

The function to create a bar plot is:

Abar()
Bbarplot()
Cplotbar()
Ddrawbar()
Correct Answerbarplot()
6

What argument is used to change color in a plot?

Abg
Bcol
Ccolor
Dclr
Correct Answercol
7

To save a plot as a PDF, which function is used?

Apdf()
Bsave()
Cexport()
Dwrite()
Correct Answerpdf()
8

Which function is used to save a plot as a JPEG file?

Ajpeg()
Bsave()
Cwritejpeg()
Dexportjpeg()
Correct Answerjpeg()
9

To create a 3D plot in R, we commonly use the package:

Alattice
Bplot3D
Cggplot2
Ddplyr
Correct Answerplot3D
10

Which function from plot3D creates 3D scatter plots?

Ascatter3d()
Bplot3d()
Cpoints3D()
Dcloud()
Correct Answerpoints3D()
11

What is the primary goal of debugging?

AMake code faster
BFix errors
CSave memory
DReduce syntax
Correct AnswerFix errors
12

Which type of error occurs due to mistakes in writing code?

ARuntime error
BSyntax error
CLogical error
DOutput error
Correct AnswerSyntax error
13

A runtime error occurs when:

ACode is missing
BCode violates rules during execution
CSyntax is incorrect
DFile is not saved
Correct AnswerCode violates rules during execution
14

Which R function is used to debug a function?

Afix()
Bdebug()
Ctrace()
Dinspect()
Correct Answerdebug()
15

Which function is used to remove debugging from a function?

Aundebug()
Buntrace()
Cclear()
Dnodebug()
Correct Answerundebug()
16

What function is used to trace the execution of an R function?

Adebug()
Btrace()
Cinspect()
Dfollow()
Correct Answertrace()
17

Which function allows you to browse inside a function during an error?

Abrowse()
Bbrowser()
Cinspect()
Dopen()
Correct Answerbrowser()
18

The R function to stop execution for debugging is:

Astop()
Bhalt()
Cbrowser()
Ddebugstop()
Correct Answerbrowser()
19

What is GDB mainly used for in R debugging?

AVisualize data
BGraph plotting
CDebugging compiled R code
DSaving graphs
Correct AnswerDebugging compiled R code
20

Syntax errors are generally caught during:

AExecution
BCompilation
CEditing
DDebugging
Correct AnswerCompilation
21

In which mode do you see step-by-step code execution?

AExecution mode
BTrace mode
CDebugging mode
DBrowse mode
Correct AnswerDebugging mode
22

Which of these is NOT a debugging function in R?

Adebug()
Bundebug()
Cbrowser()
Drender()
Correct Answerrender()
23

Which command runs GDB on R itself?

Arun(R)
BR -d gdb
Cgdb()
Dstart(R)
Correct AnswerR -d gdb
24

Moving to higher-level debugging tools helps in:

AIncreasing errors
BReducing memory
CMore convenient debugging
DWriting new code
Correct AnswerMore convenient debugging
25

If an error occurs while running a simulation, what is most important to check?

AGraphs
BData types
CConsistency of simulation steps
DPlot labels
Correct AnswerConsistency of simulation steps
26

To find hidden errors in simulation code, you should:

AIgnore warnings
BAlways recompile
CEnsure consistency and debug
DSave graphs
Correct AnswerEnsure consistency and debug
27

Which of the following can help to detect runtime errors?

Aprint()
Bsummary()
Cbrowser()
Dhist()
Correct Answerbrowser()
28

Which type of error is easiest to catch before running the code?

ASyntax error
BRuntime error
CLogical error
DData error
Correct AnswerSyntax error
29

Which is the default error handler function in R?

Aerror()
Bstop()
Ctraceback()
Dhandler()
Correct Answertraceback()
30

To view the sequence of function calls that led to an error, use:

Aviewerror()
Btraceback()
Cerrorpath()
Derrortrace()
Correct Answertraceback()
← Back to All MCQs