MCQs > IT & Programming > Ruby > The following code snippet has two methods, namely 'method1' and 'method2'. def method1 x = 'This' y = 'is' z = 'test' end puts method1 def method2 x = 'This' y = 'is' z = 'test' return x, y, z end print method2

Ruby MCQs

The following code snippet has two methods, namely "method1" and "method2".
def method1
   x = "This"
   y = "is"
   z = "test"
end
puts method1
def method2
   x = "This"
   y = "is"
   z = "test"
  return x, y, z
end
print method2
What will be the output of the method1 and method2 when called with puts and print?

Answer

Correct Answer:

Output of "print method2" will be "Thisistest" 

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