MGSC 291 Final EXAM COMPLETE 200
Questions and Detailed Answers LATEST
UPDATE THIS YEAR
QUESTION: Suppose we define a vector to be the numbers 20, 20, 5, and 10 and call it vec4 as
follows: vec4<-c(20,20,5,10)
What does the line of code below return in R?
vec4==10
a. 1
b. 4
c. TRUE
d. FALSE FALSE FALSE TRUE - ANSWER-d. FALSE FALSE FALSE TRUE
QUESTION: Suppose we define a vector to be the numbers 20, 20, 5, and 10 and call it vec4 as
follows: vec4<-c(20,20,5,10)
1 ALL THE BEST CHAMP!!
, Page 2 of 53
What does the line of code below return in R?
sum(vec4==10)
a. 1
b. 4
c. TRUE
d. FALSE FALSE FALSE TRUE - ANSWER-a. 1
This counts the number of entries that are equal to 10.
sum() counts up the TRUEs and FALSEs, treating the TRUEs as 1 and the FALSEs as 0.
QUESTION: A unique number is assigned to each transaction in a database. We would say that
this transaction number is a/an..
a. categorical variable
b. quantitative variable
1 ALL THE BEST CHAMP!!
, Page 3 of 53
c. identifier variable - ANSWER-c. identifier variable
An identifier variable is a special type of categorical variable that is not to be analyzed - it's
simply an identifier.
QUESTION: what does the following line of R code do?
data <- read.csv("myData.csv",strings=T)
a. calls in a dataset and stores it as myData
b. calls in a dataset and stores it as myData.csv
c. calls in a dataset and stores it as data
d. calls in a dataset and stores it as data.csv - ANSWER-c. calls in a dataset and stores it as data
QUESTION: If you get a + instead of the command prompt, <, after hitting Enter/Return in R,
this means...
1 ALL THE BEST CHAMP!!
, Page 4 of 53
a. you are performing addition
b. you need to hit Enter/Return again
c. you didn't close out a parenthesis, quote, etc - ANSWER-c. you didn't close out a parenthesis,
quote, etc
QUESTION: What does the following code do in R?
mean(dName$shipping [dName$weight=="high"])
a. calculates average shipping for heavy items
b. calculates average weight for high shipping - ANSWER-a. calculates average shipping for
heavy items
QUESTION: The summary() function applied to a categorical variable will return...
a. a count of all the unique values
b. the five number summary and mean
1 ALL THE BEST CHAMP!!