Ruby on rails Interview Questions | Glassdoor

Ruby on rails Interview Questions


ruby on rails interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Describe a routine which returns the set of integers in {1..100} divisible without remainder by 3 but not by 9.

12 Answers

I'm assuming the question wants us to find integers that are divisible by 3 but not by 9. This can be easily obtained using a mod function inside the following if statement: if(number % 3 == 0 && number % 9 != 0) Here is a short program I wrote in c++ to show how to solve this problem. Instead of returning the set of integer, I just printed them out on the screen: #include #include using namespace std; int main(int argc, char** argv) { int i = 0; vector list; vector::iterator it; for(i = 1; i <= 100; i++) { if(i%3 == 0 && i%9 != 0) { list.push_back(i); } } for(it = list.begin(); it != list.end(); it++) { cout << *it << endl; } return 0; } If I missed anything, please let me know. Happy coding and problem solving!

That'll certainly work, Tyler, but the OP indicated he was interviewing for a Ruby On Rails - not C++ - gig.

put those integers into an array, pick every third element, out of which discard every third element.

This was a pair programming session with a Ruby engineer. They allow you to use your own laptop which was great but you only get 30 minutes to finish the problem with working unit tests. I think they re-use this pair programming problem so I'm not going to divulge details here. But it wasn't a particularly hard problem, they just want you to see how you code and test. Do not forget to write unit tests! Ideally you would develop it in a TDD fashion.

2 Answers

How would you optimize Ruby for performance?

1 Answer

If we have 8 same little balls, but one of them is less weight. How may times do we need to weigh them to define which ball is less weight?

2 Answers

One or more comments have been removed.
Please see our Community Guidelines or Terms of Service for more information.

Am I equally comfortable with the front-end of the Rails stack as I am with the backend?

1 Answer

How did you become a Ruby on Rails Developer?

1 Answer

HR Interview

1 Answer

What do you like to do at your spare time with regards to software?

1 Answer

How do you track CPU usage on a linux machine?

1 Answer
110 of 66 Interview Questions