Search Header Logo

Computer Science Quiz - Grade XII

Authored by Amudhavalli K

Computers

12th Grade

Used 2+ times

Computer Science Quiz - Grade XII
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following is the correct mode to open a text file for reading?

rb

r

w

a

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which method is used to read the entire contents of a text file as a single string?

readline()

readlines()

read()

input()

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What does the readline() function return?

A list of lines

One line at a time as a string

The number of lines

None of the above

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which method is used to write data to a text file?

input()

print()

write()

append()

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What happens if a file is opened in 'w' mode and it already exists?

It appends to the file

It raises an error

It deletes the contents of the file

It does nothing

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

How do you close a file in Python?

file.close()

file.stop()

file.end()

close(file)

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What does the 'a' mode do when opening a file?

Opens for reading

Opens for writing (overwrites)

Opens for appending

Opens for deleting

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?