R Programming Questions and Answers – Debugging Tools

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

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

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

Answer: a
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

Answer: b
Explanation: The function call stack is the sequence of functions that was called before the error occurred.

advertisement
advertisement

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

Answer: a
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

Answer: c
Explanation: The recover() function can be used to modify the error behavior of R when an error occurs.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

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

Answer: b
Explanation: debug() allows you to step through execution of a function one line at a time.

advertisement

Sanfoundry Global Education & Learning Series – R Programming Language.

Here’s the list of Best Books in R Programming Language.

advertisement

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.