CSL-101 Computer Programming (Assignment – 4) solved

$40.00 $24.00



5/5 - (1 vote)

Q.1 Write a C program to find whether any vowel is present (yes/no) in a given character
Q.2 Write a program which reads integers from user and stores the odd integer in file
called “odd.txt” and even integers in the file called “even.txt”. Also display the
contents of odd and even file at the end.
Q.3 Write a program to change the alphabets in a file in the following manner. Replace
each alphabet with the succeeding one i.e., A with B, B with C, …, Z with A.
Note: Use “r+” mode, which is read and update.
Q.4 Write a program to print the text of file on screen by printing the text line by line and
displaying the line numbers before the text in each line.
Q.5 Write a program to count the number of lower case, upper case, numbers, and special
characters present in a file.
Q.6 Write a program to compare two files to check whether they are identical or not.
Q.7 Assume that there are two files-Names1 and Names2 that stores sorted names (each
name on newline) of students who would be participating in Activity1 and Activity2,
respectively. Create a file NAMES.TXT which stores the names from both files. Note
that there should be no repetition of names in NAMES.TXT and while writing name
into it, ensure that they are sorted.
Q.8 In Q.7, if the two files contain sorted numbers, write a program to create a third file
having integers from both the files in sorted order. In other words, merge the sorted
numbers given from two files in a third file so that the numbers in third file remain
sorted. The numbers could be in single line or every number on a new line. (The order
doesn’t matter)
Q.9 Write a program to create a file that stores only integers. Append the sum of these
integers at the end of the file.
NOTE: To open a file in append mode, fp = fopen (“test.txt”, “a”). This ensures that
the new data is appended at the end of the existing data and not overwritten onto it.
Q.10 A file with a line of English text will be given, where words are separated by one of
the following symbols: ‘ ’, ‘\t’, ‘.’, ‘,’ and ‘;’. Each word may be separated from the
next and the previous by one or more of the given symbols. You have to count the
number of words in the sentence. For example, input = in fact; the punctuation need
not be proper. one more sentence, output = 11.