Challenge - 5 Problems
Numeric Type Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of numeric division and type check
What is the output of this R code snippet?
R Programming
x <- 5 / 2 typeof(x)
Attempts:
2 left
💡 Hint
In R, division usually results in a floating-point number.
✗ Incorrect
In R, the division operator '/' returns a double precision number, so typeof(x) returns "double".
❓ Predict Output
intermediate2:00remaining
Output of integer coercion with as.integer()
What is the output of this R code?
R Programming
y <- as.integer(3.7) y
Attempts:
2 left
💡 Hint
as.integer() truncates the decimal part.
✗ Incorrect
The as.integer() function truncates the decimal part and returns the integer portion, so 3.7 becomes 3.
🔧 Debug
advanced2:00remaining
Type coercion in numeric vector creation
What is the output of this R code?
R Programming
z <- c(1, 2, "3", 4) typeof(z)
Attempts:
2 left
💡 Hint
Mixing numbers and strings in a vector causes coercion.
✗ Incorrect
When combining numbers and strings in a vector, R coerces all elements to character type, so typeof(z) returns "character".
❓ Predict Output
advanced2:00remaining
Result of numeric overflow in R
What is the output of this R code?
R Programming
big_num <- 1e308 * 10 big_num
Attempts:
2 left
💡 Hint
Multiplying very large numbers can exceed the maximum representable value.
✗ Incorrect
Multiplying 1e308 by 10 exceeds the largest double precision number, resulting in Inf (infinity).
🧠 Conceptual
expert2:00remaining
Understanding numeric precision in R
Which statement best describes numeric precision in R for double type numbers?
Attempts:
2 left
💡 Hint
Think about how computers store floating-point numbers.
✗ Incorrect
Double precision floating-point numbers in R follow IEEE 754 standard and have about 15-16 digits of decimal precision, but cannot represent all decimals exactly.