Brand Logo

Class 9

Class 9 - English
Moments (9 Chapters)|
Beehive (18 Chapters)|
Words and Expressions - I (9 Chapters)
Class 9 - Health and Physical Education
Health and Physical Education (14 Chapters)
Class 9 - Hindi
Sanchayan (4 Chapters)|
Sparsh (10 Chapters)|
Kshitij (13 Chapters)|
Kritika (4 Chapters)
Class 9 - ICT
Information and Communication Technology (8 Chapters)
Class 9 - Mathematics
Mathematics (12 Chapters)
Class 9 - Sanskrit
Shemushi Prathmo Bhag (10 Chapters)|
Vyakaranavithi (20 Chapters)|
Abhyaswaan Bhav (15 Chapters)
Class 9 - Science
Science (12 Chapters)
Class 9 - Social Science
Contemporary India (6 Chapters)|
Democratic Politics (5 Chapters)|
Economics (4 Chapters)|
India and the Contemporary World - I (5 Chapters)

Class 10

Class 10 - English
First Flight (22 Chapters)|
Foot Prints Without feet (9 Chapters)|
Words and Expressions - II (9 Chapters)
Class 10 - Health and Physical Education
Health and Physical Education (13 Chapters)
Class 10 - Hindi
Kshitij - II (13 Chapters)|
Sparsh (14 Chapters)|
Sanchayan - II (3 Chapters)|
Kritika (3 Chapters)
Class 10 - Mathematics
Mathematics (14 Chapters)
Class 10 - Sanskrit
Vyakaranavithi (14 Chapters)|
Shemushi - II (12 Chapters)|
Abhyaswaan Bhav - II (14 Chapters)
Class 10 - Science
Science (13 Chapters)
Class 10 - Social Science
Contemporary India (7 Chapters)|
Democratic Politics (5 Chapters)|
India and the Contemporary World - II (5 Chapters)|
Understanding Economic Development (5 Chapters)
Class 10 - Urdu
Nawa-e-urdu (15 Chapters)

Class 11

Class 11 - Accountancy
Accountancy - II (2 Chapters)|
Financial Accounting - I (7 Chapters)
Class 11 - Biology
Biology (19 Chapters)
Class 11 - Biotechnology
Biotechnology (12 Chapters)
Class 11 - Business Studies
Business Studies (11 Chapters)
Class 11 - Chemistry
Chemistry Part - I (6 Chapters)|
Chemistry Part - II (3 Chapters)
Class 11 - Computer Science
Computer Science (11 Chapters)
Class 11 - Creative Writing and Translation
Srijan (4 Chapters)
Class 11 - Economics
Statistics for Economics (8 Chapters)|
Indian Economic Development (8 Chapters)
Class 11 - English
Hornbill (11 Chapters)|
Snapshots (5 Chapters)|
Woven Words (27 Chapters)
Class 11 - Fine Art
An Introduction to Indian Art Part - I (8 Chapters)
Class 11 - Geography
Fundamentals of Physical Geography (14 Chapters)|
India Physical Environment (6 Chapters)|
Practical Work in Geography (6 Chapters)
Class 11 - Health and Physical Education
Health and Physical Education (11 Chapters)
Class 11 - History
Themes in World History (13 Chapters)
Class 11 - Home Science
Human Ecology and Family Sciences - I (7 Chapters)|
Human Ecology and Family Sciences - II (4 Chapters)
Class 11 - Informatics Practices
Informatics Practices (8 Chapters)
Class 11 - Knowledge Traditions Practices of India
Knowledge Traditions Practices of India (9 Chapters)
Class 11 - Mathematics
Mathematics (14 Chapters)
Class 11 - Physics
Physics Part - I (7 Chapters)|
Physics Part - II (7 Chapters)
Class 11 - Political Science
Indian Constitution at Work (10 Chapters)|
Political Theory (8 Chapters)
Class 11 - Psychology
Introduction to Psychology (8 Chapters)
Class 11 - Sangeet
Tabla evam Pakhawaj (8 Chapters)|
Hindustani Sangeet Gayan Evam Vadan (10 Chapters)
Class 11 - Sociology
Understanding Society (5 Chapters)|
Introducing Sociology (5 Chapters)

Class 12

