
File Handling
Quiz
β’
Computers
β’
10th - 12th Grade
β’
Practice Problem
β’
Medium
Comp Sci
Used 5+ times
FREE Resource
Enhance your content in a minute
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.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
21 questions
Online Quiz 1- Empowerment Technology
Quiz
β’
11th Grade
23 questions
Cyber Security Study Guide
Quiz
β’
10th Grade
21 questions
Computer System
Quiz
β’
9th - 11th Grade
22 questions
1.1.3 Input, output and storage
Quiz
β’
11th Grade - University
21 questions
The Future of Your Job in the Age of AI (Video 6)
Quiz
β’
10th Grade
21 questions
PAS JACOB SEM 1
Quiz
β’
10th Grade
21 questions
Computer Applications Quiz 3
Quiz
β’
12th Grade
21 questions
AS Level Computer Science Quiz
Quiz
β’
11th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
β’
3rd Grade
20 questions
Equivalent Fractions
Quiz
β’
3rd Grade
25 questions
Multiplication Facts
Quiz
β’
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
β’
4th Grade
22 questions
fractions
Quiz
β’
3rd Grade
20 questions
Main Idea and Details
Quiz
β’
5th Grade
20 questions
Context Clues
Quiz
β’
6th Grade
15 questions
Equivalent Fractions
Quiz
β’
4th Grade
