1 min read

Common Ruby interview questions

To evaluate your skill level and experience in Ruby, there are some questions that are frequently asked. It’s important that you understand the fundamental concepts behind them.

Whether you want to prepare for an interview or looking to improve your knowledge on the language, knowing the answer to the below questions will put you on the right track.

Ruby

  • What are some differences between ruby and other programming languages?
  • What does private do in Ruby?
  • There are many ways to invoke a method in ruby. Can you give me at least two?
  • Explain this ruby idiom: a ||= b
  • What does self mean?
  • What is a Proc?
  • What is the difference between classes and modules?
  • How are include, extend and prepend different?
  • What is a metaclass? What is it for?
  • What is a gem?

Object Oriented Design

  • What is a class? What is an object?
  • What is a module?
  • Can you describe the OO paradigm?
  • How is OO different from other paradigms (structured/functional)?
  • Define the following OO principles (encapsulation, abstraction, inheritance, polymorphism)
  • What is cohesion and coupling?
  • What is duck typing?
  • Can you give an example of a design pattern in action?
  • How do you define composition or inheritance? Give examples what cases do they work best for.
  • How do you organize multiple objects that you want to adhere to a particular behavior in ruby?