Que.What will be the output of the following R code snippet?> lm <- function(x) { x * x }
> lm
|
a. function(x) { x * x } |
b. func(x) { x * x } |
c. function(x) { x / x } |
d. function { x $ x } |
Que.Point out the correct statement?
|
a. The search list can be found by using the searchlist() function |
b. The search list can be found by using the search() function |
c. The global environment or the user’s workspace is always the second element of the search list |
d. R has separate namespaces for functions and non-functions |
The search list can be found by using the search() function
Que.A function, together with an environment, makes up what is called a ______ closure.
|
a. formal |
b. function |
c. reflective |
d. symmetry |
Que.Which of the variable in the following R code is variable?> f <- function(x, y) {
+ x^2 + y / z
+ }
|
a. x |
b. y |
c. z |
d. yy |
Que.Point out the wrong statement?
|
a. The order of the packages on the search list does not matter |
b. R has separate namespaces for functions and non-functions |
c. Users can configure which packages get loaded on startup so if you are writing a function |
d. The search list can be found by using the search() function |
The order of the packages on the search list does not matter
Que.R uses _________ scoping or static scoping.
|
a. reflective |
b. transitive |
c. lexical |
d. closure |
Que.The only environment without a parent is the ________ environment.
|
a. full |
b. half |
c. null |
d. empty |
Que.The ________ for R are the main feature that make it different from the original S language.
|
a. scoping rules |
b. closure rules |
c. environment rules |
d. closure and environment rules |
Que.The _________ function is a kind of “constructor function” that can be used to construct other functions.
|
a. make.pow() |
b. make.power() |
c. keep.power() |
d. keep.pow() |
Que.What will be the output of the following R code snippet?> g <- function(x) {
+ a <- 3
+ x+a+y
+ ## 'y' is a free variable
+ }
> g(2)
|
a. 9 |
b. 42 |
c. 8 |
d. Error |