Q. How do you read the entire contents of a file into a string in Ruby?

  • (A) file.gets()
  • (B) file.readlines()
  • (C) file.read()
  • (D) file.each_line()
πŸ’¬ Discuss
βœ… Correct Answer: (C) file.read()

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
167
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
89%
Success Rate