Home › AKTU PYQ › Python Programming › PYQ Questions › Unit 4

Python Programming Unit 4 – File Operations & Regular Expressions: AKTU previous year questions

39 AKTU questions from Unit 4 (File Operations & Regular Expressions) asked in 2020–2026, tagged by marks, year and topic. In short: about 21 marks of every paper come from this unit; the most asked topic is File Writing (13 times); 10 questions came back in a later year. The latest ones are listed below; on the page you can filter them by 2-mark or long questions, topic and repeats.

Unit 4 previous year questions

  • What is a file pointer in Python? (2 marks, 2026, File Pointer Manipulation)
  • What are read() and readline() functions in file handling? (2 marks, 2026, File Reading)
  • What is the purpose of the seek() method in file handling? Demonstrate a program that copies content from one file to another. (7 marks, 2026, File Pointer Manipulation)
  • Describe file writing functions: write(), writelines(). Write a program to write student records to a file. (7 marks, 2026, File Writing)
  • Explain manipulating file pointer using seek(). Write a program to read last n lines from a file. (7 marks, 2026, File Pointer Manipulation)
  • What are file operations in Python? Explain the different modes used while opening a file. (7 marks, 2026, File Reading)
  • Write a Python program to create a file and write multiple lines into it. (7 marks, 2026, File Writing)
  • Describe regular expressions using re module. Write a program to find all digits in a string. (7 marks, 2026, Regular Expressions)
  • Explain file handling modes in Python. (7 marks, 2025, File Reading)
  • Write a program to read and write data from a text file. How do readline() and readlines() work? Explain with examples. (7 marks, 2025, File Reading)
  • What is the purpose of the seek() method in file handling? Demonstrate a program that copies content from one file to another. (7 marks, 2025, File Pointer Manipulation)
  • Discuss different types of file modes in Python? Explain with examples. (7 marks, 2025, File Writing)

Most asked Unit 4 topics

  • File Writing – asked 13 times
  • File Reading – asked 10 times
  • Exceptions & Error Handling – asked 8 times

Unit 4 question pattern

  • 2-mark questions: 8 asked in 2020–2026
  • 7-mark questions: 17 asked in 2020–2026
  • 10-mark questions: 6 asked in 2020–2026
  • About 21 marks from Unit 4 in every paper
  • 10 questions were asked again in a later year

Unit 4 questions year by year

  • 2026: 8 Unit 4 questions asked (46 marks across that year's papers)
  • 2025: 9 Unit 4 questions asked (53 marks across that year's papers)
  • 2024: 4 Unit 4 questions asked (28 marks across that year's papers)
  • 2023: 5 Unit 4 questions asked (24 marks across that year's papers)
  • 2022: 6 Unit 4 questions asked (26 marks across that year's papers)
  • 2021: 3 Unit 4 questions asked (14 marks across that year's papers)
  • 2020: 4 Unit 4 questions asked (40 marks across that year's papers)