Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Post Top Ad

Your Ad Spot

Thursday, February 17, 2022

APPEND mode in File Handling

 Solved examples of APPEND mode 

in File Handling


1. Write a program to add few new records in existing data file “record.dat” which has contents student name, class and roll no.

OPEN "record.dat" FOR APPEND AS #1

DO

INPUT "Enter name=";n$

INPUT "Enter class=";c$

INPUT "Enter Roll no=";r

WRITE #1,n$,c$,r

INPUT "Do you need more records to add=";ans$

LOOP WHILE UCASE$(ans$)="Y"

CLOSE #1

         

2. A sequential data file called ‘student.dat’ contains some records under the fields name, English, Nepali and Computer. Write a 3 program to add some more records in the same sequential data file. (SLC 2068)

OPEN “student.dat” FOR APPEND AS #1

TOP:

INPUT “Enter name=”;n$

INPUT “Enter English =”;e

INPUT “Enter Nepali=”;n

INPUT “Enter computer=”;c

WRITE #1, n$,E,N,C

INPUT “Do you want more data=”;Ans$

IF Ans$=”Y” OR Ans$= “y” THEN GOTO top

CLOSE #1

END

 

 3. A sequential  data file “SEE.dat” has contains Students name, Class, and marks in three subjects. WAP to add 15 students in the exiting file.

OPEN “SLC.DAT” FOR APPEND AS #1

FOR I = 1 TO 15

CLS

INPUT “Enter students name”; N$

INPUT “Enter class”; C

INPUT “Enter marks in three subjects”; M1, M2, M3

WRITE #1, N$,C,M1,M2,M3

NEXT I

CLOSE #1

END


Also Read: Arguments in QBASIC using modular programming for class 10 and SEE

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages