Q#1. What is Ruby programming language?
Ans. Ruby is a dynamic, reflective, general purpose, open source programming language that focuses on simplicity and productivity. Ruby has a mixed features of Perl, small talk, Eiffel, Ada and Lisp. Ruby was designed to create a new language which makes a balance with the functionality of Imperative languages.
Q#2. What are different Ruby editors?
Ans. Below are different editors for Linux and Windows:
•You can use Notepad or Edit plus on Windows.
•You can use VIM on Linux
•RubyWin is a Ruby Integrated Development Environment (IDE) for Windows.
•Ruby Development Environment IDE for windows users.
Q#3. Who is the developer of Ruby?
Ans. Ruby is designed and developed by Yukihiro "martz" Matsumoto in mid 1990 in Japan.
Q#4. What are different variables in Ruby
Ans. Ruby has four types of variables:
•Local Variables: Local variables are the variables that are defined in a method. Local variables are not available outside the method.
•Instance Variables: Instance variables are available across methods for any particular instance or object. That means that instance variables change from object to object.
•Class Variables: Class variables are available across different objects. A class variable belongs to the class and is a characteristic of a class.
•Global Variables: Class variables are not available across classes. If you want to have a single variable, which is available across classes, you need to define a global variable.
Q#5. Why Ruby is known as a language of flexibility?
Ans. Ruby is known as a language of flexibility because it facilitates its author to alter the programming elements. Some specific parts of the language can be removed or redefined. Ruby does not restrict the user. For example, to add two numbers, Ruby allows to use + sign or the word 'plus'. This alteration can be done with Ruby's built-in class Numeric.
Q#6. What is the command to get installed Ruby version in your system?
Ans. The command to get installed Ruby version in your system is
Ruby –v
Q#7. List some features of Ruby?
Ans. Ruby has many features. Some of them are listed below.
Object-oriented
Flexible
Dynamic typing and Duck typing
Garbage collector
Keyword arguments
Q#8. What are the different operators used in Ruby?
Ans. The different operators in Ruby are:
•Unary operator
•Arithmetic operator
•Bitwise operator
•Logical operator
•Ternary operator
Q#9. What are class libraries in Ruby?
Ans. Ruby class libraries contain variety of domain such as thread programming, data types, various domains. Following is a list of domains which has relevant class libraries:
Text processing
CGI Programming
Network programming
GUI programming
XML programming
Q#10. What are the different data types used in Ruby?
Ans. The different data types used in Ruby are:
•Numbers
•Strings
•Symbols
•Hashes
•Arrays
•Booleans