QBASIC SLC COMPUTER SCIENCE FILE HANDLING SLC 2064, SLC 2065, SLC 2066



1.       Write a program in QBASIC to open a sequential data file “EMP.DAT”, which contains employees records: Name, address and phone number and display all the records as well as total number of records stored in the file. [SLC 2064]
OPEN “EMP.DAT” FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
INPUT #1,N$,A$,P#
C=C+1
PRINT N$,A$,P#
WEND
PRINT “TOTAL NUMBER OF RECORDS=”;C
CLOSE#1
END

2.       Write a program to store records regarding the information of Book number, Book’s name and Write’s name in a sequential data file called “Library.dat”. [SLC 2065]
OPEN “Library.dat” FOR OUTPUT AS #1
DO
CLS
INPUT “ENTER BOOK’S NUMBER”;BN
INPUT “ENTER BOOK’S NAME”;BN$
WRITE #1, BN, BN$
INPUT “DO YOU WANT TO CONTINUE(Y/N)”;CH$
LOOP WHILE UCASE$(CH$)=”Y”
CLOSE#1
END

3.       Write a program to create a sequential data file “Employee.Dat” to store employees’ name, address, age, gender and salary. [SLC 2066]

OPEN “Employee.dat” FOR OUTPUT AS #1
DO
CLS
INPUT “ENTER EMPLOYEE’S NAME”;N$
INPUT “ENTER EMPLOYEE’S ADDRESS”;A$
INPUT “ENTER AGE”;A
INPUT “ENTER GENDER”;G$
INPUT “ENTER SALARY”;S
WRITE #1, N$,A$,A,G$,S
INPUT “DO YOU WANT TO CONTINUE(Y/N)”;CH$
LOOP WHILE UCASE$(CH$)=”Y”
CLOSE#1
END

Comments

Popular posts from this blog

PROGRAM TO FIND SQUARE, CUBE, SQUARE ROOT AND CUBE ROOT OF GIVEN NUMBER

PALINDROME AND ARMSTRONG PROGRAMS

PROGRAM TO DISPLAY SUM, PRODUCT, DIFFERENCE AND PRODUCT OF TWO / THREE NUMBERS