0% found this document useful (0 votes)
49 views6 pages

2024 08 06 09 54 Solution

Uploaded by

srigurusilks2017
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views6 pages

2024 08 06 09 54 Solution

Uploaded by

srigurusilks2017
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

VELLAMAL BODHI CAMPUS VELLORE

Date : 06-08-2024 STD 12 Science Computer Science Total Marks : 32


worksheet file handling

Section B

* Answer The Following Questions In Short.[2 Marks Each] [32]

1. A text file “Quotes.Txt” has the following data written in it: "Living a life you can
be proud of Doing your best Spending your time with people and activities that
are important to you Standing up for things that are right even when it’s hard
Becoming the best version of you." Write a user defined function to display the
total number of words present in the file.
Ans. :

2. Write a python program to accept a line from the user and store that in a file
“story.txt”.
Ans. :

3. Write a python program to accept the multiple lines from the user and store is
into the file.

Page 1
Ans. :

4. Write the python program using writelines() function to store the following
data:

[Filename: ch4/ch-4_Q10]

Ans. :

5. Write a program to read and display the content of the "multiline.txt".


[Filename: ch4/ch-4_Q11]
Ans. :

6. Write a program to read the content of the file line by line and display.
Assuming that file name is “multiline.txt”.
Ans. :

7. Write a program to Read the content of the file line by line and print without
‘n’. Assuming that file name is “multiline.txt”.

Page 2
Ans. :

8. Write a function countmy( )in Python to read the text file "DATA.TXT" and count
the number of times "my" occurs in the file. For example if the file "DATA.TXT"
contains: "This is my website. I have displayed my preferences in the CHOICE
section." The countmy( ) function should display the output as: "my occurs 2
times".
Ans. :

9. Write a method in Python to read lines from a text file INDIA.TXT, to find and
display the occurrence of the word "India".

Page 3
Ans. :

10. Write a function to count the “me” and “my” in a file “India.txt”.
Ans. :

11. Write a function to count the Upper case vowel in file “All.txt”.
Ans. :

12. Write a function to copy all the upper case words to another file.

Page 4
Ans. :

13. Write a function to display the alternate lines from the file.
Ans. :

14. Write a function to read the content from the file and display each word in
reverse order.
Ans. :

15. Write a function to read the content from the file and print all the upper case
word.

Page 5
Ans. :

16. Write a function to read the content from the file “Story.txt”. The function will
take a string as parameter and search the string into the file.
Ans. :

----- -----

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy