1.
What is the output of the following R code:
x < -1: 4
x > 2
2.
What is the output of the following R code:
x < -2
switch (x, x + x, mean(1: x), mean(x: x * x))
3.
What is the output of the following R code:
signif(-345.123, digits = 4)
4.
What is the output of the following R code:
x < -1: 10
ifelse(x < 5 | x > 8, x, 0)
5.
Which of the following extensions is used in R language codes?
6.
Which of these describes X3 when the following R code is executed:
X1 < -c(1, 3, 5)
X2 < -c(3, 2, 10)
X3 < -rbind(X1, X2)
7.
What is the output of the following R code:
x < -gsub("(a)", "\1_", month.name[1], perl = TRUE)
paste(rev(unlist(strsplit(x, NULL))), collapse = "")
8.
What is the output of the following R code:
myfct < - function(x1, x2 = 5) {
    z1 < -x1 / x1
    z2 < -x2 * (x1 / x2)
    myvec < -c(z1, z2)
    return (myvec)
}
myfct(2, 5)
myfct(x1 = 5)
9.
What is the output of the following R code:
x < -1: 10
test < - function(x) {
    if (x < 5) {
        x - 1
    } else {
        x / x
    }
}
apply(as.matrix(x), 1, test)
10.
What is the output of the following R code:
mystery_method < - function(x) {
    function(z) Reduce(function(y, w) w(y), x, z)
}
fn < -mystery_method(c(function(x) x + 1, function(x) x * x))
fn(3)