File Handling - Worksheet - Set 4 - QP
File Handling - Worksheet - Set 4 - QP
4.Write a program to count and display lines starting with letter ‘w’.
5.Write a program to count and display number of words in the file, also print length of
each word.
6.Write a program to count and display the occurrence of word ‘why’ in the file.
12.Write a program to copy the contents of the file ‘poem.txt’ to ‘poem1.txt’ barring the
lines starting with letter ‘b’.
13.Write a code to print just the last line of the file ‘poem.txt’.
14.Write a single loop to display all the contents of file poem.txt after removing leading
and trailing whitespaces.
15.A text file contains alphanumeric text say an.txt. write a program that reads this text
file and prints only the numbers or digits from the file.
18.Your recipe uses some ingredients. write a program to store the list of ingredients in a
binary file.
19.Write a program to increase the salary by Rs. 2000/- of the employee having empno
1251 in the file empl.dat.