Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. The ________ function takes an arbitrary number of arguments and concatenates them one by one into character strings.
a) copy()
b) paste()
c) bind()
d) none of the mentioned

View Answer

Answer: a [Reason:] Any numbers given among the arguments are coerced into character strings in the evident way, that is, in the same way they would be if they were printed.

2. Point out the correct statement :
a) Character strings are entered using either matching double (“) or single (‘) quotes
b) Character vectors may be concatenated into a vector by the c() function
c) Subsets of the elements of a vector may be selected by appending to the name of the vector an index vector in square brackets
d) All of the mentioned

View Answer

Answer: d [Reason:] Character quantities and character vectors are used frequently in R.

3. What would be the result of following code ?

> x <- 1:3
> y <- 10:12
> rbind(x, y)

a)

[,1] [,2] [,3]
x 1 2 3
y 10 11 12

b)

[,1] [,2] [,3]
x 1 2 3
y 10 11

c)

[,1] [,2] [,3]
x 1 2 3
y 4 5 6

d) All of the mentioned

View Answer

Answer: a [Reason:] rbind() function combines vector, matrix or data frame by rows.

4. What would the following code print ?

> x <- list(1, "a", TRUE, 1 + 4i)
> x

a)

[[1]]
[1] 1
 
[[2]]
[1] "a"
 
[[3]]
[1] TRUE
 
[[4]]
[1] 1+4i

b)

[[1]]
[1] 2
 
[[2]]
[1] "b"
 
[[3]]
[1] TRUE
 
[[4]]
[1] 1+4i

c)

[[1]]
[1] 3
 
[[2]]
[1] "a"
 
[[3]]
[1] TRUE
 
[[4]]
[1] 1+4i

d) All of the mentioned

View Answer

Answer: a [Reason:] Lists can be explicitly created using the list() function, which takes an arbitrary number of arguments.

5. Point out the wrong statement :
a) matrices or more generally arrays are multi-dimensional generalizations of vectors
b) factors provide compact ways to handle categorical data
c) vectors provide a convenient way to return the results of a statistical computation
d) all of the mentioned

View Answer

Answer: c [Reason:] The dimension attribute is itself an integer vector of length 2 (number of rows, number of columns).

6. Which of the following is invalid assignment ?
a)

 > x <- fact(c("yes", "yes", "no", "yes", "no"))

b)

 > x <- factor(c("yes", "yes", "no", "yes", "no"))

c)

 > x <- factor(factor("yes", "yes", "no", "yes", "no"))

d) None of the mentioned

View Answer

Answer: b [Reason:] Factor objects can be created with the factor() function.

7. What would be the output of the following code ?

> x <- vector("list", length = 5)
> x

a) NULL
b) 1
c) 0
d) None of the mentioned

View Answer

Answer: a [Reason:] We can also create an empty list of a pre-specified length with the vector() function.

8. What would be the output of the following code ?

> x <- factor(c("yes", "yes", "no", "yes", "no"))
> table(x)

a)

no yes
2 3

b)

yes no
2 3

c)

no yes
2 2

d) All of the mentioned

View Answer

Answer: a [Reason:] The order of the levels of a factor can be set using the levels argument to factor().

9. Which of the following code snippet will create a vector with NAs in it ?
a) x >- c(1, 2, NA, 10, 3)
b) x >- cNA(1, 2, NA, 10, 3)
c) x >- NA(1, 2, NA, 10, 3)
d) None of the mentioned

View Answer

Answer: a [Reason:] This returns a logical vector indicating which elements are NA.

10.What would the following code print ?

> x <- c(1, 2, NaN, NA, 4)
> is.na(x)

a) FALSE FALSE TRUE TRUE FALSE
b) FALSE TRUE TRUE TRUE FALSE
c) TRUE FALSE TRUE TRUE FALSE
d) None of the mentioned

View Answer

Answer: a [Reason:] Missing values are denoted by NA or NaN for q undefined mathematical operations.

Synopsis and Project Report

You can buy synopsis and project from distpub.com. Just visit https://distpub.com/product-category/projects/ and buy your university/institute project from distpub.com

.woocommerce-message { background-color: #98C391 !important; }