24-25 file handling

24-25 file handling

11th Grade

27 Qs

quiz-placeholder

Similar activities

BIM 1 Review

BIM 1 Review

9th - 12th Grade

25 Qs

WORD Module 2 Review

WORD Module 2 Review

9th - 12th Grade

24 Qs

HTML Quiz

HTML Quiz

11th Grade

25 Qs

Ôn tập học kì II - Lớp 11

Ôn tập học kì II - Lớp 11

11th Grade

25 Qs

Year 11 Mich HT1 Part 1

Year 11 Mich HT1 Part 1

11th Grade

28 Qs

2.2 Programming techniques

2.2 Programming techniques

10th - 11th Grade

24 Qs

Grade 9- s2- a2- gimp

Grade 9- s2- a2- gimp

6th - 12th Grade

26 Qs

AP CSP Unit 2 Term Quiz

AP CSP Unit 2 Term Quiz

10th - 12th Grade

30 Qs

24-25 file handling

24-25 file handling

Assessment

Quiz

Computers

11th Grade

Hard

Created by

Deepti Gupta

Used 1+ times

FREE Resource

27 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To open a file c:\test.txt for reading, we should give the statement:

file1 = open(“c:\test.txt”,”r”)

file1 = open(“c:\\test.txt”,”r”)

file1 = open(file=”c:\test.txt”,”r”)

file1 = open(file=”c:\\s test.txt”,”r”)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To open a file c:\ test.txt for writing, we should use the statement:

fobj = open(“c:\test.txt”,”w”)

fobj = open(“c:\\test.txt”,”w”)

fobj = open(file=”c:\test.txt”,”w”)

fobj = open(file=”c:\\test.txt”,”w”)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To open a file c:\ test.txt for appending data, we can give the statement:

fobj = open(“c:\\test.txt”,”a”)

fobj = open(“c:\\test.txt”,”rw”)

fobj = open(file=“c:\test.txt”,”w”)

fobj = open(file=“c:\\ test.txt”,”w”)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is/are true?

when we open a file for reading, if the file does not exist, an error occurs.

when we open a file for writing, if the file does not exist, a new file is created.

when we open a file for writing, if the file exists, the existing file is overwritten with the new file.

All of these

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Identify the error in the following code.

  1. 1. f = open ("workfile.txt', 'r+')

2. f.write('0123456789abcdef')

3. f.write('xyz8466')

4. f.close()

5. f.seek (0)

6. f.read()

Line 1

Line 2

Line 5

Line 6

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To read the entire contents of the file as a string from a file object fobj, the command should be:

fobj.read(2)

fobj.read()

fobj.readline()

fobj.readlines()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following snippet?

True

False

None

Error

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?