This set of R Programming question bank focuses on “Debugging Tools”
1. __________ prints out the function call stack after an error occurs.
a) trace()
b) traceback()
c) back()
d) traback()
View Answer
Explanation: traceback() does nothing if there’s no error. trace() Interactive tracing and debugging of calls to a function or method.
2. Point out the wrong statement?
a) The primary task of debugging any R code is correctly diagnosing what the problem is
b) R provides only two tools to help you with debugging your code
c) print statement can be used for debugging purpose
d) The traceback() function must be called immediately after an error occurs
View Answer
Explanation: R provides a number of tools to help you with debugging your code.
3. Which of the following is primary tool for debugging?
a) debug()
b) trace()
c) browser()
d) traceback()
View Answer
Explanation: Primary tools are mainly used for debugging R code.
4. ________ allows you to insert debugging code into a function a specific places
a) debug()
b) trace()
c) browser()
d) traceback()
View Answer
Explanation: The function call stack is the sequence of functions that was called before the error occurred.
5. Point out the correct statement?
a) The traceback() function must be called immediately after an error occurs
b) The debugger calls the browser at the very low level of the function body
c) Every time you call the mod() function it will launch the interactive debugger
d) R provides only two tools to help you with debugging your code
View Answer
Explanation: Once another function is called, you lose the traceback.
6. _______ allows you to modify the error behavior so that you can browse the function call stack
a) debug()
b) trace()
c) recover()
d) traceback()
View Answer
Explanation: The recover() function can be used to modify the error behavior of R when an error occurs.
7. ______ suspends the execution of a function wherever it is called and puts the function in debug mode.
a) debug()
b) trace()
c) recover()
d) browser()
View Answer
Explanation: The debug() function initiates an interactive debugger (also known as the “browser” in R) for a function.
8. debug() flags a function for ______ mode in R mode.
a) debug
b) run
c) compile
d) recover
View Answer
Explanation: debug() allows you to step through execution of a function one line at a time.
Sanfoundry Global Education & Learning Series – R Programming Language.
Here’s the list of Best Books in R Programming Language.
- Check R Programming Books
- Apply for Programming Internship
- Check Information Technology Books
- Practice Programming MCQs