Search Header Logo

G10 CS File Handling

Authored by Fritz Bansag

Computers

12th Grade

Used 8+ times

G10 CS File Handling
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code do?

f=open("test.txt")

Opens the file

in WRITE mode

Opens the file

in READ mode

Opens the file

both

READING and WRITING

Syntax Error

None of the choices

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when you try to open a file that does not exist using the code?

with open("test.txt",'w') as f:

A new file is created

Error message

pops up

Nothing happens

None of the above

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does opening a file in mode ‘a’ mean?

with open("test.txt“, ‘a’) as f:

Open test.txt

for reading

Open test.txt

for writing

Open test.txt for appending text at the end of the file

None of the file

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

See the test1.txt file content to answer

This is now opened using this code: f=open("test1.txt",'r')

What is the output of f.read(15) ?

'This is a text file'

'This is a text'

'This is a text '

None of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

See the test1.txt file content to answer

This is now opened using this code: f=open("test1.txt",'r')

What is the output of f.read(15) ?

'This is a text file'

'This is a text'

'This is a test '

None of the above

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

See the test1.txt file content to answer

This is now opened using this code: f=open("test1.txt",'r')

After executing f.read(15),

the code f.read(10) returns what output?

'This is a ‘

'file.\nIt h‘

‘ file.\nIt'

None of the above

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

See the test1.txt file content to answer

This is now opened using this code: f=open("test1.txt",'r')

After executing f.read(15) and f.read(10), now f.read() is executed.

What is the output?

'as three lines.\nI am processing it using Python.‘

‘has three lines.\nI am processing it using Python.'

'This is a text file.\nIt has three lines.\nI am processing it using Python.'

None of the above

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?