1
What is the primary purpose of R programming language?
A)
Web Development
B)
Data Analysis
C)
Game Development
D)
Mobile App Development
Answer & Solution
Answer: Option
B
2
In R, what does the function length() do?
A)
Returns the sum of elements
B)
Returns the number of elements
C)
Sorts the elements
D)
Computes the mean
Answer & Solution
Answer: Option
B
3
How is a comment denoted in R?
A)
// Comment
B)
/* Comment */
C)
# Comment
D)
-- Comment
Answer & Solution
Answer: Option
C
4
What does the function install.packages() do in R?
A)
Load a package
B)
Uninstall a package
C)
Install a new package
D)
Update all packages
Answer & Solution
Answer: Option
C
5
Which of the following is a correct variable name in R?
A)
123_variable
B)
variable_name_123
C)
my-variable
D)
1st_variable
Answer & Solution
Answer: Option
B
6
What does RStudio provide for R programming?
A)
A programming language
B)
An integrated development environment
C)
A statistical model
D)
A data storage format
Answer & Solution
Answer: Option
B
7
In R, how is a matrix created using the matrix() function?
A)
matrix(1:9, nrow = 3, ncol = 3)
B)
create.matrix(1:9, rows = 3, columns = 3)
C)
[1, 2, 3; 4, 5, 6; 7, 8, 9]
D)
mat(1:9, 3, 3)
Answer & Solution
Answer: Option
A
8
What is the purpose of the function Sys.Date() in R?
A)
Display current date and time
B)
Extract system information
C)
Retrieve the current date
D)
Convert date to character
Answer & Solution
Answer: Option
C
9
Which of the following is a valid R data type?
A)
String
B)
Boolean
C)
Complex
D)
All of the above
Answer & Solution
Answer: Option
D
10
How is a data frame created in R?
A)
df <- c(1, 2, 3)
B)
data.frame(x = 1:3, y = c('A', 'B', 'C'))
C)
createDataFrame(1, 2, 3)
D)
matrix(1:3, nrow = 1, ncol = 3)
Answer & Solution
Answer: Option
B