Challenge - 5 Problems
Paste Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of paste with default separator
What is the output of this R code snippet?
R Programming
result <- paste("apple", "banana", "cherry") print(result)
Attempts:
2 left
💡 Hint
Remember that paste uses a space as the default separator.
✗ Incorrect
The paste function joins strings with a space by default, so the output is a single string with spaces between words.
❓ Predict Output
intermediate2:00remaining
Output of paste0 with multiple strings
What does this R code print?
R Programming
result <- paste0("red", "green", "blue") print(result)
Attempts:
2 left
💡 Hint
paste0 joins strings without any separator.
✗ Incorrect
paste0 concatenates strings directly without spaces or other separators.
🧠 Conceptual
advanced2:00remaining
Difference between paste and paste0
Which statement correctly describes the difference between paste() and paste0() in R?
Attempts:
2 left
💡 Hint
Think about the default separator each function uses.
✗ Incorrect
paste() uses a space as the default separator, while paste0() uses no separator.
❓ Predict Output
advanced2:00remaining
Output of paste with custom separator
What is the output of this R code?
R Programming
result <- paste("cat", "dog", "mouse", sep = "-") print(result)
Attempts:
2 left
💡 Hint
Look at the sep argument value.
✗ Incorrect
The sep argument sets the separator between strings; here it is a dash.
❓ Predict Output
expert2:00remaining
Output of paste with recycling and paste0
What is the output of this R code?
R Programming
x <- c("a", "b") y <- c(1, 2, 3) result <- paste0(x, y) print(result)
Attempts:
2 left
💡 Hint
Remember how R recycles shorter vectors to match longer ones.
✗ Incorrect
R recycles the shorter vector x to match length of y, so x becomes c("a", "b", "a"). paste0 joins element-wise.