Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a string with single quotes.
Ruby
greeting = [1]Hello[1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes when single quotes are asked.
Using backticks which are for command execution.
✗ Incorrect
In Ruby, single quotes create a string literal without interpolation.
2fill in blank
mediumComplete the code to create a string with double quotes.
Ruby
name = [1]Alice[1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes when double quotes are needed.
Using backticks which execute commands.
✗ Incorrect
Double quotes allow string interpolation and escape sequences in Ruby.
3fill in blank
hardFix the error in the string creation with quotes.
Ruby
sentence = [1]It's a sunny day[1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes causes syntax error with apostrophes inside.
Using backticks which are for command execution.
✗ Incorrect
Using double quotes allows the apostrophe inside the string without error.
4fill in blank
hardFill both blanks to create a string with double quotes and interpolation.
Ruby
age = 25 message = [1]I am #{age} years old.[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes disables interpolation.
Using different quotes at start and end causes syntax error.
✗ Incorrect
Double quotes allow string interpolation with #{...} in Ruby.
5fill in blank
hardFill all three blanks to create a string with single quotes and escape the apostrophe.
Ruby
quote = [1]It\[2]s a beautiful day[3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not escaping the apostrophe causes syntax error.
Using double quotes but escaping apostrophe unnecessarily.
✗ Incorrect
Single quotes need the apostrophe escaped with a backslash inside the string.