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 }
hash = { a: 1, b: 2, c: 3 }
hash.each_key { |key| puts key }
Anonymous Quiz
2%
Prints only the values of the hash
93%
Prints only the keys of the hash
3%
Prints both keys and values of the hash
2%
Runtime error
Which of the following methods adds an element to the end of an array?
Anonymous Quiz
8%
add
72%
push
4%
insert
16%
append
Which of the following methods converts a string to a number?
Anonymous Quiz
5%
to_integer
3%
to_num
90%
to_i
1%
parse
What does the super keyword do in Ruby?
Anonymous Quiz
0%
Defines a new method for the class
4%
Passes control to another block
6%
Creates a superclass
90%
Calls the parent class's method with the same arguments
Which design pattern is typically used to construct objects with complex creation logic?
Anonymous Quiz
3%
Observer
9%
Singleton
46%
Builder
43%
Factory
What is the name of the architectural style that separates responsibilities into models, views, and controllers?
Anonymous Quiz
1%
REST
10%
MVP (Model-View-Presenter)
1%
MVVM (Model-View-ViewModel)
87%
MVC (Model-View-Controller)
Which of the following methods violates data encapsulation?
Anonymous Quiz
25%
Using getters and setters
17%
Using private methods
56%
Directly accessing instance variables from external code
2%
Using protected methods
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
4%
Dependency Inversion Principle
81%
Single Responsibility Principle (SRP)
Which Ruby library is most commonly used for dependency injection?
Anonymous Quiz
7%
Sidekiq
46%
Dry::Container
10%
Faraday
36%
ActiveRecord
🥴5💩3👍1👏1🤣1