Ruby interview question and answer

在网上找到一些关于Ruby On Rails面试会经常被提问到的一些相关基础知识。或许可以试着回答下,看看自己对这些问题的看法。对每个问题如有自己的见解,欢迎留言探讨。

  1. What is a class?

  2. What is the difference between a class and a module?

  3. What is an object?

  4. How would you declare and use a constructor in Ruby?

  5. How would you create getter and setter methods in Ruby?

  6. Describe the difference between class and instance variables?

  7. What are the three levels of method access control for classes and what do they signify?

  8. What does ‘self’ mean?

  9. Explain how (almost) everything is an object in Ruby.

  10. Explain what singleton methods are. What is Eigenclass in Ruby?

  11. Describe Ruby method lookup path.

  12. Describe available Ruby callbacks. How can we use them in practice?

  13. What is the difference between Ruby’s Hash and ActiveSupport’s HashWithIndifferentAccess?

  14. What is the difference between Proc and lambda?

  15. The Second Series of Ruby Questions: Business Applications

  16. Knowing the basics isn't enough to work for RubyGarage or for any other serious web development company. A programmer should also be able to explain how to write code for business applications. Since Rack is a very popular interface that makes it possible to develop an application in Ruby, we ask specific questions about it. Here are four possible questions and challenges:

  17. What is Rack?

  18. Explain the Rack application interface.

  19. Write a simple Rack application.

  20. How does Rack middleware works?

  21. What is ActiveJob? When should we use it?

  22. What is Asset Pipeline?

  23. Explain the difference between Page, Action, Fragment, Low-Level, SQL caching types.

  24. What is a Rails engine?

  25. Provide an example of RESTful routing and controller.

  26. Describe CRUD verbs and actions.

  27. How should you test routes?

  28. How should you use filters in controllers?

  29. What are Strong Parameters?

  30. What do we need to test in controllers?

  31. How should you use content_for and yield?

  32. How should you use nested layouts?

  33. Explain the Active Record pattern.

  34. What is Object-Relational Mapping?

  35. Describe Active Record conventions.

  36. Explain the Migrations mechanism.

  37. Describe types of associations in Active Record.

  38. What is Scopes? How should you use it?

  39. Explain the difference between optimistic and pessimistic locking.

  40. Explain what is a sessions mechanism. How does it work?

  41. Describe cross-site request forgery, cross-site scripting, session hijacking, and session fixation attacks.

  42. What is the difference between SQL Injection and CSS Injection?

  43. How should you store secure data such as a password?

  44. Why do we need to use HTTPS instead of HTTP?

  45. What is unit testing (in classical terms)?

  46. What is the primary technique for writing a test?

  47. What are your favorite tools for writing unit tests?

  48. What are your favorite tools for writing feature tests?

  49. What is a code smell?

  50. What are your favorite tools to find code smells and potential bugs?

  51. Why should you avoid fat controllers?

  52. Why should you avoid fat models?

  53. Explain ext

  54. What is a code smell?

  55. What are your favorite tools to find code smells and potential bugs?

  56. Why should you avoid fat controllers?

  57. Why should you avoid fat models?

  58. Explain extract Value, Service, Form, View, Query, and Policy Objects techniques

你可能感兴趣的:(Ruby interview question and answer)