wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

R - Unit 1

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is R primarily used for?

a)

Web development

b)

Statistical computing and graphics

c)

Mobile app programming

d)

Machine hardware control

2.

Which command is used to install packages in R?

a)

install()

b)

new.package()

c)

install.packages()

d)

library.install()

3.

Which function is used to load an installed package in R?

a)

load()

b)

library()

c)

attach()

d)

run()

4.

Which of the following assigns a value to a variable in R?

a)

var = 10

b)

var <- 10

c)

var := 10

d)

var => 10

5.

Which data type holds TRUE/FALSE values in R?

a)

Character

b)

Complex

c)

Logical

d)

Integer

6.

Which function returns the structure of an R object?

a)

type()

b)

structure()

c)

detail()

d)

str()

7.

7. Which statement is used for conditional execution in R?

a)
when
b)
unless
c)
if
d)
case
8.

8. Which loop is used to repeat code a fixed number of times using a sequence?

a)
for loop
b)
foreach loop
c)
do-while loop
d)
while loop
9.

9. Which loop continues until a condition becomes FALSE?

a)
do-while loop
b)
for loop
c)
repeat-until loop
d)
while loop
10.

10. Which operator in R is considered best practice for assignment?

a)
=
b)
<-
c)
->
d)
:=
11.

11. Comments in R begin with which symbol?

a)
#
b)
/*
c)
//
d)
--
12.

12. A matrix in R must contain:

a)
Random values scattered in a single line.
b)
Numbers arranged in a circular pattern.
c)
Strings placed in a random order.
d)
Elements of the same type organized in rows and columns.
13.

13. Which R function creates a vector?

a)
vector()
b)
create_vector()
c)
make_vector()
d)
c()
14.

14. Which of the following breaks a running loop in R?

a)
break
b)
stop
c)
exit
d)
terminate
15.

15. Which control statement skips the current iteration and continues to the next?

a)
return
b)
exit
c)
continue
d)
break