Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. _________ is an indication that a fatal problem has occurred and execution of the function stops
a) message
b) error
c) warning
d) all of the mentioned

View Answer

Answer: b [Reason:] Errors are produced by the stop() function.

2. Point out the correct statement :
a) R has a number of ways to indicate to you that something’s not right
b) Executing any function in R may result in the condition
c) “condition” is a generic concept for indicating that something unexpected has occurred
d) All of the mentioned

View Answer

Answer: d [Reason:] Programmers can create their own custom conditions if they want.

3. What would be the value of following expression ?

  > log(-2.3)

a) Warning in log(-2.3): NaNs produced
b) 1
c) Null
d) 0

View Answer

Answer: a [Reason:] This warning lets you know that taking the log of a negative number results in a NaN value because you can’t take the log of negative numbers.

4. Warnings are generated by the _________ function
a) warning()
b) error()
c) run()
d) None of the mentioned

View Answer

Answer: a [Reason:] warning is an indication that something is wrong but not necessarily fatal; execution of the function continues.

5. Point out the correct statement :
a) Vectorizing the function can be accomplished easily with the Vectorize() function
b) There are different levels of indication that can be used, ranging from mere notification to fatal error
c) Vectorizing the function can be accomplished easily with the vector() function
d) None of the mentioned

View Answer

Answer: a [Reason:] Vectorize() function does not preserve the invisibility of the return value.

6. What will be the output of the following code ?

> printmessage <- function(x) {
+              if(x > 0)
+                    print("x is greater than zero")
+              else
+                    print("x is less than or equal to zero")
+              invisible(x)
+ }
> printmessage(1)

a) Error
b) Warning
c) Messages
d) All of the mentioned

View Answer

Answer: a [Reason:] The function seems to work fine. No errors, warnings, or messages.

7. What will be the value of following expression ?
a) Warning in log(c(-1, 2)): NaNs produced
b) Error in log(c(-1, 2)): NaNs produced
c) Message
d) All of the mentioned

View Answer

Answer: b [Reason:] Warning is produced due to negative values.

8. Which of the following code represents internal representation of a Date object ?
a) class(as.Date(“1970-01-02”))
b) unclass(as.Date(“1970-01-02”))
c) unclassint(as.Date(“1970-01-02”))
d) all of the mentioned

View Answer

Answer: b [Reason:] You can see the internal representation of a Date object by using the unclass() function.

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

> printmessage2 <- function(x) {
+                      if(is.na(x))
+                              print("x is a missing value!")
+                      else if(x > 0)
+                              print("x is greater than zero")
+                      else
+                              print("x is less than or equal to zero")
+                      invisible(x)
+ }
> printmessage2(NA)

a) “x is a missing value!”
b) “x is greater than zero”
c) “x is less than or equal to zero”
d) None of the mentioned

View Answer

Answer: a [Reason:] We can fix Missing value problem by anticipating the possibility of NA values and checking to see if the input is NA with the is.na() function.

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

> printmessage <- function(x) {
+                      if(x > 0)
+                           print("x is greater than zero")
+                      else
+                           print("x is less than or equal to zero")
+                      invisible(x)
+ }
> printmessage(NA)

a) Error
b) Warning
c) Messages
d) All of the mentioned

View Answer

Answer: a [Reason:] You can’t do that test if x is a NA or NaN value.

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