AS SSD Managing Input and Output Flashcards

(27 cards)

1
Q

How can data be very easily input?

A

Data can be easily input using the console, through the use of the Console.ReadLine() method, provided that the data that the user has input is stored in a variable to be used elsewhere in the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How is data outputted back to the screen?

A

Output is displayed back to the user using the Console.WriteLine() method, provided a Console application has been created and used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can output data be manipulated?

A

By using a number of string handling methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What method converts all output into upper case characters?

A

ToUpper() converts all data which has been output into upper case characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which method converts output into lower case characters?

A

ToLower() converts all the data which has been input into lower case characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which method joins two strings together?

A

Concat() joins two strings together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which method checks if a string contains a series of characters?

A

Contains() checks if a string contains a series of characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What method replaces part of a string with another?

A

Replace() replaces one part of a string with another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What method splits a string?

A

Split() splits a string based on a specific “delimiter”. E.g. Every time a string appears.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the easiest way to write to a text file?

A

It is to use the StreamWriter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a “stream”?

A

A “stream” is a method used to read or write data in a continuous flow. E.g. when writing data to a file, a StreamWriter will write all the text to the file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is important when using a StreamWriter?

A

It is important to close the StreamWriter when you have finished writing to a file. Without closing the writer, the data may not be written to the file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What else is also important in relation to using a StreamWriter?

A

The path you use is also important.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What happens if the path is correct but the file has not been created?

A

Then the file will be created.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens if the path is wrong?

A

Then an error will be produced.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What method when the code is run again will overwrite the data already held in the file?

A

The WriteLine() method will.

17
Q

How would you get around the issue that data is being overwritten in the file?

A

You would add an additional parameter into the StreamWriter class.

18
Q

What parameter would be reasonable to use to fix data being overwritten?

A

A “path” parameter that is a Boolean value which tells the writer if it is true or false that the text will be appended to the file.

19
Q

What is another way to write to text files?

A

You can use the FileStream.

20
Q

What is the difference between the FileStream and the StreamWriter?

A

The StreamWriter will write data to a text file by handling raw text, such as strings when it writes data to a file. However, the FileStream will directly interact with the file at a more basic level as it deals with the raw bytes in the file.

21
Q

What format must the data be in in order for the FileStream to use the data?

A

The data must be in a raw binary format.

22
Q

What happens when the FileStream is created?

A

Two parameters will use the specified location and the “Create” mode will allow a file to be created if it doesn’t exist in the specified location. Or if it does exist then the file will overwrite the data already stored in it.

23
Q

What else can you do with a text file?

A

It is also possible to read from a text file using both the StreamReader and the FileStream.

24
Q

What should you remember to do with the StreamReader?

A

It is vital to close the StreamReader once you have finished reading the data from the file.

25
What is a binary file?
A binary file stores data in a binary format, meaning that it can’t be understood by humans. They can store data such as text, images or videos, albeit they are converted and stored in a binary format.
26
What can a binary file do much better than most other files?
A binary file can process data quicker than a file which stored data in other non-computer readable formats.
27
What is the process called of converting a human readable format to a binary format and back again?
It is called serialisation and deserialisation.