Logo F2FInterview

Ruby Rails Interview Questions

Q   |   QA
‹‹ previous1234567891011

There are lot of advantages of using ruby on rails

  • DRY Principal
  • Convention over Configuration
  • Gems and Plugins
  • Scaffolding
  • Pure OOP Concept
  • Rest Support
  • Rack support
  • Action Mailer
  • Rpc support
  • Rexml Support
  • etc..

Ruby is the brain child of a Japanese programmer Matz. He created Ruby. It is a cross platform object oriented language. It helps you in knowing what your code does in your application. With legacy code it gives you the power of administration and organization tasks. Being open source, it did go into great lengths of development.

Classes, variables, methods, constants and modules can be referred by ruby names. When you want to distinguish between various names you can specify that by the first character of the name. Some of the names are used as reserve words which should not be used for any other purpose. A name can be lowercase letter, upper case letter, number, or an underscore, make sure that you follow the name by name characters.

Symbol are same like string but both behaviors is different based on object_id, memory and process time (cpu time) Strings are mutable , Symbols are immutable.

Mutable objects can be changed after assignment while immutable objects can only be overwritten. For example

p "string object jak".object_id #=> 22956070

p "string object jak".object_id #=> 22956030

p "string object jak".object_id #=> 22956090

 

p :symbol_object_jak.object_id #=> 247378

p :symbol_object_jak.object_id #=> 247378

p :symbol_object_jak.object_id #=> 247378

 

p " string object jak ".to_sym.object_id #=> 247518

p " string object jak ".to_sym.object_id #=> 247518

p " string object jak ".to_sym.object_id #=> 247518

 

p :symbol_object_jak.to_s.object_id #=> 22704460

p :symbol_object_jak.to_s.object_id #=> 22687010

p :symbol_object_jak.to_s.object_id #=> 21141310

 

And also it will differ by process time

For example:

Testing two symbol values for equality (or non-equality) is faster than testing two string values for equality,

Note : Each unique string value has an associated symbol

Session: are used to store user information on the server side.
cookies: are used to store information on the browser side or we can say client side
Session : say session[:user] = “arunkumar” it remains when the browser is not closed

‹‹ previous1234567891011

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: