Saturday, November 15, 2014

Ruby Interview Questions

http://thereq.com/q/best-ruby-software-interview-questions/easy

Array manipulation

Suppose you have the following array.

stuff = [:dog,:cat,:orange,:banana]

  • How can you slice this array to create a new array [:cat,:orange]
  • Add the element :apple on to the end of the array.
  • Now take :apple back off again
  • Add the element :fish to the start of the array.
  • Now remove the element :fish.

No comments:

Post a Comment