0% found this document useful (0 votes)
5 views

Questions Only Additonal Worksheet Text Files

The document outlines a series of tasks for processing a text file named Sample.txt using a function called textFile(). These tasks include counting specific characters, identifying words based on various criteria, and printing lines that meet certain conditions. The tasks also involve creating a new file with specific content based on the original text file's data.

Uploaded by

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

Questions Only Additonal Worksheet Text Files

The document outlines a series of tasks for processing a text file named Sample.txt using a function called textFile(). These tasks include counting specific characters, identifying words based on various criteria, and printing lines that meet certain conditions. The tasks also involve creating a new file with specific content based on the original text file's data.

Uploaded by

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

Text Files –

Additional
Worksheet
Questions
Text file questions:
File Name: Sample.txt
Function name: textFile()

1. Count number of ‘S’ or ‘T’ from a text file.


2. Count number of Vowels, Consonants,
Spaces, Digits and Special characters from
a text file.
3. Print the words that begin vowel.
4. Print the words that begin the H or R.
5. Print the words that begin and end with
the same characters.
6. Print the words that begin and end with
consonant.
7. Print the words that end with a digit.
8. Print the three lettered words from a file.
9. Print the word that has the letter e in it.
10.Print the words that has more than 5
characters in it.
11.Print the words that has more than 2 ‘t’
letters in it.
12.Count the number of words present in the
file.
13.Count the words that begin the K or ‘k’.
14.Count the number of ‘this’ present in a
file. (THIS, THis, tHIS, all possible
combination to be included)
15.Print the lines that begin with the letter T
or W.
16.Print the lines that begin and end with
same letter.
17.Print the lines that begin with the word
‘The’.(‘THE’, ‘THe’, ‘ThE’, all possible
combination to be included)
18.Print the lines that has more than 10
words in it.
19.Print the lines that has the characters ‘he’
in it. (‘he’ can be a separate word or can be
a part of word)
20.Print the lines that has the word ‘from’ in
it.(from, FROM, FroM, all possible
combination to be included)
21.Count the number of lines present in a file.
22.Count the number of characters present in
each line of the file.
23.Count the number of words present in
each line of the file.
24.Count the number of ‘e’ present in each
line.
25.Count the number of ‘the’ words present
in each line.
26.Print the words that doesn’t have any
vowels in it.
27.Print the lines that has more than 2 ‘is’
word in it.
28.Print the lines that has more than 3 four
lettered words.
29.Copy the lines that has the word ‘that’ in it
to a new file named “thatword.txt’.

You might also like