SEESathi
HomeSubjectsPast PapersMock TestSavedSearch
SEESathi

Empowering every Class 10 student across Nepal with world-class, beautifully structured study notes and solved questions.

Study

  • Master Notes
  • Question Bank
  • Past Papers

Subjects

  • Science & Technology
  • English
  • नेपाली
  • Social Studies
  • Computer Science
  • Mathematics

Resources

  • SEE Grading Guide
  • Syllabus Breakdown
  • Topper Answer Sets
  • Mock Test Simulator

Legal

  • About Mission
  • Editorial Board
  • Privacy Policy
  • Terms of Use

© 2026 SEE Sathi Technologies Pvt. Ltd. Kathmandu, Nepal.

Built for every Class 10 student across Nepal

Python — File HandlingSolved Questions· Unit 4
Computer Science · Chapter 04e
23 solved questions

Programming In Python - 4.5 File Handling

Every question in this chapter, answered and explained — step-by-step solutions drawn live from the chapter library across 2 question sections.

Concept in Practice 6 — File Handling and CSV (csv module)18Concept in Practice 7 — File Handling Using pandas5
01

Concept in Practice 6 — File Handling and CSV (csv module)

18
1Textbookcs4-q1

What is the purpose of file handling in Python?

Ans.b) To store data permanently in files
2Textbookcs4-q2

Which Python function is used to open a file?

Ans.b) open()
3Textbookcs4-q3

Which of the following is a type of file operation?

Ans.b) Open a file
4Textbookcs4-q4

Which mode is used to open a file for writing and clears existing contents?

Ans.b) w
5Textbookcs4-q5

What does the 'a' mode do while opening a file?

Ans.b) Appends new data to the end without removing existing data
6Textbookcs4-q6

Which mode is used to open a file for reading only?

Ans.b) r
7Textbookcs4-q7

Which method reads the entire contents of a file?

Ans.a) read()
8Textbookcs4-q8

What does the readline() method do?

Ans.b) Reads one line at a time
9Textbookcs4-q9

Which method is used to write data to a file?

Ans.a) write()
10Textbookcs4-q10

Which function is necessary to close a file after operations?

Ans.b) close()
11Textbookcs4-q11

Which module is used to handle CSV files in Python's standard library?

Ans.b) csv
12Textbookcs4-q12

What does csv.writer() do?

Ans.b) Writes data into a CSV file
13Textbookcs4-q13

In which mode should you open a file to write data using csv.writer()?

Ans.b) w
14Textbookcs4-q14

Which function reads rows from a CSV file as a list of strings?

Ans.b) csv.reader()
15Textbookcs4-q15

In csv.reader(file), what type of object does it return?

Ans.c) An iterable reader object
16Textbookcs4-q16

What will be the output of the following code if the file note.txt contains the text: Hello, Python! (file opened in 'r' mode, read() and print())

Ans.b) It will display Hello, Python!
17Textbookcs4-q17

Which of the following code snippets will write the text 'Welcome to File Handling!' into a file named info.txt and then close it properly?

Ans.d) file = open("info.txt", "w"); file.write("Welcome to File Handling!"); file.close()
18Textbookcs4-q18

Which of the following statements about the write() function in Python is true?

Ans.c) It writes the given string to the file without adding a newline unless specified.
02

Concept in Practice 7 — File Handling Using pandas

5
1Textbookcs5-q1

Which library is most suitable for handling CSV files in Python for structured data operations?

Ans.c) pandas
2Textbookcs5-q2

Which function is used to save a DataFrame into a CSV file?

Ans.c) to_csv()
3Textbookcs5-q3

Which function is used to read a CSV file using Pandas?

Ans.b) read_csv()
4Textbookcs5-q4

What does the parameter index=False in to_csv() do?

Ans.b) Avoids writing row index numbers to the file
5Textbookcs5-q5

Which of the following methods displays the first 5 rows by default from a DataFrame?

Ans.b) head()
Review the NotesBack to Chapter