Discover
Create +
log in
Home
Trending
Quizzes
Stories
Questions
Polls
Pages
Create
Quizzes
Stories
Polls
Questions
Pages
Home
Trending
Sign in
Test your knowledge of Ruby — Scored Quiz — Qfeast
Quizzes
›
Computers
›
Computer Languages
Test your knowledge of Ruby
by
rihanna80
Take this quiz to see how well you know the Ruby programming language.
Published
0 of 12 answered
Stacked
Which of the following is a valid way to define a class in Ruby?
1/12
Choose one
class MyClass()
class MyClass end
def MyClass
module MyClass end
What is the symbol used to denote a line comment in Ruby?
2/12
Choose one
//
/* */
#
--
Which of the following is a valid way to print 'Hello, World!' in Ruby?
3/12
Choose one
log 'Hello, World!'
console.print('Hello, World!')
print('Hello, World!')
puts 'Hello, World!'
What is the result of the expression '3 + 4' in Ruby?
4/12
Choose one
34
7
3 + 4
Syntax Error
Which of the following is a correct way to create a new array in Ruby?
5/12
Choose one
my_array = []
my_array = Array[]
my_array = Array.new()
my_array = array{}
What does the 'nil' value represent in Ruby?
6/12
Choose one
Zero
Nothing or absence of value
True
NaN
Which of the following is not a logical operator in Ruby?
7/12
Choose one
&&
|
!
!=
What is the correct way to check if a variable 'x' is equal to 5 in Ruby?
8/12
Choose one
x =! 5
x != 5
x = 5
x == 5
Which method is used to convert a string to uppercase in Ruby?
9/12
Choose one
lowercase
upcase
uppercase
to_upper
What is the output of the following code? x = [1, 2, 3, 4, 5] puts x[3]
10/12
Choose one
5
Syntax Error
[4]
4
Which method is used to remove the last element from an array in Ruby?
11/12
Choose one
remove_last
remove
delete_last
pop
What is the output of the following code? x = 10 y = x > 5 ? 'Yes' : 'No' puts y
12/12
Choose one
Yes
No
YesNo
Syntax Error
Favorite Quiz
0.0 (0)
Bookmark
RI
rihanna80
FOLLOW
You might also like
Trending Quizzes