Chapter 6 Key Terms Flashcards

1
Q

Types of Files

A

Text Files contain data that is encoded as text. Binary files contain data that has not been converted to text.

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

Sequential Access

A

A method of accessing data in a file where data is written or read from the beginning to the end.

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

Direct Access

A

A method of accessing data in a file where data can be read or written at any location within the file.

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

Filename

A

Is used to identify and locate a specific file within a directory or folder.

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

Filename Extensions

A

Suffixes added to filenames to indicate the file’s format or type.

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

File Object

A

Object associated with a specific file.

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

open Statement

A

Statement used in many programming languages to open a file for reading or writing.

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

Syntax for Opening a File

A

The syntax for opening a file consists of the open statement followed by the filename and mode in which the file should be opened.

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

mode

A

Specifies the purpose for which a file is opened.

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

‘r’

A

Read mode (default). Opens the file for reading.

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

‘w’

A

Write mode. Opens the file for writing.

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

‘a’

A

Append mode. Opens the file for writing.

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

write Statement

A

Used to write data to an open file. Allows for modification of content within a file.

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

Syntax for Writing to a File

A

The syntax for writing to a file involves using the file object’s ‘write’ method.

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

read Statement

A

Used to read data from an open file. Allows for the retrieval of content from a file and store it in a variable or display it.

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

Syntax for Reading from a File

A

The syntax for reading from a file involves using the file object’s ‘read’ method.

17
Q

‘\n’

A

An escape sequence that represents a newline character. Indicates the end of a line.

18
Q

rstrip

A

String method that removes trailing whitespace

19
Q

close

A

Used to close an open file.

20
Q

readline()

A

A method used to read a single line in a file.

21
Q

Field

A

A single piece of data within a record.

22
Q

Record

A

A data structure that represents a collection of related data fields, each with its own value.

23
Q

Exception

A

An event or error condition that disrupts the normal flow of a program

24
Q

try/except/else Statement

A

Is used for error handling.

25
Q

finally Clause

A

Code within the “finally” block is executed regardless of whether an exception was raised or not.