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 = CreateO
...
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:\Data\CustData.txt to C:\BackUp\CustData.txt in VBScript, use the following command (assuming fso is a Scripting.FileSystemObject) _____.
fso.FileCopy(”C:\BackUp\CustData.txt”, “C:\Data\CustData.txt”)
fso.CopyFile(”C:\BackUp\CustData.txt”, “C:\Data\CustData.txt”)
fso.FileCopy(“C:\Data\CustData.txt”,”C:\BackUp\CustData.txt”)
Correct!
fso.CopyFile(“C:\Data\CustData.txt”,”C:\BackUp\CustData.txt”)
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:\Data\CustData.txt”)
fso.EraseFile(Exists(“C:\Data\CustData.txt”)
fso.FileErase(Exists(“C:\Data\CustData.txt”)
fso.FileDelete(Exists(“C:\Data\CustData.txt”)
Question 5
2 / 2 pts
(TCO 6) The following command opens a text file in VBScript.
Set file = fso.OpenTextFile(“C:\Data\CustData.txt”, ?, ??, ???)
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:\Data\CustData.txt”, ?, ??, ???)
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:\Data\CustData.txt”, ?, ??, ???)
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
[Show More]