Search Header Logo
Writing Files

Writing Files

Assessment

Presentation

•

Computers

•

9th - 10th Grade

•

Practice Problem

•

Medium

Created by

Calum Gordon

Used 1+ times

FREE Resource

8 Slides • 30 Questions

1

Writing Files

Writing data to text files

media

2

media

3

media

4

Multiple Select

Question image

In this lesson I am going to learn to ... ?

1

Open files for writing

2

Construct a csv lines from a 2D data structure

3

Write csv records to a file

4

Close a file

5

media

6

Fill in the Blanks

Data that is held in a data structure within a program is being stored in

Type answer...

memory.

7

Fill in the Blanks

The reason for writing data to a text file is so that it will be saved as

Type answer...

data on a backing storage device.

8

media

9

Multiple Select

Question image

What two characters are present at the end of every line in a data file?

1

Line feed (LF)

2

Carriage return (CR)

3

Enter (E)

4

Space (" ")

10

media

11

Multiple Choice

What must be the data type of all data written to a text file?

1

String

2

List

3

Tuple

4

Integer

12

Multiple Choice

What special 'escape' character must be added onto the end of every line of data before it is written to a file?

1

'\n'

2

'\t'

3

'\e'

4

'\cr'

13

Multiple Choice

Question image

What operation is shown by += in this code?

1

concatenation

2

repetition

3

iteration

4

string slicing

14

media

15

Multiple Choice

What file access mode is required?

A teacher wants to calculate the highest, lowest and average mark from a students' test

1

'r'

2

'w'

3

'a'

16

Multiple Choice

What file access mode is required?

A teacher wants to save the results from a students' test

1

'r'

2

'w'

3

'a'

17

Multiple Choice

What file access mode is required?

A teacher wants to save the test result of a new student who has joined the class

1

'r'

2

'w'

3

'a'

18

Fill in the Blanks

media image

Type the name of a data structure ...

Type answer...

19

Fill in the Blanks

media image

What is len(newData)?

Type answer...

20

Multiple Choice

Question image

Which is Igor's record?

1

newData[0]

2

newData[1]

3

newData[2]

4

newData[3]

21

Fill in the Blanks

media image

What is newData[2][2]?

Type answer...

22

Fill in the Blanks

media image

What is len(newData[1])?

Type answer...

23

Fill in the Blanks

media image

Type the name of a file object ...

Type answer...

24

Fill in the Blanks

media image

Type the name of a Python keyword ...

Type answer...

25

Fill in the Blanks

media image

Type the name of a built-in function (no paranthesis) ...

Type answer...

26

Fill in the Blanks

media image

Type the name of a file object method (no parenthesis)

Type answer...

27

Fill in the Blanks

media image

Type the name of a loop variable ...

Type answer...

28

Multiple Choice

Question image

What is data type of index variable?

1

int

2

str

3

float

4

bool

29

Fill in the Blanks

media image

Type the name of a string variable ...

Type answer...

30

Fill in the Blanks

media image

Type a line number that uses concatenation ...

Type answer...

31

Fill in the Blanks

media image

Type in a string literal (without "") ...

Type answer...

32

Multiple Choice

Question image

What type of loop starts on line 7?

1

conditional

2

count-controlled over a range of integers

3

count-controlled over a data structure

33

Multiple Choice

Question image

What type of loop starts on line 9?

1

conditional

2

count-controlled over a range of integers

3

count-controlled over a data structure

34

Fill in the Blanks

media image

There are two loops shown, one inside the other. This structure is called a

Type answer...

loop.

35

media

36

Multiple Select

Question image

In this lesson I have learned to ...

1

Open files for writing

2

Convert a record into a CSV string

3

Write a CSV string to a text file

4

Close a file

37

Open Ended

Question image

Thinking Hard

Turn your learning from this lesson into a series of step-by-step instructions

(press Shift+Enter to take a new line ...)

38

Poll

Question image

How much of this lesson have you understood?

None of it

Some of it

Most of it

All of it

pattern-tertiary
Writing Files

Writing data to text files

media

Show answer

Auto Play

Slide 1 / 38

SLIDE