Class 12 - Accountancy
Accountancy Part - I (4 Chapters)|
Accountancy Part - II (6 Chapters)
Class 12 - Biology
Biology (13 Chapters)
Class 12 - Biotechnology
Biotechnology (13 Chapters)
Class 12 - Business Studies
Business Studies - II (3 Chapters)|
Business Studies - I (8 Chapters)
Class 12 - Chemistry
Chemistry - II (5 Chapters)|
Chemistry - I (5 Chapters)
Class 12 - Computer Science
Computer Science (13 Chapters)
Class 12 - Economics
Introductory Microeconomics (5 Chapters)|
Introductory Macroeconomics (6 Chapters)
Class 12 - English
Flamingo (14 Chapters)|
Vistas (7 Chapters)|
Kaliedoscope (21 Chapters)
Class 12 - Fine Art
An Introduction to Indian Art Part - II (8 Chapters)
Class 12 - Geography
Practical Work in Geography - Part II (4 Chapters)|
Fundamentals of Human Geography (8 Chapters)|
India - People and Economy (9 Chapters)
Class 12 - Hindi
Aroh (15 Chapters)|
Antra (23 Chapters)|
Antral Bhag - II (3 Chapters)|
Vitan (3 Chapters)
Class 12 - History
Themes in Indian History - III (4 Chapters)|
Themes in Indian History - I (4 Chapters)|
Themes in Indian History - II (4 Chapters)
Class 12 - Home Science
Human Ecology and Family Sciences Part I (7 Chapters)|
Human Ecology and Family Sciences Part II (7 Chapters)
Class 12 - Informatics Practices
Informatics Practices (7 Chapters)
Class 12 - Mathematics
Mathematics Part - I (6 Chapters)|
Mathematics Part - II (7 Chapters)
Class 12 - Physics
Physics Part - I (8 Chapters)|
Physics Part - II (6 Chapters)
Class 12 - Political Science
Politics in India Since Independence (8 Chapters)|
Contemporary World Politics (7 Chapters)
Class 12 - Psychology
Psychology (7 Chapters)
Class 12 - Sangeet
Hindustani Sangeet Gayan Evam Vadan (9 Chapters)|
Tabla evam Pakhawaj (7 Chapters)
Class 12 - Sociology
Social Change and Development in India (8 Chapters)|
Indian Society (7 Chapters)

About Edzy - Gamified Learning Platform

Edzy is India's premier gamified AI tutor platform for CBSE and State Board students in classes 6-12. Our platform transforms traditional studying with AI-powered study plans, interactive practice sessions, and personalized learning pathways. Students using Edzy experience unmatched learning efficiency through our immersive educational environment that combines advanced technology with curriculum-aligned content.

Why Choose Edzy for CBSE and State Board Preparation

Edzy offers an adaptive AI educational experience tailored to each student's learning style and pace. We integrate gamification with proven educational strategies to create an engaging environment that students love. Our micro-content approach breaks down complex CBSE and State Board topics into manageable lessons, building confidence through mastery-based progression and real-time feedback.

CBSE and State Board Focus Areas

Edzy specializes in transforming online education for classes 6-12 with AI-powered tutoring. We provide comprehensive NCERT-aligned content and engaging lessons across Mathematics, Science, English, Social Studies, and IT. Our system helps students master fundamental concepts and excel in board exams through AI-generated study plans, personalized learning timelines, and dynamic practice sessions.

Edzy's Unique Approach to Online Learning

Unlike traditional online coaching platforms, Edzy converts CBSE and State Board syllabus content into interactive learning adventures. Our AI tutor provides timely assistance while adapting to student progress. The platform features instant feedback, gamified practice sessions, and achievement badges to motivate continuous learning and concept mastery.

Brand Logo

Edzy | Largest Online Learning Platform for Classes 6–12

Study smarter with Edzy – India’s leading gamified AI tutor for CBSE and State Boards. Designed for Classes 6–12, Edzy offers interactive lessons, AI-powered study plans, and rewarding practice tools for every subject.

Find us on Social Media

Links

About EdzyFAQsContact UsCBSE CoursesDuelsRumblesEdzy App

Parents & Teachers

Search EdzyParent DashboardCreator PlatformEducation BlogCBSE & NCERT News

Policies

Terms and ConditionsRefund PolicyPrivacy PolicyCookie Policy

© 2026 Edzy | Largest Online Learning Platform for Classes 6–12. All rights reserved.

Edzy is an AI tutor for CBSE and State Board students, offering interactive lessons and personalized learning for Classes 6–12.

SitemapNews SitemapBlog SitemapSchool SitemapAccessibility
CBSE
Class 12
Computer Science
Computer Science
File Handling in Python

Question Bank

Question Bank: File Handling in Python

This chapter covers file handling in Python, including how to open, read, write, and manage text and binary files. Understanding file handling is crucial for data storage and manipulation in programming.

Question Bank - File Handling in Python

View all (86)
Q1.

What is the purpose of a file in Python?

Single Answer MCQ
Q-00094639
Q2.

