1.

Why is gets not preferred instead of gets.chomp?(a) Gets add an extra new line while chomp removes it(b) Gets remove an extra new line(c) Chomp erases the value stored in the variable(d) All of the mentionedI had been asked this question during an internship interview.The query is from Library Functions in portion Ruby Basics of Ruby

Answer»

Right CHOICE is (a) Gets ADD an EXTRA new line while chomp removes it

The explanation is: gets.chomp will remove the extra BLANK space.



Discussion

No Comment Found

Related InterviewSolutions