Ruby on Rails Interview Questions - Question Set 1

Thursday, September 23, 2010

Ruby on Rails Interview Questions

1. What is the use of load and require in ruby?
Ans. A method that 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 is similar, but rather than performing the inclusion operation once, it reprocesses the code every time load is called.

2. What function converts all HTML special symbols to HTML entities in ruby?
Ans. This function ae_some_html converts all HTML special symbols to HTML entities

3. Where does the start_tabnav gets informations for tabs rendering in ruby rail?
Ans. The :main Symbol let the start_tabnav method know to look for a special MainTabnav class where all the magic happens.

4. What is the use of global variable $ in Ruby?
Ans. If you declare one variable as global we can access any where, as class variable.

5. What is the scope of a local variable in Ruby?
Ans. A new scope for a local variable is introduced in the toplevel, a class (module) definition, a method defintion. In a procedure block a new scope is introduced but you can access to a local variable outside the block. The scope in a block is special because a local variable should be localized in Thread and Proc objects. while, until, and for are control structures and the scope is shared with the outside of these structures. loop is a method and the appended block introduces a new scope.

6. What is the log that has to seen to check for an error in ruby rails?
Ans. Rails will report errors from Apache in log/apache.log and errors from the Ruby code in log/development.log. If you’re having a problem, do have a look at what these logs are saying. On Unix and Mac OS X you may run tail -f log/development.log in a separate terminal to monitor your application’s execution.

7. What is Ruby?
Ruby is a pure object-oriented programming language with a super clean syntax that makes programming elegant and fun. Ruby successfully combines Smalltalk’s conceptual elegance, Python’s ease of use and learning, and Perl’s pragmatism. Ruby originated in Japan in the early 1990s, and has started to become popular worldwide in the past few years as more English language books and documentation have become available.

8. What is Rails?
Rails is an open source Ruby framework for developing database-backed web applications. What’s special about that? There are dozens of frameworks out there and most of them have been around much longer than Rails. Why should you care about yet another framework? What would you think if I told you that you could develop a web application at least ten times faster with Rails than you could with a typical Java framework? You can–without making any sacrifices in the quality of your application! How is this possible? Part of the answer is in the Ruby programming language. Many things that are very simple to do in Ruby are not even possible in most other languages. Rails takes full advantage of this. The rest of the answer is in two of Rail’s guiding principles: less software and convention over configuration. Less software means you write fewer lines of code to implement your application. Keeping your code small means faster development and fewer bugs, which makes your code easier to understand, maintain, and enhance. Very shortly, you will see how Rails cuts your code burden. Convention over configuration means an end to verbose XML configuration files–there aren’t any in Rails! Instead of configuration files, a Rails application uses a few simple programming conventions that allow it to figure out everything through reflection and discovery. Your application code and your running database already contain everything that Rails needs to know!

9. What is the naming conventions for methods that return a boolean result?
Methods that return a boolean result are typically named with a ending question mark. For example: def active? return true #just always returning true end

10. What are the object-oriented programming features supported by Ruby?
Classes,Objects,Inheritance,Singleton methods,polymorphism(accomplished by over riding and overloading) are some oo concepts supported by ruby.

11. What are the operating systems supported by Ruby?
Windows and linux operating systems are supported by the Ruby


Post a Comment

Free Website templateswww.seodesign.usFree Flash TemplatesRiad In FezFree joomla templatesAgence Web MarocMusic Videos OnlineFree Wordpress Themeswww.freethemes4all.comFree Blog TemplatesLast NewsFree CMS TemplatesFree CSS TemplatesSoccer Videos OnlineFree Wordpress ThemesFree CSS Templates Dreamweaver
This post confirms my ownership of the site and that this site adheres to Google AdSense program policies and Terms and Conditions: ca-pub-0558527597907982 nitin jain a 24 c.c colony opp r.p bagh delhi