81.
Which of the following R code will print "Hello, world!"?

> f <- function() {
+              cat("Hello, world!\n")
+ }
> f()

>  f <- function() {
+              cat("Hello, World!\n")
+ }
< f()

> f <- function() {
+             cat("Hello world!\n")
+ }
>>= f()

> f <- function() {
-             cat("Hello world!\n")
+ }
<= f()

85.
Which of the following R code generate a uniform random number?

x <- runif(1, 0, 10)
if(x > 3) {
    y <- 10
} else {
    y <- 0
}

x <- run(1, 0, 10)
if(x > 3) {
    y <- 10
} else {
    y <- 0
}

x <- random(1, 0, 10)
if(x > 3) {
    y <- 10
} else {
    y <- 0
}

x <- random(1, 0, 10)
if(x > 1) {
    y <- 0
} else {
    x <- 0
}

87.
Point out the correct statement?

88.
Point out the wrong statement?

89.
What will be the output of the following R code?
> printmessage <- function(x) {
+ if(x > 0)
+         print("x is greater than zero")
+ else
+         print("x is less than or equal to zero")
+ invisible(x)
+ }
> printmessage(1)

Read More Section(Control Structures in R Programming)

Each Section contains maximum 100 MCQs question on Control Structures in R Programming. To get more questions visit other sections.