Which of the following is an example of a text file?

Single Answer MCQ
Q-00094640
Q3.

What character typically indicates the end of a line in a text file in Python?

Single Answer MCQ
Q-00094641
Q4.

What types of characters are stored in a binary file?

Single Answer MCQ
Q-00094642
Q5.

Which of the following extensions corresponds to a text file?

Single Answer MCQ
Q-00094643
Q6.

Which of the following best describes how data is stored in files?

Single Answer MCQ
Q-00094644
Q7.

What function is used in Python to open a file?

Single Answer MCQ
Q-00094645
Q8.

What mode should you use to write to an existing file without deleting its contents?

Single Answer MCQ
Q-00094646
Q9.

What happens if you try to open a file that does not exist in read mode?

Single Answer MCQ
Q-00094647
Q10.

When saving a text file, which encoding is commonly used?

Single Answer MCQ
Q-00094648
Q11.

In Python, how can you read the entire content of a file?

Single Answer MCQ
Q-00094649
Q12.

What is the function of the close() method in file handling?

Single Answer MCQ
Q-00094650
Q13.

What module is used for handling object serialization in Python?

Single Answer MCQ
Q-00094651
Q14.

In the context of text files, what does EOL stand for?

Single Answer MCQ
Q-00094652
Q15.

If a text file contains the string 'Hello World' followed by a newline character, how many bytes does it contain?

Single Answer MCQ
Q-00094653
Q16.

What is the primary difference between text files and binary files?

Single Answer MCQ
Q-00094654
Q17.

Which of the following defines a text file?

Single Answer MCQ
Q-00094670
Q18.

What character typically indicates the end of a line in a text file?

Single Answer MCQ
Q-00094671
Q19.

Which of the following file extensions typically indicates a binary file?

Single Answer MCQ
Q-00094672
Q20.

Why are binary files not human-readable?

Single Answer MCQ
Q-00094673
Q21.

Which function is used in Python to open files?

Single Answer MCQ
Q-00094674
Q22.

What distinguishes a text file from a binary file in terms of content?

Single Answer MCQ
Q-00094675
Q23.

If you attempt to open a non-existent file in write mode using Python, what happens?

Single Answer MCQ
Q-00094676
Q24.

What type of data do CSV files typically store?

Single Answer MCQ
Q-00094677
Q25.

When using the open() function in Python, what does the 'r' mode signify?

Single Answer MCQ
Q-00094678
Q26.

What would happen if you try to read from an unopened text file using Python?

Single Answer MCQ
Q-00094679
Q27.

What is the main difference between a .py file and a .txt file?

Single Answer MCQ
Q-00094680
Q28.

Which character is typically used to denote the end of a record in text files?

Single Answer MCQ
Q-00094681
Q29.

In terms of complexity, how do binary files typically manage errors compared to text files?

Single Answer MCQ
Q-00094682
Q30.

Which of the following statements about file handling in Python is correct?

Single Answer MCQ
Q-00094683
Q31.

Which mode must be used to completely overwrite a text file when writing?

Single Answer MCQ
Q-00094684
Q32.

What method is used to write multiple lines of text to a file in Python?

Single Answer MCQ
Q-00094685
Q33.

In Python, which statement correctly opens a file called 'data.txt' in write mode?

Single Answer MCQ
Q-00094686
Q34.

Which of the following is a reason to use the 'with' statement when handling files?

Single Answer MCQ
Q-00094687
Q35.

What will be the result of running the following code: 'myfile.write(42)' without converting 42 to a string?

Single Answer MCQ
Q-00094688
Q36.

Which method would you use to get the number of characters written to a file by the write() function?

Single Answer MCQ
Q-00094689
Q37.

What is the outcome of opening a file in write mode if the file already contains data?

Single Answer MCQ
Q-00094690
Q38.

How do you write a single string followed by a newline character to a file using the write method?

Single Answer MCQ
Q-00094691
Q39.

If you want to ensure data is not only written but also immediately flushed to the file, which method is essential?

Single Answer MCQ
Q-00094692
Q40.

Which is a necessary step after writing to a file?

Single Answer MCQ
Q-00094693
Q41.

What happens if you attempt to write to a closed file?

Single Answer MCQ
Q-00094694
Q42.

Which of these functions can help convert a number to a string before writing to a text file?

Single Answer MCQ
Q-00094695
Q43.

Which of the following statements is true about the append mode for files?

Single Answer MCQ
Q-00094696
Q44.

When using the write() method, what must be included after the string to ensure proper formatting in a text file?

Single Answer MCQ
Q-00094697
Q45.

What does the tell() method in Python's file handling return?

