• +91 9723535972
  • info@interviewmaterial.com

Ruby Interview Questions and Answers

Ruby Interview Questions and Answers

Question - 11 : - What is Ruby Gems in Ruby programming language?

Answer - 11 : -

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

Question - 12 : - What are Ruby variables.

Answer - 12 : -

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

Question - 13 : -
What Are The Different Environment Variables Present In The Ruby?

Answer - 13 : -

Following are the different environment variables present in the Ruby:

  • RUBYOPT
  • RUBYLIB
  • RUBYPATH
  • RUBYSHELL
  • RUBYLIB_PREFIX

Question - 14 : - Explain About Float, Dig And Max?

Answer - 14 : -

  • Float class is used whenever the function changes constantly. It acts as a sub class of numeric. They represent real characters by making use of the native architecture of the double precision floating point.
  • Max is used whenever there is a huge need of Float.
  • Dig is used whenever you want to represent a float in decimal digits.

Question - 15 : - What Is The Use Of Interpolation In Ruby?

Answer - 15 : -

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.

Question - 16 : - What Is The Use Of Global Variable $ In Ruby?

Answer - 16 : -

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.

Question - 17 : - What Is The Use Of Load And Require In Ruby?

Answer - 17 : -

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

Question - 18 : - Explain break statement in Ruby.

Answer - 18 : -

Ruby break statement is used to terminate a loop. It is mostly used in while loop where value is printed till the condition is true.

Question - 19 : - Explain until loop in Ruby.

Answer - 19 : -

Ruby until loop runs until the given condition evaluates to true. It exits the loop when condition becomes true. It is opposite of the while loop.

Question - 20 : - Explain do while loop in Ruby.

Answer - 20 : -

Ruby do while loop iterates a part of program several times. In this, loop will execute at least once because do while condition is written at the end.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners