R Programming MCQ set number 00424

1. __________ prints out the function call stack after an error occurs.
a) trace()
b) traceback()
c) back()
d) all of the mentioned

Answer

Answer: b [Reason:] traceback() does nothing if there’s no error.

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) All of the mentioned

Answer

Answer: b [Reason:] 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) all of the mentioned

Answer

Answer: a [Reason:] 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) all of the mentioned

Answer

Answer: b [Reason:] 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) None of the mentioned

Answer

Answer: a [Reason:] 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) all of the mentioned

Answer

Answer: c [Reason:] 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()

Answer

Answer: d [Reason:] 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) all of the mentioned

Answer

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

9. What would be the output of the following code ?

> mean(x)
  Error in mean(x) : object 'x' not found
> traceback()

a) 1: mean(x)
b) Null
c) 0
d) None of the mentioned

Answer

Answer: a [Reason:] The traceback() function shows you how many levels deep you were when the error occurred.

10. The recover() function will first print out the function call stack when an _______ occurs.
a) Error
b) Warning
c) Messages
d) All of the mentioned

Answer

Answer: a [Reason:] When you choose a frame number, you will be put in the browse and will have the ability to poke around.

Synopsis and Project Report

You can buy synopsis and project from distpub.com. Just visit https://distpub.com/product-category/projects/ and buy your university/institute project from distpub.com

ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.