You are on page 1of 3

G.H.

RAISONI COLLEGE OF ENGINEERING,


NAGPUR
(An Autonomous Institute Under UGC Act 1956)

Department of Computer Science &


Engineering

SEP Batch II2015-16 ODD term


R Programming TEST

1. Why does the code produce an error message?


x = "1"
y=2
x*y
2. The seq command: generate output & analyse
x = s e q(0, 10)
y = s e q(0, 1001, by=0.5)
z = s e q(1000, 0, by= -exp(1))
3. The R language is a dialect of _______________Programming Language.
4. Suppose I have a vector x <- 1:4 and y <- 2:3. What is produced by the expression x + y?

5. Suppose I have a vector x <- c(3, 5, 1, 10, 12, 6) and I want to set all elements of this vector that are less than
6 to be equal to zero. What R code achieves this?
A) x[x < 6] == 0
B) x[x == 6] <- 0
C) x[x < 6] <- 0
D) x[x == 0]
6. To remove objects Which function is available:
1. Rm
2. Ls
3. Remove
7. Which are the important types of Objects in R
1. Array
2. Vectors
3. Matrices
8. What is the output of the following Code:
>x=c(5,6,8,9)
> which(x>7)
> x==8
9. What is the output :
i=1
while (i <= 10)
{
print(i)
i=i+1
}
10. We cannot typecast a character to integer or numeric but the integer or numeric value can be typecasted as
character
1. TRUE
2.FALSE
11. To get more information on any specific named function, for example mean, the command is
____________________________.
12. What do you suppose numeric(100) does?

13. Create a vector with 13 elements starting from 1 to 2.2 and the increment between the successive elements
of vectors be .1

14. What vector results from seq(1, 10.5)?

15. Does(0:10)/10 gives the same result as seq(0, 1, by=.1).

16. what is the result of (1:4)^(0:3)? Analyse.

17. What is the output of the following:


v3 <- numeric(10)
v3
0000000000
v3[1:3] <- 4:6

18.Show the output:


w4
[1] 4 9 4 0
y <- (w4 == 4)

19. Plot a parabola and write the code here.

20. Suppose the IQ scores of 20 elementary school students are listed in the vector IQ below

IQ <- c( 84, 108, 98, 110, 86, 123, 101, 114, 121, 131, 90, 108, 105, 93, 95, 102, 119, 98, 94, 73)

Create histogram of these 20 IQ scores.

21. What are Packages in R?

____________________________________________________________________
____________________________________________________________________
____________________________________________________________________

You might also like