
File Handling

Quiz
•
Computers
•
10th - 12th Grade
•
Medium
Comp Sci
Used 5+ times
FREE Resource
26 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
30 sec • 1 pt
___________ is a process of storing data into files and allows to performs various tasks such as read, write, append, search and modify in files.
Answer explanation
File Handling is the correct choice as it refers to the process of storing data in files and performing operations like reading, writing, appending, searching, and modifying data within those files.
2.
FILL IN THE BLANK QUESTION
30 sec • 1 pt
To close a file in a program _______ function is used.
Answer explanation
The correct function to close a file in a program is close(). This function is essential for releasing the resources associated with the file, ensuring that all data is properly saved and the file is no longer in use.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this code myfile=open(“taxes.txt”) perform
opens the taxes.txt in default read mode.
opens the taxes.txt in default write mode.
opens the taxes.txt in default append mode.
opens the taxes.txt in default read and write mode.
Answer explanation
The code myfile=open("taxes.txt") opens the file 'taxes.txt' in the default read mode, which allows the program to read the contents of the file. Therefore, the correct choice is that it opens the taxes.txt in default read mode.
4.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Mode in the following program to open file for writing in a mode where new data will be added at the end of old data
file =open("poem.txt","__")
r
w
a
r+
Answer explanation
The correct mode to open a file for writing where new data is added at the end of existing data is 'a' (append mode). This allows you to add content without deleting the old data, unlike 'w' which overwrites it.
5.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Choose the correct statement to close a file stream named myfile:
myfile.terminate()
myfile.end()
myfile.close()
myfile.remove()
Answer explanation
The correct statement to close a file stream is 'myfile.close()'. This method properly releases the resources associated with the file, ensuring that all data is written and the file is no longer in use.
6.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What will be the output-
f=open('abc.txt','a')
text="xyz"
f.write(text)
f.close()
Writing into the file without erasing old content
Writing into the file by erasing old content
reading from the file without erasing old content
reading from the file by erasing old content
Answer explanation
The code opens 'abc.txt' in append mode ('a'), which allows writing new content without erasing existing content. Therefore, the correct choice is 'Writing into the file without erasing old content'.
7.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What is the use of “a” in file handling?
Read
Write
Append
None of the mentioned
Answer explanation
In file handling, the mode 'a' is used to append data to the end of a file without overwriting existing content. This makes 'Append' the correct choice, as it specifically indicates adding new data to a file.
Create a free account and access millions of resources
Similar Resources on Wayground
23 questions
Basic Linux Practice

Quiz
•
12th Grade
21 questions
Microsoft Word

Quiz
•
9th - 12th Grade
24 questions
Files & File Systems

Quiz
•
9th - 12th Grade
25 questions
PHP: Hypertext Preprocessor

Quiz
•
12th Grade
25 questions
CSV File handling in Python

Quiz
•
12th Grade
22 questions
Basic File Handling Operations Quiz

Quiz
•
11th Grade
25 questions
Level 3 - Python Quiz 1

Quiz
•
9th - 12th Grade
21 questions
Python Concepts Quiz

Quiz
•
11th Grade
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
Discover more resources for Computers
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
40 questions
LSHS Student Handbook Review: Pages 7-9

Quiz
•
11th Grade
10 questions
Characteristics of Life

Quiz
•
9th - 10th Grade
10 questions
Essential Lab Safety Practices

Interactive video
•
6th - 10th Grade
20 questions
Scalars, Vectors & Graphs

Quiz
•
11th Grade
62 questions
Spanish Speaking Countries, Capitals, and Locations

Quiz
•
9th - 12th Grade