G10 CS File Handling

G10 CS File Handling

12th Grade

10 Qs

quiz-placeholder

Similar activities

File Handling in Python

File Handling in Python

11th - 12th Grade

10 Qs

File Handling-1

File Handling-1

12th Grade

10 Qs

Python Files I/O

Python Files I/O

6th - 12th Grade

8 Qs

Slip Test

Slip Test

12th Grade

10 Qs

Linux-2 Quiz 2 -- LAMP

Linux-2 Quiz 2 -- LAMP

1st - 12th Grade

15 Qs

PYTHON FILES

PYTHON FILES

9th - 12th Grade

8 Qs

Reading & writing to a text file (Python)

Reading & writing to a text file (Python)

9th - 12th Grade

14 Qs

Writing files in python

Writing files in python

9th - 12th Grade

13 Qs

G10 CS File Handling

G10 CS File Handling

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Fritz Bansag

Used 8+ times

FREE Resource

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?