MCQs > IT & Programming > Ruby > A file named 'test' is located at the location '/var/www/ruby/' 1. aFile = File.new('/var/www/ruby/test', 'r') 2. if aFile 3. aFile.syswrite('RUBY Testing') 4. print

Ruby MCQs

Given below is a Ruby code snippet with line numbers:
Note: A file named "test" is located at the location "/var/www/ruby/"
1. aFile = File.new("/var/www/ruby/test", "r")
2. if aFile
3.    aFile.syswrite("RUBY Testing")
4.    print "Done!"
5. else
6.    puts "Unable to open file!"
7. end
What is the outcome when the above code is executed?

Answer

Correct Answer:

It gives an error on line number 3.  

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Ruby Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Ruby Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it