R interview questions part 6

R interview questions part 6

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

Total Questions: 20

1. What is the output of the following function? nchar()

Correct Answer is : no. of characters

2. What is the output of the following function? Sys.Date()

Correct Answer is : Present date

3. What is the output of the following function? Sys.time()

Correct Answer is : Present date and time

4. Point out the correct statement :

Correct Answer is : The if/else statement conditionally evaluates two statements

5. Which of the following syntax is correct for while loop ?

Correct Answer is : while ( statement1 ) statement2

6. Point out the wrong statement :

Correct Answer is : break will execute a loop while a condition is true

7. _______ is used to break the execution of a loop.

Correct Answer is : break

8. Which of the following statement can be used to explicitly control looping ?

Correct Answer is : break

9. Which of the following should be preferred for evaluation from list of alternatives ?

Correct Answer is : eval

10. Point out the correct statement :

Correct Answer is : All of the mentioned

11. _________ initiates an infinite loop right from the start.

Correct Answer is : repeat

12. Point out the wrong statement :

Correct Answer is : Statements cannot be grouped together using braces ‘{’ and ‘}’

13. _______ is used to skip an iteration of a loop.

Correct Answer is : next

14. R has ________ statements that provide explicit looping.

Correct Answer is : 3

15. The syntax of the repeat loop is :

Correct Answer is : repeat statement

16. Which will be the output of following code ? > x <- 3 > switch(x, 2+2, mean(1:10), rnorm(5))

Correct Answer is : 2.2903605 2.3271663 -0.7060073 1.3622045 -0.2892720

17. What will be the output of the following code ? > x <- 3 > switch(2, 2+2, mean(1:10), rnorm(5))

Correct Answer is : 5.5

18. Point out the correct statement :

Correct Answer is : All of the mentioned

19. Which will be the output of following code ? > x <- 3 > switch(6, 2+2, mean(1:10), rnorm(5))

Correct Answer is :

20. What will be the output of the following code ? > y <- "fruit" > switch(y, fruit = "banana", vegetable = "broccoli", "Neither")

Correct Answer is : “banana”

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon