Ruby Interview | Ruby on Rails
483 subscribers
15 photos
3 links
The Ruby Interview channel is a resource for preparing for Ruby developer interviews.

It features questions, problem-solving solutions, and interview tips.

Contact:
@Connor_1992
Download Telegram
What will the following code return?

arr = [1, 2, 3] arr.map { |x| x * 2 }
Anonymous Quiz
4%
[1, 2, 3]
84%
[2, 4, 6]
2%
nil
10%
Runtime error
👎4🤔2
Which method is used to create a new instance of a class in Ruby?
Anonymous Quiz
87%
new
2%
create
11%
initialize
0%
start
What does the following code do?
hash = { a: 1, b: 2, c: 3 }
hash.each_key { |key| puts key }
Anonymous Quiz
3%
Prints only the values of the hash
92%
Prints only the keys of the hash
3%
Prints both keys and values of the hash
2%
Runtime error
Which method reverses a string in Ruby?
Anonymous Quiz
95%
reverse
0%
flip
1%
backward
3%
invert
What will the following code return?
Anonymous Quiz
3%
nil
91%
"Ruby"
2%
Runtime error
Which of the following methods adds an element to the end of an array?
Anonymous Quiz
8%
add
71%
push
4%
insert
17%
append
👎1
Which of the following methods converts a string to a number?
Anonymous Quiz
5%
to_integer
4%
to_num
90%
to_i
1%
parse
Which design pattern is typically used to construct objects with complex creation logic?
Anonymous Quiz
2%
Observer
8%
Singleton
47%
Builder
42%
Factory
What is the name of the architectural style that separates responsibilities into models, views, and controllers?
Anonymous Quiz
1%
REST
11%
MVP (Model-View-Presenter)
1%
MVVM (Model-View-ViewModel)
87%
MVC (Model-View-Controller)
Which SOLID principle is violated if a class is responsible for both data processing logic and data persistence?
Anonymous Quiz
8%
Open/Closed Principle
8%
Interface Segregation Principle
3%
Dependency Inversion Principle
81%
Single Responsibility Principle (SRP)
Which Ruby library is most commonly used for dependency injection?
Anonymous Quiz
7%
Sidekiq
47%
Dry::Container
10%
Faraday
37%
ActiveRecord
🥴5💩3👍2👏1🤣1
Which of the following commands is used to create a new migration in Rails?
Anonymous Quiz
84%
rails generate migration
12%
rails db:migrate
4%
rails generate model
0%
rails db:rollback
How do you execute raw SQL queries in ActiveRecord?
Anonymous Quiz
69%
execute
9%
raw_query
19%
find_by_sql
3%
query
🔥4👎1