Software engineer ruby on rails Interview Questions | Glassdoor

# Software engineer ruby on rails Interview Questions

56

software engineer ruby on rails interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

Jan 27, 2012
 Describe a routine which returns the set of integers in {1..100} divisible without remainder by 3 but not by 9.12 AnswersI'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.Show More Responsespython [x for x in range(0,100) if x % 3 == 0 and x % 9 != 0]1) start from number = 3 Loop while(number <= 100) 2) display number 3) number = number+3, display number 4) number = number+6 Loop(1..100).map { |i| (i % 3).zero? && !(i % 9).zero? ? i : nil }.compact(1..100).select { |x| x%3 == 0 && x%9 != 0matt has the best answerA variation on Matt's answer: (1..100).select { |n| n % 3 == 0 }.reject { |n| n % 9 == 0 }The requirement doesn't say if the input has to be a Range. If it doesn't have to be, then we don't need to traverse each element but to simply calculate it. def get_nums_by_3_not_by_9(max) arr = [] x = max.to_i / 3 x.times do |i| next if i % 3 == 0 arr << i * 3 end return arr end(1..100).select do |n| n%3 ==0 and n%9 != 0 end(1..100).to_a.delete_if{|x| !(x%3==0 && x%9>0)} or (1..100).to_a.select{|x| x%3==0 && x%9>0} or (1..100).to_a.map{|x| x%3==0 && x%9>0 ? x : nil}.compact or (1..100).to_a.reject{|x| !(x%3==0 && x%9>0)}

### Software Engineer (Ruby/Rails) at Instacart was asked...

Mar 5, 2015
 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 AnswersI wrote failing unit tests to determine the API first and then kept writing code until the tests succeeded.Do they expect use of rspec, minitest or just simple assert methods for tdd?

### Ruby On Rails Developer at Nav was asked...

Jul 14, 2018
 How would you optimize Ruby for performance?1 AnswerWhat's the greatest challenge you've had working with other people?

### Ruby On Rails Developer at TechStudio was asked...

Jun 20, 2017
 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 Answers6 times One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

Mar 22, 2017

### Ruby On Rails Developer at Calendly was asked...

Apr 11, 2016
 Am I equally comfortable with the front-end of the Rails stack as I am with the backend?1 AnswerYes

### Ruby On Rails Developer at RevZilla was asked...

Jan 19, 2018
 How did you become a Ruby on Rails Developer?1 AnswerI was a WordPress PHP developer at the time and I discovered that with Ruby on Rails you have more control over data flow and the Rails routing engine. (interview did not seem to understand what I meant by data flow). I explained from a data flow perspective that Rails allows for custom routes and custom routes with their own actions, unlike WordPress, which I was working with at the time. (Interviewing began wanting to debate me that you cannot compare one with the other). I answered I was not doing a compare and contrast, but walking him through how I went from PHP WordPress to being a Ruby on Rails developer.

### Ruby On Rails Developer at Bold Penguin was asked...

Oct 14, 2019
 HR Interview1 AnswerGeneral chit chat. Nothing technical.