Friday, 1 June 2012

What is Rails? | Ruby

► Ruby on Rails is an open source web application framework for the Ruby programming language.
► It is used with an Agile development methodology that is used by web developers for rapid development.

Describe class libraries in Ruby. | Ruby

► The Ruby standard library extends the foundation of the Ruby built-in library with classes and abstractions for a variety of programming needs, including network programming, operating system services, threads, and more.
► These classes provide flexible capabilities at a high level of abstraction, giving you the ability to create powerful Ruby scripts useful in a variety of problem domains.

Explain the concepts and capabilities of garbage collection feature of Ruby. | Ruby

► Ruby is an object oriented language and every object oriented language tends to allocate many objects during execution of the program.
► Ruby deletes unallocated and unused objects automatically.
► This feature can be controlled by applying proper syntax and program through ruby.

Describe the environment variables present in Ruby. | Ruby

RUBYOPT
Additional command-line options to Ruby; examined after real command-line options are parsed ($SAFE must be 0).
RUBYLIB
Additional search path for Ruby programs ($SAFE must be 0).
RUBYPATH
With -S option, search path for Ruby programs (defaults to PATH).
RUBYSHELL
Shell to use when spawning a process; if not set, will also check SHELL or COMSPEC. DLN_LIBRARY_PATH Search path for dynamically loaded modules.
RUBYLIB_PREFIX
(Windows only) Mangle the RUBYLIB search path by adding this prefix to each component.

Interpolation is a very important process in Ruby, comment. | Ruby

► Interpolation is the process of inserting a string into a literal.
► You can interpolate a string into a literal by placing a Hash (#) within {} open and close brackets.
► This refers to a new name to by referring to the copy of the original method.

What is the use of super in Ruby Rails? | Ruby

► Ruby uses the super keyword to call the superclass implementation of the current method.
► Within the body of a method, calls to super acts just like a call to that original method.
► The search for a method body starts in the superclass of the object that was found to contain the original method.
def url=(addr)
super (addr.blank? || addr.starts_with?('http')) ? addr : http://#{addr}
end

What is the use of load and require in ruby? | Ruby

Reuire() loads and processes the Ruby code from a separate file, including whatever classes, modules, methods, and constants are in that file into the current scope.
Load() performs the inclusion operation once, it reprocesses the code every time load is called.

Explain the use of global variable $ in Ruby? | Ruby

If you declare one variable as global we can access any where, where as class variable visibility only in the class

Explain the difference between nil and false in ruby?

False is a boolean data type
Nil is not a data type .

Ruby on Rails interview questions and answers for freshers free download

1 . Explain the difference between nil and false in ruby?
2 . Explain the use of global variable $ in Ruby?
3 . What is the use of load and require in ruby?
4 . What is the use of super in Ruby Rails?
5 . Interpolation is a very important process in Ruby, comment.
6 . Describe the environment variables present in Ruby.
7 . Explain the concepts and capabilities of garbage collection feature of Ruby.
8 . Describe class libraries in Ruby.
9 . What is Rails?
10 . Explain about the programming language ruby?
11 . Explain about class libraries in ruby?
12 . Explain about portability?
13 . Explain about garbage collection feature of ruby?
14 . Explain about the command line options?
15 . Explain about environment variables present in ruby?
16 . Explain about operators in Ruby?
17 . Explain about the defined operator?
18 . Explain about methods?
19 . Explain about normal method class?
20 . Explain about ruby names?
21 . Explain about variables?
22 . Explain about Class variable and global variable?
23 . How does ruby deal with extremely large numbers?
24 . Explain about Float, Dig and Max?
25 . Explain about interpolation?
26 . Explain about ruby code blocks?