Introduction to R Studio Class 11 Questions and Answer

Objective Type Questions

1. R is an ______________ programming language?

a) Closed source

b) GPL

c) Open source

d) Definite source

Answer: c) Open source

 

2. How many types of R objects are present in R data type?

a) 4

b) 5

c) 6

d) 7

Answer: c) 6

 

3. In vector, where all arguments are forced to a common type, please tick the correct order:

a) Expression <logical < double

b) Double < logical <NULL

c) Integer < character < expression

d) Character < logical < raw

Answer: d) Character < logical < raw

 

4. Which function is used to create the vector with more than one element?

a) Library ()

b) plot ()

c) c ()

d) par ()

Answer: c) c()

 

5. Which of the following is incorrect regarding List in R programming?

a) A list is a type of R object containing elements of different types like numbers, strings, vectors.

b) A list can also contain another list within it

c) Elements in a list can be accessed using the index of the element in the list.

d) The addition or deletion of the elements can only be done at the middle of the list.

Answer: d) The addition or deletion of the elements can only be done at the middle of the list.

Introduction to R Studio Class 11 Questions and Answer

6. A _________ is a two-dimensional rectangular data set.

a) Vector

b) Lists

c) Matrix

d) Functions

Answer: c) Matrix

 

7. Which function takes a dim attribute which creates the required number of dimensions?

a) Vector

b) Array

c) Matrix

d) Lists

Answer: b) Array

 

8. By what function we can create data frames?

a) Data.frames ( )

b) Data.sets ( )

c) Function ( )

d) C ( )

Answer: a) Data.frames( )

 

9. Which are indexed by either row or column using a specific name or number?

a) Datasets

b) Data frames

c) Data

d) Functions

Answer: b) Data frames

 

10. The geom function used to plot scatter plot while using ggplot2 package is:

a) geom_point()

b) geom_boxplot()

c) geom_line()

d) None of the above

Answer: a) geom_point()

 

Introduction to R Studio Class 11 Questions and Answer

Standard Questions

1. Write a program in R to create a multi-element vector having the first ten natural numbers and print it.

# Create a multi-element vector with the first ten natural numbers
natural_numbers <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

# Print the vector
print(natural_numbers)

2. Suppose we have two vectors, V1 = [2, 3, 0, 5] and V2 = [6, 1, 7, 0]. What will be  the result of the following?

a) V1+V2

Result: [8, 4, 7, 5]

 

b) V1- V2

Result: [-4, 2, -7, 5]

 

c)V1*V3

Result: [12, 3, 0, 0]

 

d)V1/V2

Result: [0.3333333, 3.0000000, 0.0000000, Inf]

Note: Division by zero in element-wise operations results in ‘Inf’ (infinity).

 

3. Write an R program to create two numeric matrices and perform arithmetic operations like addition, subtraction, multiplication, and division.

 

# Create two numeric matrices
matrix1 <- matrix(c(1, 2, 3, 4), nrow = 2)
matrix2 <- matrix(c(5, 6, 7, 8), nrow = 2)

# Addition of matrices
addition_result <- matrix1 + matrix2

# Subtraction of matrices
subtraction_result <- matrix1 - matrix2

# Multiplication of matrices
multiplication_result <- matrix1 * matrix2

# Division of matrices
division_result <- matrix1 / matrix2

# Print the results
print("Addition:")
print(addition_result)

print("Subtraction:")
print(subtraction_result)

print("Multiplication:")
print(multiplication_result)

print("Division:")
print(division_result)

 

By cbsepython

A complete solution for the students of class 9 to 12 having subject Information Technology (402), Computer Science (083). Explore our website for all the useful content as Topic wise notes, Solved QNA, MCQs, Projects and Quiz related to the latest syllabus.

Copywrite © 2020-2024, CBSE Python,
All Rights Reserved