Exam 9: File and Folder Administration

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

When executed on Microsoft Windows, Ruby program file and path data must be specified using the backslash character.

Free
(True/False)
5.0/5
(41)
Correct Answer:
Verified

True

Ruby allows you to create new folders using the Dir class's creatdir method.

Free
(True/False)
4.7/5
(40)
Correct Answer:
Verified

False

If you develop a script that will run on different operating systems, you will need a way to determine which type of operating system your script is currently executing on. One way to do this is by taking advantage of Ruby's RUBY_PLATFORM special variable.

Free
(True/False)
4.7/5
(34)
Correct Answer:
Verified

True

Which of the following File class methods can be used to change a file's name?

(Multiple Choice)
4.9/5
(41)

Which of the mode options opens a file for both reading and writing, overwriting any existing text. If the specified file does not exist, it is created.

(Multiple Choice)
4.9/5
(34)

Using the File class's folder? method, you can determine if a resource is a folder or something else (socket, pipe, etc.).

(True/False)
5.0/5
(28)

The Dir class's entries method returns the contents of the folder as an array.

(True/False)
4.9/5
(35)

The Folder class gives you access to various folder administration methods.

(True/False)
4.8/5
(38)

Which of the following File class methods can be used to determine if a resource is a file or something else?

(Multiple Choice)
4.9/5
(32)

The File class gives you access to various file administration methods.

(True/False)
4.9/5
(39)

A reference can be set up for a file using which of the following File methods?

(Multiple Choice)
4.8/5
(29)

Which of the mode options opens a file in append mode, preserving any preexisting text while allowing new text to be added to the end of the file.

(Multiple Choice)
4.8/5
(40)

Which of the following Dir class methods can be used to return a list of the contents of a folder in the form of an array.

(Multiple Choice)
4.9/5
(35)

Ruby lists the contents of a folder using the Dir class's files method.

(True/False)
4.9/5
(46)

If an empty file were used as input to the operator, a ____ value is returned.

(Multiple Choice)
4.9/5
(38)

Which of the following methods can be used to open a file for reading?

(Multiple Choice)
4.8/5
(36)

Which of the mode options opens a file in append mode, allowing for both reading and writing while preserving any preexisting text.

(Multiple Choice)
4.8/5
(38)

Which of the mode options opens a file for reading only?

(Multiple Choice)
4.9/5
(36)

Given a script named DispMsg.rb, if an empty file were used as input to: ruby DispMsg.rb a value of nil would be assigned to the message variable in the statement: message = STDIN.gets

(True/False)
4.8/5
(37)

Ruby allows you to delete both files and folders using the File and Dir classes's delete methods.

(True/False)
4.8/5
(34)
Showing 1 - 20 of 49
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)