What is the result of the R expression 4 + 3 * 25? 79
A: 79
B: 103
C: 74
D: 175
Which R function saves a workspace to a .RData file? save.image()
A: save.data()
B: save.workspace()
C: save.image()
D: save.file()
In RStudio, which of the following statements about You write code in the Console when you want to try out R commands or to run
writing code in the File Editor and the Console are a few lines of code.
true? Select two answers. You write code, usually for multiple lines of code, in the File Editor and execute
A: Only files containing R code can be edited in the File them in batch mode.
Editor
B: You write code in the Console when you want to try
out R commands or to run a few lines of code.
C: You write code, usually for multiple lines of code, in
the File Editor and execute them in batch mode.
D: Code in the File Editor executes immediately as you
type it so you can see the results quickly.
Complete the statement: A Jupyter Notebook is made Cells
up of a series of _______________ that you can use to write,
run, and interact with your code.
A: Workspaces
B: Objects
C: Cells
D: Files
R can perform several forms of statistical computation. Testing if the mean values of two groups are statistically different.
What is an example of hypothesis testing?
A: Inferring an unknown mean value of a population
from its samples.
B: Compute and visualize a correlation matrix among
four different variables to see if they are correlated.
C: Obtaining a representative subset of data.
D: Testing if the mean values of two groups are
statistically different.
Which of the following data type conversions may be character (like `1`, `A`, or `test`) to numeric
not allowed in R?
A: logical (like TRUE or FALSE) to numeric
B: integer (like 1L or 2L) to numeric
C: character (like `1`, `A`, or `test`) to numeric
D: numeric (like 1 or 2) to integer
, DSR301m FPTU_AI Study Guide
What is the result of the R expression 100 * (5 - 3)? 200
A: 200
B: 497
C: 500
D: 503
After you write code in an R script file or the R Console, R Interpreter
what component of the R environment parses the code
into objects in memory?
A: R data files
B: R variables, functions, and datasets
C: R Workspace
D: R Interpreter
Which features of RStudio help facilitate code writing? Code auto completion
Select two answers. Syntax highlighting
A: Code auto completion
B: File Explorer
C: Syntax highlighting
D: Workspace visualization
True or False: Execution order does not matter when False
executing cells in a Jupyter notebook
A: True
B: False
What is the difference between the expression c(1, 2, 3, They both produce a vector with five numbers but the first is in ascending
4, 5) and the expression c(5:1)? order and the second is in descending order.
A: The two expressions produce the same result.
B: They both produce a vector with five numbers but
the first is in ascending order and the second is in
descending order.
C: They both produce a factor with five numbers but
the first is in ascending order and the second is in
descending order.
D: One produces a factor and the other produces a
vector.
Assume that the variable test_result contains the vector [1] 25 35 40
c(25, 35, 40, 50, 75). What is the result of the expression
test_result[test_result < 50]?
A: [1] 25 35 40
B: [1] TRUE TRUE TRUE FALSE FALSE
C: [1] TRUE TRUE TRUE TRUE FALSE
D: [1] 25 35 40 50
, DSR301m FPTU_AI Study Guide
What is the main difference between a list and a A list can contain different types of data, while a vector may only contain one
vector? type of data.
A: A list is a multi-dimensional array of values, while a
vector is a single dimensional array of values.
B: It is not possible to add or remove items from a list,
but you can do this with a vector.
C: A list can contain different types of data, while a
vector may only contain one type of data.
D: A list can contain nominal or ordinal values, while a
vector cannot.
What are three types of data you can store in an array Numeric valus
or matrix? Select three answers. Strings
A: Numeric valus Integers
B: Strings
C: Vectors
D: Integers
In a data frame, each column is represented by a Vector
_________________ of values of the same data type.
A: Vector
B: Variable
C: List
D: Matrix
What is a nominal factor? A factor with no implied order.
A: A factor with any type or number of elements.
B: A factor with no implied order.
C: A factor with ordering.
D: A factor that contains numeric data.
Assume that the variable test_result contains the vector 45
c(25, 35, 40, 50, 75).What is the result of the expression
mean(test_result)?
A: 45
B: 40
C: 50
D: 35
Assume you have variable called employee that employee["age"] <- 35
contains the expression list(name = "Juan", age = 30).
What is the correct command to change the contents
of the age item to 35?
A: employee["age"] <- 35
B: employee[age] = 35
C: employee[age] <- 35
D: employee["age"] == 35
, DSR301m FPTU_AI Study Guide
What is the main difference between a matrix and an A matrix must be two dimensional, but an array can be single, two dimensional,
array? or more than two dimensional.
A: A matrix must be two dimensional, but an array can
be single, two dimensional, or more than two
dimensional.
B: A matrix can contain multiple types of data, but an
array can only contain data of the same type.
C: A matrix can contain vectors, but an array can only
contain strings, characters, or integers.
D: A matrix can be arranged by rows or columns, but an
array is always arranged by columns.
Assume that you have a data frame called employee employee$title
that contains three variables: name, age, and title. If you
want to return all the values in the title variable, what
command should you use?
A: employee$title
B: employee.title
C: employee[[3]]
D: employee[title]
Which looping statement should you use if you want to While loop
continue to perform an operation if the value of an
expression is true?
A: Do While loop
B: For Each loop
C: For loop
D: While loop
What happens if a user-defined function is missing the The function returns the last evaluated expression in the function.
return statement?
A: The function returns an error.
B: The function returns the last evaluated expression in
the function.
C: The function returns a NULL value.
D: The function returns the first evaluated expression it
encounters and then immediately exits the function.
Assume you have a variable called word_string that chartr()
contains the string "The quick red fox jumped over the
lazy dog." Which function can you use to replace the
word "dog" with the word "cat" in the word_string
variable?
A: strsplit()
B: substr()
C: nchar()
D: chartr()