1. Which function returns [1] TRUE FALSE TRUE? indat <- c("Ash Rd","Ash Cir","Ash St")
2. A list named a is created using the statement below. Which choice returns TRUE? a <- list("10", TRUE, 5.6)
3. X is a vector of type integer, as shown on line 1 below. What is the type of the result returned by the statement > median(x)? x <- c(12L, 6L, 10L, 8L, 15L, 14L, 19L, 18L, 23L, 59L)
4. How do you extract the values above the main diagonal from a square matrix named Rmat?
5. What is the legitimate name of a data class in R?
6. A variable whose type is numeric can contain which items?
7. What does the function power.anova.test return?
8. How are these data types alike: logical, integer, numeric, and character?
9. Which statement enables you to interactively open a single file?
10. StDf is a data frame. Based on this knowledge, what does this statement return? StDf[, -1]
11. Which strings could be returned by the function ls(path = "^V")?
12. A list can contain a list as an element. MyList has five columns, and the third column's item is a list of three items. How do you put all seven values in MyList into a single vector?
13. If mdf is a data frame, which statement is true ?
14. Which file contains settings that R uses for all users of a given installation of R?
15. How do you return "October" from x in this code? x<-as.Date("2018-10-01")
16. Ournames is a character vector. What values does the statement below return to Cpeople? Cpeople <- ournames %in% grep("^C", ournames, value=TRUE)
17. How to name rows and columns in DataFrames and Matrices F in R?
18. Two variable in the mydata data frame are named Var1 and Var2. How do you tell a bivariate function, such as cor.test, which two variables you want to analyze?
19. What is the value of y in this code? x <- NA; y <- x/1
20. What function joins two or more column vectors to form a data frame?
21. What statement shows the objects on your workspace?
22. How does a vector differ from a list?
23. What is mydf$y in this code? mydf <- data.frame(x=1:3, y=c("a","b","c"), stringAsFactors=FALSE)
24. You accidentally display a large data frame on the R console, losing all the statements you entered during the current session. What is the best way to get the prior 25 statements back?
25. Which function displays the first five rows of the data frame named pizza?
26. Which is not a property of lists and vectors?
27. What is the principal difference between an array and a matrix?
28. Which choice does R regard as an acceptable name for a variable?
29. The variable height is a numeric vector in the code below. Which statement returns the value 35?
30. What do you use to take an object such as a data frame out of the workspace?
31. What value does this statement return? unclass(as.Date("1971-01-01"))
32. How does a matrix differ from a data frame?
33. What is the result of command: z <- c(1:3,NA); ind <- is.na(z); z ?
34. Which is INCORRECT regarding the command: T <- 40; rnorm( T, 1, 4) ?
35. To test the residuals of model X for autocorrelation of first order, you can use this command:
36. Which is the INCORRECT way to get the vector [1 1 1 3 3 3 5 5 5]?
37. To test the residuals of a regression model X for heteroscedastisity, you can use this command:
38. Which of the following statements regarding mixed vector and array arithmetic is true?
39. Which of the following is NOT one of R's basic vector types?
40. Which one is the correct expression regarding outer product of two arrays?
41. Which R code subsets a matrix Y to only those records (rows) where a variable x (in Y) is less than 100?
42. What R function can be used to tabulate values of categorical variable Y (columns) by categorical variable X (rows), including missing values?
43. All of the following will directly display the help file for the plot() function except:
44. Given this named vector "X": > X <- c( 5, 10, 1, 20 ); > names( X ) <- c( "a", "b", "c", "d" ); Which operation is valid to show the 2nd and 4th components of X?
45. Given the command: Z <- array(h, dim=c(3,4,2)), Z[1:24] stands for:
46. Which will test the hypothesis that two independent Normally distributed random variables A and B have different means?
47. Which R function outputs the day of the month from X <- "2014-May-15"?
48. R operates on named data structures. The simplest such structure is the numeric vector, which is a single entity consisting of an ordered collection of numbers. To set up a vector named x, consisting of 10.4, 5.6, 3.1, 6.4 and 21.7, which is the INCORRECT command:
49. The command > Z <- array(h, dim=c(3,4,2)) would use h to set up 3 by 4 by 2 array in Z. However if h is shorter than 24, its values___________________.
50. If Y is a multi-modal vector of integers, which R function would return all modes of Y (the most frequent value(s) of Y)?
51. What is the output of: rrr <- 5.45667; sprintf("%1.f", round(rrr, 3))
52. What values are displayed for the x-axis limits of the following plot? plot(c(0, 2), c(0, 1), xaxt="n", yaxt="n"); axis(side=2, labels=c("0", "10"), at=c(0,1))
53. Arrays are similar to matrices in R, but are different in what respect?
54. Let X be a n-dimension vector. Which call tests this particular statement: "no value of X is NA"
55. What is the output of the following calculation? t(c(1, 1)) %*% c(1, 1)
56. Suppose we have defined a list object, "X", which has 3 components. Each component is a vector with at least 5 elements. Which command will extract the fourth (4th) element from the third (3rd) component of our list?
57. matrix(1:4, ncol = 2)[1,]
58. Which is the fastest way to calculate groupwise means of a variable "x" for each level of a factor called "factor", given you have installed base R, data.table, and plyr?
59. The command > t( matrix( 3:2, nrow=2 ) ) will generate:
60. Which operator performs modular conversion?
61. What is the result of command: labs <- paste(c("X","Y"), 1:10, sep="")?
62. Which statement best characterizes the object generated with array( 1:30, dim = c(2,3,5) )
63. Which R function will generate an integer X from Y <- "9.145", where Y is stored as a text string?
64. What's the output of the command : x <- c(T, T, NA); all(x, na.rm = TRUE)
65. Which R function fits a simple linear regression model of x predicting y without an intercept?
66. What is the output of matrix(1:10, nrow=2)[2,2]?
67. Which class avoids making copies of objects?
68. Given x <- c(1:3,NA), the command: (x+1)[(!is.na(x)) & x>0] -> z generates:
69. Which is an invalid way to return the mean of each variable in a numeric data frame?
70. Which is NOT the parameter of command seq()?
71. What is the output of the command: paste("O", "M", "G")
72. The function "rescale()" exists in both the plotrix and psych packages. How can I ensure that the plotrix version is used to scale my vector "X" to between 1 and 2?
73. What is the output for the command: > rep( c(1:2), each = 3)
74. Given the command: Z <- array(h, dim=c(3,4,2)), Z[] with an empty subscript or Z with no subscript stands for:
75. What is the value of Y? Y <- 10 + 100 & !is.na(0)
76. Which R function can be used to produce a simple scatterplot of a numeric vector Y versus a numeric vector X?
77. What does the following R function output? xxx <- c(1, 1, 2, 2, 3, 3, NA, NA); yyy <- c(rep(0, 4), rep(1, 4)); cor(yyy, xxx)
78. What is the output for the command: > is.na( NaN ) ?
79. Suppose X is the vector c(1:10). Which R code will swap the values of the 3rd element of X and the 7th element of X?
80. Let X be a 3x4 matrix with non-zero values. The result of: > apply(X, 2, mean), is:
81. Which is NOT a valid R function for obtaining the residuals from a simple linear regression model of X predicting Y?
82. I want to use the sort() function, and I see in the help file that I my sort "an R object with a class, or a numeric, complex, character, or logical vector." Given this guidance, which is a valid call to sort()?
83. Which object class can contain multiple unrelated object classes of potentially different sizes?
84. Which R command is used to merge two data sets X and Y by the variable "ID" that includes all records from both data sets?
85. Suppose numeric vectors X, Y, and Z are all of the same length. Which R command will create a matrix with rows X, Y, Z?
86. Which R function will generate a mean for each row in a numeric matrix X with intermittent missing values?
87. In order to assess whether x and y are equal, you can use the command:
88. Which of the following is NOT included in CRAN's R distribution?
89. In a linear regression model with outcome y and linear predictors x1, x2, and x3, which R code correctly includes an interaction term between x1 and x2?
90. What is the output of dim(matrix(1:10, ncol=2))?
91. What is the output of the following R function? yyy <- c(1, 3, NA); fff <- function(xxx) {mean(xxx)}; fff(yyy)
92. What does the following R code output? Y <- c(1,2,3); X <- rep(c(1,length(Y)), times=2); X
93. What is the output for the command: is.na(0/0)?
94. What R function can be used to tabulate values of categorical variable Y (columns) by categorical variable X (rows)?
95. Which function is used to load a CSV file into R?
96. What is the value of Y? X <- c(1,2,2,2,3,3,4,4,5,6); Y <- unique(X[which(X<4)])
97. Suppose we define X <- NA. What is the output for > is.nan( X ); is.na( X )
98. What is the output of this command: > is.na( c( 1:3, NA ) )
99. Which R function adds a line with slope 1 and intercept 0 into an existing plot of Y versus X?
100. What's the output for command: seq(from = 1, to = 5, by = 3)
QuickBooks
People Management
Macroeconomics
Management Accounting
Negotiation Skills
Human Resource Management
Related MCQ's