Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

Ruby Interview Questions

A list of frequently asked Ruby or Ruby On Rails interview questions and answers are given below.

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

3) What is Rails or Ruby on Rails?

Rails or Ruby on Rails is an open source web application framework written in Ruby programming language. It is used with an agile development methodology that is used by web developers for rapid development.

4) What is the use of super function in Ruby on Rails?

The super function in Ruby is used to invoke the original method. It calls the super class implementation of the current method.

5) Explain about Garbage collection feature of Ruby?

Garbage collection is a process of reclaiming the memory space. Ruby deletes unallocated and unused objects automatically. This feature can be controlled by applying proper syntax and program through ruby.

Ruby performs garbage collection automatically. Ruby is an object oriented language and every object oriented language tends to allocate many objects during execution of the program.

6) What are the different environment variables present in the Ruby?

Following are the different environment variables present in the Ruby:


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) What is the use of interpolation in Ruby?

Interpolation is a process of inserting a string into a literal. It is a very important process in Ruby. A string can be interpolated into a literal by placing a hash (#) within {} open and close brackets.

9) What is the use of global variable $ in Ruby?

The global variable is declared in Ruby that you can access it anywhere within the application because it has full scope in the application. The global variables are used in Ruby with $ prepend.

10) What is the difference between nil and false in Ruby?

nil false
nil cannot be a value. false can be a value.
nil is returned where there is no predicate. in case of a predicate, true or false is returned by a method.
nil is not a boolean data type. false is a boolean data type.
nil is an object of nilclass. false is an object of falseclass.

11) What is the use of load and require in Ruby?

In Ruby, load and require both are used for loading the available code into the current code. In cases where loading the code required every time when changed or every times someone hits the URL, it is suggested to use ‘load’.

It case of autoload, it is suggested to use ‘require’.

12) 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.