Ruby - File IO
What will be the output of this Ruby code if the file
data.txt contains the text 12345?text = File.read('data.txt')
puts text.lengthdata.txt contains the text 12345?text = File.read('data.txt')
puts text.lengthFile.read('data.txt') returns the string "12345".text.length returns the number of characters, which is 5.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions