Home / Interview / Ruby :: General Questions

Interview :: Ruby

1)

What is Ruby programming language?

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.

2)

Who is the developer of Ruby?

Ruby is designed and developed by Yukihiro "martz" Matsumoto in mid 1990 in Japan

3) Why Ruby is known as a language of flexibility?

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.

4)

List some features of Ruby?

Ruby has many features. Some of them are listed below.

  • Object-oriented
  • Flexible
  • Dynamic typing and Duck typing
  • Garbage collector
  • Keyword arguments

5)

Explain some differences between Ruby and Python?

Similarities:

  • High level language
  • Support multiple platforms
  • Use interactive prompt called irb
  • Server side scripting language

Differences:

  • Ruby is fully object oriented while Python is not.
  • Ruby supports EclipseIDE while Python supports multiple IDEs.
  • Ruby use Mixins while Python doesn't.
  • Ruby supports blocks, procs and lambdas while Python doesn't.

6)

Write the command to get installed Ruby version in your system?

ruby -v

7) What are class libraries in Ruby?

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
8)

Name some operators used in Ruby?

Operators are a symbol which is used to perform different operations.

  • Unary operator
  • Airthmetic operator
  • Bitwise operator
  • Logical operator
  • Ternary operator

9) What is RubyGems in Ruby programming language?

RubyGems provides a standard format for distributing ruby programs and libraries. It works as a package manager for the Ruby programming language.

RubyGems is now a part of the standard library from Ruby version 1.9.

10)

What are Ruby variables?

Ruby variables hold data which can be used later in a program. Each variable act as a memory and shas a different name.

There are four types of variables in Ruby:

  • Local variable
  • Class variable
  • Instance variable
  • Global variable