What is the output of the following code in Ruby?
a = "hello world"
puts a.scan(/(..)(..)/)
he
ll
o
wo
[['he'. ‘ll“]. ['0 “. ‘wo']]
hello
world
["hello", "world"]
Correct Answer:
Explanation:
Note: This Question is unanswered, help us to find answer for this one
Ruby Skill Assessment
Your Skill Level: Poor
Retake Quizzes to improve it
More Ruby MCQ Questions
Environment variables in Ruby: Statement 1: Environment variable RUBYLIB defines the search path for libraries. Statement 2: Environment variable RUBYLIB_PREFIX modifies the RUBYLIB search path by replacing the prefix of a particular library.
Which of the following statements regarding Ruby variables is incorrect?
DBD::Mysql implements some driver-specific functions to be used In Ruby. Given below is one such function: dbh.func(:insert_id) => Fixnum What is the purpose of this function?
Which of the following options represent correct Ruby syntax?
Output of Ruby code? print <
Assuming that f is an instance of the File class:
Which of the following is used to cancel the method definition?
Statement X: Method names should begin with an uppercase letter. Statement Y: Methods should be defined before calling them, otherwise Ruby will raise an exception for undefined method invoking.
What is output of this Ruby code? foo = 'testing' puts defined? foo puts defined? $_
Statement 1: When a Ruby program terminates, all running threads are killed. regardless of their states. Statement 2: You can wait for a particular thread to finish by calling that thread