1.

Which of the following are valid floating point literal?(a) .5(b) 2(c) 0.5(d) None of the mentionedThis question was posed to me during an interview for a job.This intriguing question comes from Basics in section Ruby Basics of Ruby

Answer»

The correct OPTION is (c) 0.5

Easiest explanation: floating POINT LITERALS are VALID only when they have digits on both the sides of decimal point.



Discussion

No Comment Found

Related InterviewSolutions