MULTIPLE CHOICE QUESTIONS (MCQ)
1.
Introduction to Files
1.
What is the primary purpose of storing data in files?
a)
To execute programs faster
b)
To permanently store data for later access
c)
To reduce memory usage
d)
To improve program readability
2.
Where are files stored in a computer system?
a)
Primary memory (RAM)
b)
Secondary storage media
c)
CPU registers
d)
Cache memory
Types of Files
2.
Which of the following is a text file extension?
a)
.txt
b)
.jpg
c)
.exe
d)
.mp3
3.
What is the main difference between text and binary files?
a)
Text files are smaller in size
b)
Binary files contain human-readable characters
c)
Text files consist of ASCII/Unicode characters
d)
Binary files cannot be opened in Python
4.
What happens if a binary file is opened in a text editor?
a)
It displays the correct content
b)
It shows garbage values
c)
It automatically converts to text
d)
It asks for a password
5.
Which of the following is an example of a binary file?
a)
A .csv file
b)
A .py file
c)
A .docx file
d)
A .txt file
6.
What is the default EOL character in Python?
a)
\r
b)
\n
c)
\t
d)
\0
7.
Which encoding scheme is commonly used for text files?
a)
ASCII
b)
JPEG
c)
MPEG
d)
ZIP
3.
Opening
and
Closing
Files
8.
Which function is used to open a file in Python?
a)
file_open()
b)
open()
c)
load()
d)
read()
9.
What is the default mode for opening a file?
a)
Read mode (‘r’)
b)
Write mode (‘w’)
c)
Append mode (‘a’)
d)
Binary mode (‘b’)