MCQs > IT & Programming > Ruby > Given below are two different cases of class definition, and object instantiation in Ruby. Case 1: ----------- class Demo end p = Demo.new Case 2: --------- class Demo2 def initialize(x,y) @x, @y = x, y end end p = Demo2.initialize(15,20) What happens when both these cases are executed separately?

Ruby MCQs

Given below are two different cases of class definition, and object instantiation in Ruby.
Case 1:
-----------
class Demo
end
  p = Demo.new
Case 2:
---------
class Demo2
  def initialize(x,y)
    @x, @y = x, y
  end
end
  p = Demo2.initialize(15,20)
What happens when both these cases are executed separately?

Answer

Correct Answer:

Case 1 gives no error.

Explanation:

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

Ruby Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Ruby Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it