Single Answer MCQ
Q-00094698
Q46.

If a file object is currently at byte position 10, what will file_object.seek(5) do?

Single Answer MCQ
Q-00094699
Q47.

What is the default reference point for the seek() function?

Single Answer MCQ
Q-00094700
Q48.

What will file_object.seek(0, 1) do?

Single Answer MCQ
Q-00094701
Q49.

How does seek() work with EOL characters in text files?

Single Answer MCQ
Q-00094702
Q50.

What is the result of file_object.seek(2, 2) if the file is 5 bytes long?

Single Answer MCQ
Q-00094703
Q51.

What is the appropriate syntax for seeking to byte 10 in a file?

Single Answer MCQ
Q-00094704
Q52.

Which file mode allows both reading and writing to a file in Python?

Single Answer MCQ
Q-00094705
Q53.

If you want to read from a specific byte in a file, which combination of functions would typically be used?

Single Answer MCQ
Q-00094706
Q54.

Which of the following is true about the seek() method?

Single Answer MCQ
Q-00094707
Q55.

If the file pointer is at the end of the file, what will file_object.seek(-1, 2) do?

Single Answer MCQ
Q-00094708
Q56.

In what scenario would using tell() after seek() provide different results?

Single Answer MCQ
Q-00094709
Q57.

What happens if you use the seek() method to position the pointer beyond the file size?

Single Answer MCQ
Q-00094710
Q58.

What is the purpose of the 'open()' function in file handling?

Single Answer MCQ
Q-00094711
Q59.

Which mode should be used with 'open()' to append data to an existing file?

Single Answer MCQ
Q-00094712
Q60.

What does the 'readline()' function do?

Single Answer MCQ
Q-00094713
Q61.

If a file is opened using 'open('file.txt', 'w')', what happens if 'file.txt' already exists?

Single Answer MCQ
Q-00094714
Q62.

In Python, what function would you use to move to the beginning of a file?

Single Answer MCQ
Q-00094715
Q63.

What is the effect of calling 'file.close()'?

Single Answer MCQ
Q-00094716
Q64.

How can you read all lines from a text file with a single command?

Single Answer MCQ
Q-00094717
Q65.

What happens when you use 'open('file.txt', 'x')'?

Single Answer MCQ
Q-00094718
Q66.

Which of the following is a valid way to write 'Hello World' to a file named 'greet.txt'?

Single Answer MCQ
Q-00094719
Q67.

In Python, how can you check the current position of the file cursor?

Single Answer MCQ
Q-00094720
Q68.

Which method is used to reset the file pointer to the end of the currently opened file?

Single Answer MCQ
Q-00094721
Q69.

What happens to the data in a file if you open it in both 'r+' and 'w+' mode consecutively?

Single Answer MCQ
Q-00094722
Q70.

What is the default file mode when using 'open()'?

Single Answer MCQ
Q-00094723
Q71.

When reading from a binary file, which method should be used?

Single Answer MCQ
Q-00094724
Q72.

Which function would you use to ensure your file is closed automatically after operations are completed?

Single Answer MCQ
Q-00094725
Q73.

What does the pickle module in Python primarily do?

Single Answer MCQ
Q-00094741
Q74.

Which two methods are primarily used in the pickle module?

Single Answer MCQ
Q-00094742
Q75.

When using the dump() method, how should the file be opened?

Single Answer MCQ
Q-00094743
Q76.

What is the result of the load() method?

Single Answer MCQ
Q-00094744
Q77.

Which statement about pickling is incorrect?

Single Answer MCQ
Q-00094745
Q78.

What do you need to do before using the pickle module?

Single Answer MCQ
Q-00094746
Q79.

What is the purpose of binary mode in files when using pickle?

Single Answer MCQ
Q-00094747
Q80.

In the context of the pickle module, what does 'serializing' mean?

Single Answer MCQ
Q-00094748
Q81.

When unpickling, which file mode must be used?

Single Answer MCQ
Q-00094749
Q82.

Which of the following is a correct syntax for the load() method?

Single Answer MCQ
Q-00094750
Q83.

Pickling can be described as which of the following processes?

Single Answer MCQ
Q-00094751
Q84.

Which of the following is NOT a valid use case for the pickle module?

Single Answer MCQ
Q-00094752
Q85.

Which of the following will occur if you try to load from a file that has not been properly pickled?

Single Answer MCQ
Q-00094753
Q86.

What will the following code output? 'print(pickle.load(open("mybinary.dat", "rb")))'

Single Answer MCQ
Q-00094754

🔔 Smart Study Reminders

Edzy knows what to study next. Stay on track with timely nudges & updates.

Edzy mobile app