A.) arr = [1, 2, 3] B.) arr = Array.new(3) { |i| i + 1 } C.) arr = [1..3] D.) arr = [] << 1 << 2 << 3
A.) To create a class B.) To define a loop C.) To group related code into a namespace D.) To declare a variable
A.) rescue Exception => e B.) catch (Exception ex) {} C.) rescue => e D.) rescue SomeException => e
A.) lambda { |x| x * 2 } B.) def lambda(x) { x * 2 } end C.) func(x) { x * 2 } D.) create lambda(x) { x * 2 }
A.) An empty string B.) A missing or undefined value C.) The number zero D.) An error
A.) block { |x| x * 2 } B.) def block(x) { x * 2 } end C.) { |x| x * 2 } D.) create block(x) { x * 2 }
A.) To define a loop B.) To execute code based on a condition C.) To call a method in the superclass D.) To declare a variable
A.) for item in collection B.) collection.each do |item| C.) while condition D.) until condition
A.) constructor MyClass { } B.) MyClass.new { } C.) def MyClass.initialize D.) def initialize
A.) To define a class B.) To create an instance of a class C.) To include a module's methods in a class D.) To declare a variable