Ruby is a simple and powerful programming language designed to make coding easy and fun. It is often used for web development and scripting.
Click to reveal answer
beginner
Who created Ruby and when?
Ruby was created by Yukihiro Matsumoto in the mid-1990s to combine parts of his favorite programming languages into a new, easy-to-use language.
Click to reveal answer
beginner
What are some key features of Ruby?
Ruby is known for its simple syntax, object-oriented design, and flexibility. It allows programmers to write clean and readable code.
Click to reveal answer
beginner
Why do many developers like Ruby?
Developers like Ruby because it feels natural to write, helps them build programs quickly, and has a friendly community.
Click to reveal answer
beginner
What is Ruby commonly used for?
Ruby is commonly used for building websites, especially with the Ruby on Rails framework, as well as for automation and scripting tasks.
Click to reveal answer
Who created Ruby?
AGuido van Rossum
BYukihiro Matsumoto
CJames Gosling
DBrendan Eich
✗ Incorrect
Ruby was created by Yukihiro Matsumoto in the mid-1990s.
What is Ruby mainly known for?
AMobile app development
BLow-level hardware control
CDatabase management
DSimple and readable syntax
✗ Incorrect
Ruby is famous for its simple and readable syntax that makes coding easier.
Which framework is Ruby famous for in web development?
AAngular
BDjango
CRuby on Rails
DReact
✗ Incorrect
Ruby on Rails is a popular web development framework built with Ruby.
Ruby is an example of which type of programming language?
AObject-oriented
BAssembly
CProcedural only
DFunctional only
✗ Incorrect
Ruby is an object-oriented programming language, meaning it organizes code around objects.
Why do many developers enjoy using Ruby?
ABecause it is easy to write and read
BBecause it requires complex setup
CBecause it is only for experts
DBecause it is slow
✗ Incorrect
Developers enjoy Ruby because it is easy to write and read, making programming more enjoyable.
Explain what Ruby is and why it was created.
Think about who made it and what they wanted.
You got /3 concepts.
Describe some common uses of Ruby in programming.
Where do you see Ruby used most often?
You got /4 concepts.
Practice
(1/5)
1. What is Ruby primarily known as?
easy
A. A type of database
B. A programming language
C. A web browser
D. An operating system
Solution
Step 1: Understand Ruby's category
Ruby is a tool used to write instructions for computers, which means it is a programming language.
Step 2: Eliminate other options
It is not a database, browser, or operating system, so those options are incorrect.
Final Answer:
A programming language -> Option B
Quick Check:
Ruby = programming language [OK]
Hint: Ruby is a language to tell computers what to do [OK]
Common Mistakes:
Confusing Ruby with a database
Thinking Ruby is software like a browser
Mixing Ruby with operating systems
2. Which of the following is the correct way to print "Hello" in Ruby?
easy
A. print("Hello")
B. echo "Hello";
C. console.log("Hello")
D. printf("Hello")
Solution
Step 1: Identify Ruby's print syntax
Ruby uses the method print() to show text on the screen.
Step 2: Check other options for language mismatch
echo is from PHP, console.log is JavaScript, printf is C-style but less common in Ruby for simple output.
Final Answer:
print("Hello") -> Option A
Quick Check:
Ruby print syntax = print("Hello") [OK]
Hint: Ruby uses print() to show text [OK]
Common Mistakes:
Using echo instead of print
Using console.log from JavaScript
Confusing printf with print
3. What will the following Ruby code output?
puts "Ruby" + " is fun"
medium
A. Ruby is fun
B. Ruby+ is fun
C. nuf si ybuR
D. Error
Solution
Step 1: Understand string concatenation in Ruby
The + operator joins two strings together without extra characters.
Step 2: Understand puts output
puts prints the string and adds a new line automatically, but the output shown is the text without showing the newline character.
Final Answer:
Ruby is fun -> Option A
Quick Check:
"Ruby" + " is fun" = "Ruby is fun" [OK]
Hint: Plus (+) joins strings in Ruby [OK]
Common Mistakes:
Thinking + adds a plus sign
Confusing puts with print
Expecting an error from string addition
4. Find the error in this Ruby code:
puts "Hello World
medium
A. No error, code is correct
B. Missing parentheses after puts
C. puts should be capitalized
D. Missing closing double quote
Solution
Step 1: Check string syntax
The string starts with a double quote but does not have a closing double quote.
Step 2: Verify other syntax parts
Parentheses are optional in Ruby for puts, and puts is lowercase by convention, so no error there.
Final Answer:
Missing closing double quote -> Option D
Quick Check:
Unclosed string causes syntax error [OK]
Hint: Always close your quotes in strings [OK]
Common Mistakes:
Forgetting to close quotes
Thinking parentheses are mandatory
Capitalizing puts incorrectly
5. You want to create a simple Ruby program that prints each word from an array on a new line. Which code correctly does this?
hard
A. words = ("Ruby", "is", "fun")
for word in words puts word end
B. words = ["Ruby", "is", "fun"]
print words.join("\n")
C. words = ["Ruby", "is", "fun"]
words.each { |word| puts word }
D. words = {"Ruby", "is", "fun"}
words.each do |word|
print word
end
Solution
Step 1: Identify correct array syntax
words = ["Ruby", "is", "fun"]
words.each { |word| puts word } uses square brackets [] to create an array, which is correct in Ruby.
Step 2: Check iteration and printing method
words = ["Ruby", "is", "fun"]
words.each { |word| puts word } uses each with a block and puts to print each word on a new line, which is the correct approach.
Final Answer:
words = ["Ruby", "is", "fun"]\nwords.each { |word| puts word } -> Option C
Quick Check:
Array + each + puts = print words line by line [OK]
Hint: Use array.each with puts to print each item [OK]
Common Mistakes:
Using parentheses instead of brackets for arrays
Using print instead of puts for new lines
Using curly braces for arrays
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.