Questions

2 Marks Each

🎯

Test yourself on this topic

16 questions · timed · auto-graded

Question 12 Marks
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.
View full question & answer
Question 82 Marks
Write a method in Python to read lines from a text file INDIA.TXT, to find and display the occurrence of the word "India".

View full question & answer
Question 92 Marks
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".
View full question & answer
Question 102 Marks
Write a program to Read the content of the file line by line and print without ‘n’. Assuming that file name is “multiline.txt”. 
View full question & answer
Question 112 Marks
Write a program to read the content of the file line by line and display. Assuming that file name is “multiline.txt”. 
View full question & answer
Question 132 Marks
Write the python program using writelines() function to store the following data:

[Filename: ch4/ch-4_Q10]

View full question & answer
Question 162 Marks
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.
View full question & answer
2 Marks Each - Computer Science STD 12 Commerce Questions - Vidyadip