Python Files Class XII

Python Files Class XII

12th Grade

26 Qs

quiz-placeholder

Similar activities

kidbright_unit1_M5

kidbright_unit1_M5

7th - 12th Grade

22 Qs

Round 1: Hack The Quest

Round 1: Hack The Quest

8th Grade - University

22 Qs

UC2: Planejar e executar a instalação de hardware e software

UC2: Planejar e executar a instalação de hardware e software

12th Grade

22 Qs

Computer Program

Computer Program

10th - 12th Grade

21 Qs

Chapter 17

Chapter 17

11th - 12th Grade

21 Qs

AS Data Types and Programming Constructs

AS Data Types and Programming Constructs

10th - 12th Grade

22 Qs

Y3 Unit 1

Y3 Unit 1

3rd Grade - University

21 Qs

Quiz B6 về kỹ thuật lập trình

Quiz B6 về kỹ thuật lập trình

12th Grade

21 Qs

Python Files Class XII

Python Files Class XII

Assessment

Quiz

Computers

12th Grade

Practice Problem

Medium

Created by

Pravin S R

Used 30+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

26 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Given a text file opened as file_in, which of the following will print the entire file? (Select ALL that apply.)

print(file_in.read())

print(file_in)

lines = file_in.readlines()

for line in lines:

print(line)

lines = file_in.readlines()

for i in range(len(lines)):

print(lines)

for line in file_in:

print(line)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to open the file file_in.txt for reading?

open('file_in.txt', 'r')

open('file_in.txt','r+')

open('file_in.txt','w')

open('file_in.txt','a')

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the best way to read an entire file into a single string?

.read()

.readline()

.readlines()

.read(all)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the best way to read an entire file into a list of strings?

.read()

.readline()

.readlines()

.read(all)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the best way to read the first line of a file?

.read()

.readline()

.readlines()

.read(all)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When reading text files, what are the hidden characters typically at the end of each line?

\n

#

@

»

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

This command will open MyFile = open('MyText.txt', 'r')

To read the file

To append to the file

To write to the file

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?