Test

Data Science Foundations with R Practice Test (Continued)

This Practice Test is the continuation of the Data Science Foundations with R Practice Test, which is ideal for those en route to becoming certified data scientists. With this R practice Test, one can see where they stand in their data science preparation and work toward filling their knowledge gap. In case you miss any questions, adequate explanations have been provided. We highly recommend you to take this test.

  1. 10 questions in all. There is no time constraint, so take your time. You need to score at least 80% to pass
  2. You can retake the test at any time. We recommend you share with friends too.
Improve Your Skill As A Data Scientist

#1. _____ is used to skip an iteration of a loop.


Deal Score0



In loop constructs like while, repeat, and for we can use next to skip to the next iteration.

#2. What will be the output of the following code?

x <-2

switch(2, 2+2, mean(1:10), rnorm(5))


Deal Score0



If the value is a number between 1 and the length of the list, then the corresponding element of list is evaluated and the result returned. Here, EXPR is a number which is 2, hence the second value is taken from the list of values, which is mean(1:10) . Th output for mean(1:10) is 5.5.

#3. Which of the following is true of R statements?


Deal Score0



Statements, such as x<-1:10 or mean(y), can be separated by either a semicolon or a new line. Whenever the evaluator is presented with a syntactically complete statement, that statement is evaluated and the value returned. The result of evaluating a statement can be referred to as the value of the statement. Both semicolons and new lines can be used to separate statements.

#4. What will be the output of following code?

x <-3

switch(6, 2+2, mean(1:10), rnorm(5))


Deal Score0



If a value is too large or too small, NULL is returned.

#5. What will be the output of the following code?

y <-"fruit"

switch(y, fruit ="banana", vegetable ="broccoli", "Neither")


Deal Score0



If a value is a character vector, then the element of “…” with a name that exactly matches value is evaluated. Here, EXPR is y whose value is “fruit.”

#6. Which of the following is true about control statements?


Deal Score0



There are two statements that can be used to explicitly control looping, break and next.

#7. What will be the output of the following code?

centre <-function(x, type){

switch(type, mean=mean(x), median=median(x), trimmed =mean(x, trim = .1))

}

x <-rcauchy(10)

centre(x, "mean")


Deal Score0



A common use of switch is to branch according to the character value of one of the arguments to a function. The results will differ based on the random derivates generated from rcauchy().

#8. Which statement is correct about Dissimilarity?


Deal Score0



Dissimilarity is a measure that ranges from 0 to INF [0, Infinity].

#9. Which of the following codes will not print "Neither"?

Select all that apply:


Deal Score0



If there is no match, a single unnamed argument is used as a default.

#10. R has ____ basic indexing operators.


Deal Score0



R has three basic indexing operators. R contains several constructs that allow access to individual elements or subsets through indexing operations.

FINISH ATTEMPT

Results

-

HD Quiz powered by harmonic design

Improve Your Skill As A Data Scientist


DISCLAIMER: Courses on Future Syllabus are free but subject to return to their original prices on host platforms upon coupon expiration. Enrol while they are free. To report any error, use the "Further Actions" tab.




Show full profile

Editor

Certified Computer Engineer & Author, 'Lost Boys'. I believe in the influence of right information. Join me on Twitter.

Stay active

Leave a Reply

Future Syllabus
Logo
Register New Account
Login/Register via your social accounts (fully secured)

or proceed manually
Reset Password