Exam Revision MATH2349
1. Consider the following string. Which command would you use to replace the `x` with blank
(whitespace)? string ← c("169 millimeters x 117 millimeters x 9.1 millimeters")
2.
What is the result of the following R code?
3. Which one of the following is NOT one of the print functions?
4. Consider x vector. Which one of the following removes all punctuations in x? c("hello!", "good
-day.", "hi 5��"�
A chartr(string, x)
B chartr(string, "x", "~")
C chartr(string, old="x",new=" ")
D chartr(string, "x", " - ")
A TRUE
B FALSE
C "WA", "SA", "NSW"
D "TAS", "VIC"
A cat()
B print()
C noquote()
D quote()
A str_subset(x, "[:alnum:]")
B str_extract(x, "[:alnum:]")
C str_remove(x, "[:punct:]")
D str_replace_all(x, "[:punct:]", "")
E94793
Highlight
E94793
Highlight
E94793
Highlight
E94793
Highlight
5.
According to the following code, what will be the result of y?
6. Consider the following data frame. `date_col` variable is in a
factor format. What command would you use to convert it to a
date format?
7. The header of the Flights data frame is given in the
following output. Which one of the following can be
used to extract the day of the month information of the
`Flights$departure_time`?
A 7
B 1
C 2
D 5
A ymd()
B dmy()
C is.date()
D mdy()
A mday(Flights$departure_time)
B month(Flights$departure_time)
C year(Flights$departure_time)
D hour(Flights$departure_time)
E94793
Highlight
E94793
Highlight
E94793
Highlight
8. Which one of the following functions from `lu
idate` package will convert `z` into a date
format? z ← c(" XXXXXXXXXX", " XXXXXXXXXX", "23/03/2018", "30�01�2018")
9. In which one of the following are values divided by their standard deviation (or root mean
square)?
10.
According to the following code, what will be the result of `y`?
11. Which one of the following packages has a function to detect multivariate outliers?
12. Which of the following can be used to deal with outliers?
A ymd(z)
B dmy(z)
C ydm(z)
D hms(z)
A Box-Cox transformation
B logarithmic transformation
C z-score standardisation
D square root transformation
A XXXXXXXXXXNA XXXXXXXXXX
B XXXXXXXXXXNA XXXXXXXXXX
C NA NA NA NA NA
D XXXXXXXXXXNA XXXXXXXXXX
A li
ary(dplyr)
B li
ary(MVN)
C li
ary(tidyr)
D li
ary(validate)
A Capping
B Transforming
C Imputing
D All of the above
E94793
Highlight
E94793
Highlight
E94793
Highlight
E94793
Highlight
E94793
Highlight
13.
Which one of the following is the reason for the e
or given below?
14.
Consider the following data frame. What command would you use to find the total missing
values in each column?
15.
According to the following code, what will be the result of y?
A Because is.infinite() function accepts only vectorial input.
B Because there is no infinite value in the data frame
C Because data frame has missing values
D Because there is a division by zero problem in the data frame
A sum(is.na(df))
B is.na(df)
C is.nan(df)
D colSums(is.na(df))
A 4 6
B TRUE
C FALSE FALSE FALSE TRUE FALSE TRUE
D NA
E94793
Highlight
E94793
Highlight
E94793
Highlight
16. Refer to the demo slides for the relational database scenario on sales and employees data
sets. According to the given information, how would you find the names of sales people
(employees) who made a sale while dropping all the information in the sales data set?
17. Refer to the demo slides for the relational database scenario on sales and employees data
sets. According to the given information, how would you find the names of sales people who
didn't make a sale?
18. Consider the id_lookup and ratings data sets, what would
e the result of: ratings %�% left_join(id_lookup) o
left_join(ratings, id_lookup )
19. Consider the id_lookup and ratings data sets, what would
e the result of: id_lookup %�% anti_ join(ratings) o
anti_ join(id_lookup, ratings)
A anti_ join(employees, sales)
B semi_join(employees, sales)
C union(employees, sales)
D bind_cols(employees,sales)
A anti_ join(employees, sales)
B semi_join(employees, sales)
C union(employees, sales)
D bind_cols(employees,sales)
A Picture 1
B Picture 2
C Picture 3
D Picture 4
A Picture 1
B Picture 2
C Picture 3
D Picture 4
E94793
Highlight
E94793
Highlight
E94793
Highlight
E94793
Highlight
20.
Consider the following data frame. What command would you use to calculate the mean of
`Sepal.Length` grouped by `Species`?
21.
Which one of the following will order this data frame in an ascending order using col2 , col3
and col1 , respectively?
22.
The header of the flights data frame is given in the following output. Which one of the following
selects all flights in 2013?
A iris %�% group_by(Sepal.Length)
B iris %�% summarise(mean(Sepal.Length))
C iris %�% group_by(Species) %�% summarise(mean(Sepal.Length))
D iris %�% group_by(mean(Sepal.Length))
A df %�% select(col1, col2, col3�
B df %�% filter(col1, col2, col3�
C df %�% a
ange(col1, col2, col3�
D df %�% a
ange(col2, col3, col1�
A flights %�% select(day == 1�
B flights %�% filter(year == 2013�
C flights %�% filter(month == 1�
D flights %�% select(year == 2013�
E94793
Highlight
E94793
Highlight
E94793
Highlight
23.
According to the following code, what will be the class of df?
24.
What is the class of y?
25.
According to the following code, what will be the ordering of the levels for y?
A list
B vecto
C matrix
D data.frame
A numeric
B characte
C facto
D logical
A moderate < high < severe < low
B low < severe < high < moderate
C low < moderate < high < severe
D severe < high < moderate < low
E94793
Highlight
E94793
Highlight
E94793
Highlight