Search Header Logo

Test8

Authored by Rares Hampi

Information Technology (IT)

9th - 12th Grade

Used 4+ times

Test8
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will f.read() return after reaching EOF in a .txt file?

Raises EOFError

Returns empty string

Returns None

Loops to the beginning

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What happens if you use f.write("data") on a file opened with "r" mode?

Writes normally

Truncates the file first

Raises io.UnsupportedOperation

Returns False

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which is true about with open(...) as f: block?

It closes the file only on success

File stays open after the block ends

It guarantees file closure even on exceptions

Cannot be used with binary files

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does f.readlines() return by default?

A single string

List of lines with trailing newline characters

List of stripped strings

Generator

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What’s the result of calling f.write("abc\n", "def\n")?

Writes both lines

Writes only the first

SyntaxError

TypeError

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

In CSV, what is the purpose of newline="" in open()?

Prevents empty columns

Combines rows

Prevents extra blank lines (Windows)

Forces UTF-8

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following uses keys to access values directly?

csv.reader

csv.writer

csv.DictReader

csv.reader with delimiter

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?