Select Page
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. _________ ensures reproducibility of the sequence of random numbers.
a) sets.seed()
b) set.seed()
c) set.seedvalue()
d) all of the mentioned

Answer: b [Reason:] Setting the random number seed with set.seed() ensures reproducibility of the sequence of random numbers.

2. Point out the correct statement :
a) When simulating any random numbers it is not essential to set the random number seed
b) It is not possible to generate random numbers from other probability distributions like the Poisson
c) You should always set the random number seed when conducting a simulation
d) All of the mentioned

Answer: c [Reason:] Otherwise, you will not be able to reconstruct the exact numbers that you produced in an analysis.

3. 5 Normal random numbers can be generated with rnorm() by setting seed value to :
a) 1
b) 2
c) 3
d) 4

Answer: a [Reason:] set.seed(1) will give 5 normal random numbers.

4. _______ function is used to simulate binary random variables.
a) dnorm
b) rbinom()
c) binom()
d) rpois

Answer: b [Reason:] rbinom() is used to simulate a predictor variable x that is binary instead of having a Normal distribution.

5. Point out the wrong statement :
a) Drawing samples from specific probability distributions can be done with āsā functions
b) The sample() function draws randomly from a specified set of (scalar) objects allowing you to sample from arbitrary distributions of numbers
c) The sampling() function draws randomly from a specified set of objects
d) None of the mentioned

Answer: b [Reason:] The sample() function can be used to draw random samples from arbitrary vectors.

6. What will be the output of the following code >

```> set.seed(10)
> x <- rbinom(100, 1, 0.5)
> str(x)```

a)

` int [1:100] 1 0 0 1 0 0 0 0 1 0 ...`

b)

` int [1:100] 10 0 01 1 0 0 01 0 1 0 ...`

c)

` int [1:100] 1 03 0 1 0 0 0 02 1 0 ...`

d)

` int [1:100] 1 2 3 1 1 0 0 0 1 0 ...`

Answer: a [Reason:] Graph of x can be plotted using plot function.

7. __________ distribution is commonly used to model data that come in the form of counts.
a) Gaussian
b) Parametric
c) Poisson
d) All of the mentioned

Answer: c [Reason:] It is possible to generate random numbers from other probability distributions like the Poisson.

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

` > rpois(10, 1)`

a)

` [1] 7 0 1 1 2 1 1 4 1 2`

b)

` [1] 0 8 1 1 2 1 1 4 1 2`

c)

` [1] 0 0 1 1 2 1 1 4 1 2`

d) All of the mentioned

Answer: c [Reason:] The above code represents count with mean of 1.

9. Which of the following code represents count with mean of 2 ?
a) rpois(10, 2)
b) rpois(10, 20)
c) rpois(20, 2)
d) all of the mentioned

Answer: a [Reason:] rpois(10, 20) give counts with a mean of 20.

10. What will be the output of the following code ?

```> set.seed(20)
> x <- rnorm(100)
> e <- rnorm(100, 0, 2)
> y <- 0.5 + 2 * x + e
> summary(y)```

a)

```Min. 1st Qu. Median Mean 3rd Qu. Max.
-6.4080 -1.5400 0.6789 0.6893 2.9300 6.5050```

b)

```Min. 1st Qu. Median Mean 3rd Qu. Max.
-6.4080 -10.5400 0.6789 5.6893 2.9300 6.5050```

c)

```Min. 1st Qu. Median Mean 3rd Qu. Max.
-1.4080 -6.5400 0.6789 0.6893 2.9300 6.5050```

d) All of the mentioned