Python Files Class XII

Quiz
•
Computers
•
12th Grade
•
Medium
Pravin S R
Used 30+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
23 questions
2.02 Multimedia Media Webpage Design

Quiz
•
9th - 12th Grade
30 questions
PNHS - ICT Quiz Bee (Elimination) - EASY ROUND

Quiz
•
9th - 12th Grade
22 questions
Utility Software

Quiz
•
KG - University
25 questions
KELAS 9 BAB 3 BEKERJA DENGAN DATA DAN MODEL KOMPUTASI

Quiz
•
9th Grade - University
24 questions
Unit 7 Test - Recon

Quiz
•
12th Grade
21 questions
Computer

Quiz
•
6th Grade - Professio...
30 questions
Technology: Internet & Apps

Quiz
•
9th - 12th Grade
28 questions
System Software

Quiz
•
12th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade