JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
R interview questions part 6
R interview questions part 6
Back
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()
A. no. of characters
B. first 5 characters
C. last 5 characters
D. Does not exist
Show Correct Answer
Correct Answer is :
no. of characters
2. What is the output of the following function? Sys.Date()
A. Tomorrow date
B. Present date
C. Some date
D. Yesterday date
Show Correct Answer
Correct Answer is :
Present date
3. What is the output of the following function? Sys.time()
A. Tomorrow date and time
B. Present date and time
C. Some date
D. Yesterday date and time
Show Correct Answer
Correct Answer is :
Present date and time
4. Point out the correct statement :
A. Blocks are evaluated until a new line is entered after the closing brace
B. Single statements are evaluated when a new line is typed at the start of the syntactically complete statement
C. The if/else statement conditionally evaluates two statements
D. All of the mentioned
Show Correct Answer
Correct Answer is :
The if/else statement conditionally evaluates two statements
5. Which of the following syntax is correct for while loop ?
A. while ( statement1 ) statement2
B. while ( statement1 ) else statement2
C. while ( statement1 ) do statement2
D. All of the mentioned
Show Correct Answer
Correct Answer is :
while ( statement1 ) statement2
6. Point out the wrong statement :
A. for will execute a loop a fixed number of times
B. break will execute a loop while a condition is true
C. if and else tests a condition and acting on it
D. none of the mentioned
Show Correct Answer
Correct Answer is :
break will execute a loop while a condition is true
7. _______ is used to break the execution of a loop.
A. next
B. skip
C. break
D. all of the mentioned
Show Correct Answer
Correct Answer is :
break
8. Which of the following statement can be used to explicitly control looping ?
A. if
B. while
C. break
D. all of the mentioned
Show Correct Answer
Correct Answer is :
break
9. Which of the following should be preferred for evaluation from list of alternatives ?
A. subsett
B. eval
C. switch
D. none of the mentioned
Show Correct Answer
Correct Answer is :
eval
10. Point out the correct statement :
A. The only way to exit a repeat loop is to call break
B. Infinite loops should generally be avoided
C. Control structures like if, while, and for allow you to control the flow of an R program
D. All of the mentioned
Show Correct Answer
Correct Answer is :
All of the mentioned
11. _________ initiates an infinite loop right from the start.
A. never
B. repeat
C. break
D. set
Show Correct Answer
Correct Answer is :
repeat
12. Point out the wrong statement :
A. Statements cannot be grouped together using braces ‘{’ and ‘}’
B. Computation in R consists of sequentially evaluating statements
C. Single statements are evaluated when a new line is typed at the end of the syntactically complete statement
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Statements cannot be grouped together using braces ‘{’ and ‘}’
13. _______ is used to skip an iteration of a loop.
A. next
B. skip
C. group
D. all of the mentioned
Show Correct Answer
Correct Answer is :
next
14. R has ________ statements that provide explicit looping.
A. 2
B. 3
C. 4
D. 5
Show Correct Answer
Correct Answer is :
3
15. The syntax of the repeat loop is :
A. rep statement
B. repeat statement
C. repeat else
D. none of the mentioned
Show Correct Answer
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))
A. 2.2903605 2.3271663 -0.7060073 1.3622045 -0.2892720
B. 5.5
C.
D. All of the mentioned
Show Correct Answer
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))
A. 5
B. 5.5
C.
D. All of the mentioned
Show Correct Answer
Correct Answer is :
5.5
18. Point out the correct statement :
A. Statements, such as x<-1:10 or mean(y), can be separated by either a semicolon or a new line
B. Whenever the evaluator is presented with a syntactically complete statement that statement is evaluated and the value returned
C. Computation in R consists of sequentially evaluating statements
D. All of the mentioned
Show Correct Answer
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))
A. 10
B. 1
C.
D. 5
Show Correct Answer
Correct Answer is :
20. What will be the output of the following code ? > y <- "fruit" > switch(y, fruit = "banana", vegetable = "broccoli", "Neither")
A. “banana”
B. “Neither”
C. “broccoli”
D. all of the mentioned
Show Correct Answer
Correct Answer is :
“banana”
Similar Interview Questions
Search for latest jobs
Find Jobs