Questions
ECON3310001.1251 Quiz 1: Introduction to Programming
Single choice
Suppose we write var1 = "It's me, Mario!" and var2 = 34.5. What happens if we run var1 + var2?
Options
A.An error message saying var1 doesn't exist.
B.An error message indicating that the variable types are incompatible.
C.R won't print anything.
D.R will print just the text "It's me, Mario!".
E.R will print "It's me, Mario!34.5".
View Explanation
Verified Answer
Please login to view
Step-by-Step Analysis
Consider what happens in R when you apply the + operator between values of incompatible types.
Option 1: 'An error message saying var1 doesn't exist.' This is false because var1 was defined as a string literal "It's me, Mario!"; there is no missing variable name issue here, so the error about var1 not existing does not apply.
Option 2: 'A......Login to view full explanationLog in for full answers
We've collected over 50,000 authentic exam questions and detailed explanations from around the globe. Log in now and get instant access to the answers!
Similar Questions
What result is returned if you execute the following code? TRUE + (!FALSE) + 1L + 1
typeof(TRUE + 5L) != typeof(TRUE + 5) This will return [Fill in the blank] as an output.
Again, suppose we have a vector name containing names of 50 students. grade is another numeric vector containing final marks of those students. We run the following code: dat <- tibble(name, grade) dat$grade[2] <- as.character(dat$grade[2]) is.numeric(dat$grade) The output should be
Suppose we create the vector below. v <- c(1, "2", "3", 4, 5, "6") Which of the following options will return 5? Note that in R, strings are always surrounded by quotation marks. That is, 5 is a number and "5" is a string. Hint: Remember the coercion in a vector creation.
More Practical Tools for Students Powered by AI Study Helper
Making Your Study Simpler
Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!