Comp 230 Wk 6 Quiz Devry
Comp 230 Wk 6 Quiz Devry a Question 1 2 / 2 pts (TCO 6) Which line will properly create the object for VBScript File I/O? Correct! Set fso = CreateObject(“Scripting.FileSystemObject”) Set fso = CreateObject(“WScript.FileSystemObject”) Set fso = Scripting.FileSystemObject fso = CreateObject(“Scripting.FileSystem”) Question 2 0 / 2 pts (TCO 6) To test to see if a file exists before you overwrite it in VBScript, use the following command (assuming fso is a Scripting.FileSystemObject) _____. If fso.FileFound(file) Then If fso.FileCreated(file) Then You Answered If fso.FileNotFound(file) Then Correct Answer If fso.FileExists(file) Then Question 3 2 / 2 pts (TCO 6) To copy the file C:DataCustD to C:BackUpCustD in VBScript, use the following command (assuming fso is a Scripting.FileSystemObject) _____. fso.FileCopy(”C:BackUpCustD”, “C:DataCustD”) fso.CopyFile(”C:BackUpCustD”, “C:DataCustD”) fso.FileCopy(“C:DataCustD”,”C:BackUpCustD”) Correct! fso.CopyFile(“C:DataCustD”,”C:BackUpCustD”) Question 4 2 / 2 pts (TCO 6) To delete a file in VBScript, use the following command (assuming fso is a Scripting.FileSystemObject) _____. Correct! fso.DeleteFile(Exists(“C:DataCustD”) fso.EraseFile(Exists(“C:DataCustD”) fso.FileErase(Exists(“C:DataCustD”) fso.FileDelete(Exists(“C:DataCustD”) Question 5 2 / 2 pts (TCO 6) The following command opens a text file in VBScript. Set file = fso.OpenTextFile(“C:DataCustD”, ?, ??, ???) To open a file for reading, the value of ? must be _____. the value of ? must be 2 the value of ? must be false the value of ? must be true Correct! the value of ? must be 1 Question 6 2 / 2 pts (TCO 6) The following command opens a text file in VBScript. Set file = fso.OpenTextFile(“C:DataCustD”, ?, ??, ???) To open a file for writing, the value of ? must be _____. Correct! the value of ? must be 2 the value of ? must be true the value of ? must be 1 the value of ? must be false Question 7 0 / 2 pts (TCO 6) In VBScript, to read the contents of an entire text file into a string variable called fileStr, use the following method (assuming fileObj is a file object created with CreateTextFile( ) or OpenTextFile) _____. Correct Answer fileStr = fileObj.ReadAll You Answered fileObj.Read(fileStr) fileStr = fileObj.Read fileObj.ReadAll(fileStr) Question 8 2 / 2 pts (TCO 6) The following command opens a text file in VBScript. Set file = fso.OpenTextFile(“C:DataCustD”, ?, ??, ???) To ensure that the file is formatted as ASCII instead of Unicode, the value of ??? must be _____. Correct! the value of ??? must be 0 the value of ??? must be 2 the value of ??? must be -1 the value of ??? must be -2 Question 9 2 / 2 pts (TCO 6) To test to see if a directory (or folder) exists before you write data to it in VBScript, use the following command (assuming fso is a Scripting.FileSystemObject) _____. If fso.FolderNotFound(folderName) Then If fso.FolderFound(folderName) Then Correct! If fso.FolderExists(folderName) Then If fso.FolderCreated(folderName) Then Question 10 2 / 2 pts (TCO 6) In VBScript, to bypass reading the next four characters in a text file, use the following method (assuming fileObj is a file object created with OpenTextFile) _____. fileObj.Bypass(3) fileObj.Move(3) fileObj.Ignore(3) Correct! fileObj.Skip(3) Quiz Score: 16 out of 20 Previous
Información del documento
- Subido en
- 9 de enero de 2021
- Número de páginas
- 8
- Escrito en
- 2020/2021
- Tipo
- Examen
- Contiene
- Preguntas y respuestas