R interview questions part 12

R interview questions part 12

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Point out the correct statement :

Correct Answer is : All of the mentioned

2. What would be the value of following expression ? log(-1)

Correct Answer is : Warning in log(-1): NaNs produced

3. Warnings are generated by the _________ function

Correct Answer is : warning()

4. Point out the correct statement :

Correct Answer is : POSIX represents a portable operating system interface, primarily for UNIX systems

5. 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)

Correct Answer is : Error

6. To get the current date, the _______ function will return a Date object which can be converted to a different class if necessary.

Correct Answer is : Sys.Date

7. Which of the following code represents internal representation of a Date object ?

Correct Answer is : unclass(as.Date(“1970-01-02”))

8. What would be the output of the following code ? > x <- as.Date("1970-01-01") > x

Correct Answer is : “1970-01-01”

9. 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)

Correct Answer is : Error

10. _________ is an indication that a fatal problem has occurred and execution of the function stops

Correct Answer is : error

11. Point out the correct statement :

Correct Answer is : All of the mentioned

12. What would be the value of following expression ? > log(-2.3)

Correct Answer is : Warning in log(-2.3): NaNs produced

13. Warnings are generated by the _________ function

Correct Answer is : warning()

14. Point out the correct statement :

Correct Answer is : Vectorizing the function can be accomplished easily with the Vectorize() function

15. 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)

Correct Answer is : Error

16. What will be the value of following expression ?

Correct Answer is : Error in log(c(-1, 2)): NaNs produced

17. Which of the following code represents internal representation of a Date object ?

Correct Answer is : unclass(as.Date(“1970-01-02”))

18. 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)

Correct Answer is : “x is a missing value!”

19. 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)

Correct Answer is : Error

20. __________ prints out the function call stack after an error occurs.

Correct Answer is : traceback()

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon