You are on page 1of 3

Q1)

A class teacher has kept the records of the marks obtained in Eng1 and
Eng2 of all the students in two different files "ENG1.DAT" and
"ENG2.DAT" along with their names . Write a program to merge both
the files in a single file "ENG.DAT" to keep the record of all the
students with the name , marks obtained in Eng1, Eng2 and the
average marks obtained in Eng1 and Eng2 as per the given format

Name Eng1 EngII Average

abc 78 70 74

def 64 72 68

….. … …. …….

Q2)

An engineering college announces an entrance examination for


admission to three streams ie "COMPUTER SCIENCE", "ELECTRONICS"
and "MECHANICAL" . The codes allotted for these streams are CS,EC,ME
The subjects in which the qualifying examination will be conducted are
Physics, Chemistry, Mathematics and Computer Science . The maximum
marks for each subject is 100 . The following rules will be followed for
the selection

(a) A candidate must score at least 40% marks in each subject to qualify
otherwise disqualified

(b) Different streams will be allotted on the basis of total score of all
the subjects as follows
Total Score Stream Allotted

>=280 CS

>=250 AND <280 EC

>=190 AND <250 ME

Write a program using binary file concept to implement the above


process

Create a binary file "exam.dat" to input and store name of candidate,


application number , scores of physics, chemistry , mathematics and
computer science . Input and store applicant's data into the binary file
till the user does not want to quit .

Read the above created binary file . Find qualified and disqualified
candidates(using the criterion given above ) and then calculate the total
score of each candidate and allot the stream using the codes :CS,EC or
ME using the criteria given above . To make the process little more
simplified the records of successful candidates of different streams
along with the stream codes are stored into other binary files
"comp.dat", "electro.dat" and "mech.dat". The list of waiting
candidates are put in the file "waitlist.dat".

Read all the binary files of different streams to display details of


candidates of each stream. You need not display the list of waiting
candidates .

Q3)

Write a program using text file concept for the following

Create a text file "stock.txt" to input and store N sentences


Read the above text file to read the sentences and print each sentence
and number of words in each sentence . Print the output in two
columns .

Q4)

It is assumed that the binary file "invoice.dat" is already existing with


some product code , quantity and price of various products . Write a
program to update the binary file by adding/appending new records
having product code , quantity and prices of various products till the
user wants .

Q5)

Write a program using binary file concept for the following operations

Create a binary file "info.dat" to store name , pan number , and total
taxable income for various persons till the user wants to store .

Update the binary file "info.dat" by deleting those records whose


taxable income is less than or equal to Rs 100000.

Read the binary file "info.dat" to print all the records after updating
the file .

Q6)

Write a program to create a text file "telephone.txt" to accept the


name, address and telephone number of N number of telephone
holders .Enter a name separately and search it in the given list of
names. If found, print the name ,address and telephone number of the
person otherwise print NAME NOT IN LIST.

You might also like