Search Header Logo

Python Programming Quiz-04

Authored by pragya _CSE

Engineering

Professional Development

Used 1+ times

Python Programming Quiz-04
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

22 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does the read() function do in Python?

Reads the entire file and returns it as a string.

Reads a single line from the file.

Reads the file as a list of lines.

Deletes the file content.

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does the readline() function do?

Reads the entire file and returns it as a string.

Reads a single line from the file.

Reads the file in reverse order.

Returns a list of all lines in the file.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is true about the readlines() function?

Reads the file as a list of lines.

Reads the file byte by byte.

Writes a list of lines to the file.

Reads a single character from the file.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What happens if read(5) is executed?

Reads the first 5 bytes/characters of the file.

Reads 5 lines from the file.

Reads the entire file.

Throws an error if the file is smaller than 5 bytes.

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which function is used to move the file pointer to a specific position?

tell()

seek()

move()

pointer()

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does seek(0) do in a file?

Moves the pointer to the beginning of the file.

Moves the pointer to the end of the file.

Deletes the file content.

Reads the first character of the file.

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which method is used to write a single string to a file?

write()

writelines()

append()

insert()

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?