Ruby

Amount of flashcards: 20

What is Ruby?

Ruby is a dynamic, object-oriented programming language.

Who created Ruby?

Ruby was created by Yukihiro Matsumoto, also known as Matz.

When was Ruby first released?

Ruby was first released in 1995.

What is the syntax for defining a variable in Ruby?

In Ruby, variables are defined using the syntax, variable_name = value.

What is the difference between single quotes and double quotes in Ruby?

Single quotes ('') preserve the literal value of each character, while double quotes ("") allow for string interpolation.

What is string interpolation in Ruby?

String interpolation is the process of embedding expressions within a string, using the #{expression} syntax.

How do you define a method in Ruby?

In Ruby, methods are defined using the syntax, def method_name(parameters) ... end.

What is the difference between a class method and an instance method in Ruby?

A class method is called on the class itself, while an instance method is called on an instance of the class.

What is a module in Ruby?

A module in Ruby is a way to group related methods, classes, and constants together.

How do you include a module in a class in Ruby?

To include a module in a class, you use the include keyword followed by the module name.

What is the difference between public, private, and protected methods in Ruby?

Public methods can be called by anyone, private methods can only be called within the class, and protected methods can be called within the class and its subclasses.

What is the difference between an array and a hash in Ruby?

An array is an ordered collection of objects, while a hash is an unordered collection of key-value pairs.

Prev

1 out of 2

Next
© 2023 - Present Flashio. All rights reserved.