wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DATA SCIENCE 4

Total questions: 20

Worksheet time: 12mins

Name
Class
Date
1.

What will be the output of the following R code?

x <- c(1, 2, 3)

y <- c("4", "5", "six")

z <- c(x, y)

z[4:6]

class(z)

a)

[1] "4" "5" "six"

[1] "character"

b)

[1] 4 5 six

[1] "numeric"

c)

[1] 4 5 six

[1] "mixed"

d)

[1] "1" "2" "3"

[1] "character"

2.

What will be the output of this code?

x <- c(TRUE, FALSE, TRUE)

y <- c(1, 0, 2)

sum(x * y)

a)

A. 3


b)

B. 2

c)

C. 1

d)

D. Error

3.

x <- c(1, 2, 3)

y <- c(4, 5, 6)

x + y

a)

A. 5 7 9

b)

B. Error

c)

C. x4 x5 x6

d)

D. 1 2 3 4 5 6

4.

What does the c() function do in R?



a)

A. Cuts a string

b)

B. Creates a matrix

c)

C. Combines values into a vector

d)

D. Converts data to character type

5.

What will this code return?

x <- c(10, 20, 30, 40) x[2:3]

a)

A. 10 20


b)

B. 20 30

c)

C. 30 40

d)

D. 20 30 40

6.

Which function is used to create a data frame?




a)

A. create.frame()

b)

B. frame()

c)

C. data.frame()

d)

D. make.frame()

7.

What will length(c(2, 4, 6, 8)) return?

a)

A. 2


b)

B. 4

c)

C. 8

d)

D. Error

8.

What will be the output?

x <- c(TRUE, FALSE, TRUE)

sum(x)

a)

A. 3


b)

B. 1

c)

C. 2

d)

D. Error

9.

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



a)

A. Numeric

b)

B. Character

c)


C. Matrix

d)

D. Logical

10.

What will be the output of the following?

class(3.14)

a)

A. "double"


b)

B. "numeric"

c)

C. "integer"

d)

D. "float"

11.

The function used to create a vector in R is (a)   .

12.

In R, indexing starts from the number (a)   .

13.

The number 4+2i is of (a)   data type in R.

14.

The data type used to store TRUE or FALSE values is called (a)   .

15.

Which of these is a logical constant in R?

a)

A. yes / no

b)

B. true / false

c)

C. TRUE / FALSE

d)

D. 1 / 0

16.

Which of the following best describes "datafication"?

a)

A. Collecting structured data from large systems


b)

B. Turning many aspects of life into quantified data

c)

C. Cleaning and preprocessing datasets

d)

D. Using graphs to visualize information

17.

Overfitting in a model means—



a)

A. The model performs well on both training and test data

b)

B. The model is too simple and misses key patterns

c)

C. The model fits the training data too well but fails to generalize

d)

D. The model has low variance and high bias

18.

What is the role of a sample in statistical inference?



a)




A. It is the entire dataset we want to analyze

b)

B. It is the variable of interest

c)

C. It is a subset used to make inferences about the population

d)

D. It contains only outliers

19.

In R, the data type used to represent categorical variables is called a ______.

a)

FACTOR

b)

LIST

c)

DATA

d)

DATA FRAME

20.

What is the output?

x <- c(5L, 10L, 15L)

typeof(x)




a)

A. "integer"

b)

B. "numeric"

c)

C. "double"

d)

D. "character"