C1S170 Week 7 Sample Quiz in C# – 35/35 marks

Price = $8
Please feel free to send us your queries at: [email protected]
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement
1. (TCO 13) Include the _____ namespace in your C# program to enable it to move files from one directory to another. (Points : 3)
System.File.IO
System.IO
System.Streams
System.Linq

2. (TCO 13) Before your C# program attempts to open a file, it should first _____. (Points : 3)
call File.Open() to make sure the file can be opened
call File.Exists() to make sure the file exists
call File.Create() to create the file
call File.Close() to close the file in case it was already open

3. (TCO 13) To make your C# program delete a file called “oldFile.doc” in the current directory, write _____. (Points : 3)
File.Close(“oldFile.doc”);
File.Close(“oldFile.doc”, true);
File.Delete(“oldFile.doc”);
File.Delete(“oldFile.doc”, true);

4. (TCO 13) To print out the time a file called “plans.txt” was created, write _____. (Points : 3)
Console.WriteLine(File.FileInfo(“plans.txt”);
Console.WriteLine(GetFileInfo(“plans.txt”);
Console.WriteLine(GetCreationTime(“plans.txt”);
Console.WriteLine(File.GetCreationTime(“plans.txt”));

5. (TCO 13) The following C# statement will _____.

Directory.Delete(Directory.GetCurrentDirectory());
(Points : 3)
delete the current directory
delete the files in the current directory
first check the permissions of the current directory
throw an exception

6. (TCO 13) The following C# code will print out _____.

DirectoryInfo dir = new
DirectoryInfo(“.”);
foreach (FileInfo
fil in dir.GetFiles(“*.*”))
Console.WriteLine(fil.Name);
(Points : 3)
the names of all subdirectories of the current directory
the names of all subdirectories of the root directory
the contents of all files in the root directory
the names of all files in the current directory

7. (TCO 13) Although the _____ class is useful for working with byte-level data, the _____ class facilitates working with data in readable (text) format. (Points : 3)
IO.StreamReader, IOStream
IO.Stream, IO.StreamWriter
System.IO, IO.Text
IO.Text, System.IO

8. (TCO 13) If a C# program tries to move a file that does not exist and no error handling has been included in the code, a _____ will occur. (Points : 3)
compiler error
linker error
logic error
runtime error

9. (TCO 13) In the following code, the statement “StreamWriter myFile = new StreamWriter(“text.txt”,true);” _____.

try
{
StreamWriter myFile = new StreamWriter(“text.txt”,true);
for (int i = 0; i < 10; i++) myFile.WriteLine("Student[{0}]: ", i); myFile.Close(); } (Points : 3) automatically closes "text.txt" after the try…catch block won't create "text.txt" if it doesn't already exist opens "text.txt" file for appending opens "text.txt" file for overwriting 10. (TCO 13) You're writing a data decryption program. Because your C# code needs to read data from an encrypted file one character at a time, you decide to use the _____ member of the _____ class. (Points : 3) ReadChar(), BinaryReader ReadChars(), BinaryReader ReadChar(), StreamReader ReadChars(), StreamReader 11. (TCO 13) Write a C# program to write your mother's first and last names (on the same line) to a new file called "mom.txt." Use the StreamWriter class and appropriate try…catch blocks. Print out any System.IO.IOExceptions. Remember to close the file after writing to it. (Points : 5)

Relevant Material
Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on [email protected]
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.
Payment Details
Price = $8
Please feel free to send us your queries at: [email protected]
Payment methods

Add to Cart

Buy Now

View Cart

Leave a Reply