wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

R Language 3rd_year biotech Lab 1

Total questions: 23

Worksheet time: 15mins

Name
Class
Date
1.

What is the primary purpose of using the R language?

a)

To write novels

b)

To design websites

c)

To give orders to a PC for data analysis

d)

To create video games

2.

Which of the following is NOT a data type in R?

a)

integer

b)

logical

c)

string

d)

character

3.

What is a vector in R?

a)

A collection of different data types

b)

A function to manipulate data

c)

A one-dimensional array of data

d)

A two-dimensional table

4.

How do you define a variable in R?

a)

Using the keyword 'var'

b)

By writing its name followed by '=' then the value

c)

By using the 'define' command

d)

By writing its name followed by '->' then the value

5.

What does the dollar sign '$' signify in R?

a)

It denotes a function

b)

It indicates a comment

c)

It specifies a column name in a data frame

d)

It represents a variable

6.

Which of the following is a correct way to create a data frame in R?

a)

df -> data.frame(x, y, z)

b)

df <- new.data.frame(x, y)

c)

df <- create.data.frame(x, y)

d)

df <- data.frame(x, y)

7.

What is the data type of the output of this code:
df$IC50 < 400
(assume there is a dataframe called df containing IC50 column with numeric value)

a)

A data frame

b)

A character string

c)

An integer

d)

A logical vector

8.

What does the 'subset()' function do in R?

a)

It sorts data in ascending order

b)

It merges two data frames

c)

It filters data based on conditions

d)

It creates a new empty data frame

9.

Which of the following is a valid logical value in R?

a)

TRUE

b)

true

c)

True

d)

TRue

10.

What is the minimum number of dimensions in matrix in R?

a)

One-dimensional

b)

Two-dimensional

c)

Three-dimensional

11.

In R, how do you represent a character string?

a)

With curly braces

b)

With square brackets

c)

With single or double quotes

d)

With parentheses

12.

Which of the following is an example of a factor in R?

a)

A logical value

b)

A categorical variable

c)

A character string

d)

A numeric value

13.

What does the command 'cat()' do in R?

a)

It concatenates and prints objects

b)

It defines a variable

c)

It reads data from a file

d)

It creates a plot

14.

How do you extract rows from a data frame based on a condition?

a)

Using the extract() function

b)

Using the select() function

c)

Using the subset() function

15.

What is the output of 'df[df$IC50 < 200, ]'?

a)

An error message

b)

All columns with rows having IC50 less than 200

c)

All rows with IC50 greater than 200

d)

A summary of the data frame

16.

Which of the following is a valid numeric value in R?

a)

3.14

b)

'3.14'

c)

three point one four

d)

3,14

17.

What does the 'c()' function do in R?

a)

It combines values into a vector

b)

It creates a character string

c)

It calculates the mean

d)

It converts data types

18.

Which of the following is NOT a data structure in R?

a)

Array

b)

Data frame

c)

Matrix

d)

Table

19.

What does the 'length()' function return in R?

a)

The number of rows in a data frame

b)

The number of columns in a data frame

c)

The number of elements in a vector

d)

The size of a matrix

20.

Which of the following is a valid way to comment in R?

a)

<--

b)

#

c)

//

d)

/* */

21.

Which of the following is a valid way to create a numeric vector in R?

a)

new.vector(1, 2, 3)

b)

vector(1, 2, 3)

c)

c(1, 2, 3)

d)

list(1, 2, 3)

22.

What is the output of 'df$IC50 < 200' if no rows meet the condition?

a)

A summary of the data frame

b)

An error message

c)

A logical vector of FALSE

d)

A data frame with zero rows

23.

draw something to share with your friends