Skip to main content

17 QBASIC Programming


1. Create a sequential file "std.dat" to store name and marks obtained in English, Math and Science subjects for a few students. (74 set 1)
OPEN  “std.dat”  FOR OUTPUT  AS  #1
DO
CLS
INPUT “Enter name “; N$
INPUT  “Enter English marks”; E
INPUT “Enter Math's marks"; M
INPUT "Enter Science marks"; S
WRITE #1, N$, E, M, S
INPUT "Do you want to continue (Y/N)";CH$
LOOP WHILE UCASE$ (CH$) "Y"
CLOSE #1
END

4. WAP to add some more  records in a data file “ABC.DAT” having following fields : patient’s name, address and age. 
OPEN  “ABC.DAT”  FOR OUTPUT  AS  #1
DO
CLS
INPUT “Enter Patients name “; N$
INPUT  “Enter patients address”; A$
INPUT “Enter Patient's age "; A
WRITE #1, N$, A$, A
INPUT "Do you want to continue (Y/N)";CH$
LOOP WHILE CH$="Y" OR CH$="y"
CLOSE #1
END
 
 
 

6.WAP to store records regarding the information of book’s number, name and author’s name in a sequential data file named “Library.dat”.
OPEN  “ABC.DAT”  FOR OUTPUT  AS  #1
DO
CLS
INPUT “Enter book's number “; N
INPUT  “Enter book's name ”; B$
INPUT “Enter author's name "; A$
WRITE #1, N, B$, A$
INPUT "Do you want to continue (Y/N)";CH$
LOOP WHILE CH$="Y" OR CH$="y"
CLOSE #1

END   


7. A sequential data file called “MARKS.DAT” contains roll no, name, English, Nepali, and math field. WAP to display all the contents of the data file.

OPEN  “MARKS.DAT”  FOR  INPUT  AS  #1
CLS
WRITE NOT EOF (1)
INPUT  #1, R, N$, E,N, M
PRINT   R, N$, E, N, M
WEN D
CLOSE #1
END
8. WAP to create a sequential data file “Employee.dat” to store employee’s name, address, age, gender and salary.
OPEN  “Employee.dat”  FOR OUTPUT  AS  #1
TOP:
DO
CLS
INPUT “Enter name “; N$
INPUT  “Enter 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"  THEN GOTO TOP
CLOSE #1
END


9. A data file “LIB.TXT” contains Book’s name, author’s name and price of books. WAP to count and display total number of record present in a file.
OPEN  "LIB.TXT FOR  INPUT  AS  #1
CLS
WHILE NOT EOF (1)
INPUT  #1,B$, A$, P
C=C+1
WEND
CLOSE #1
PRINT "Total number of record="; C
END
10.A sequential data file “EMP.DAT” contains name, post and salary fields. WAP to display all the information of employees along with tax amount i.e. 15% of salary.
OPEN  “EMP.DAT”  FOR  INPUT  AS  #1
CLS
WHILE NOT EOF  (1)
INPUT #1, N$, P$, S, T
T=15/100*S
PRINT N$, P$, S,T
WEND
CLOSE #1
END


11. A sequential data file called “MARKS.DAT” contains roll no, name, English, nepali and maths fields. WAP to display all the contents of the data file.
OPEN  “MARKS.DAT”  FOR  INPUT  AS  #1
CLS
WHILE NOT EOF  (1)
INPUT #1, RN, N$, E, N, M
PRINT  RN, N$, E, N, M
WEND
CLOSE #1
END

12.   A sequential data file called “student.dat” contains record under the fields name, English , nepali and computer. WAP to add some more records in the same sequential data file.
OPEN  “student.dat”  FOR  INPUT  AS  #1
CLS
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 to continue "; CH$
IF UCASE(CH$) = "Y" THEN GOTO TOP
CLOSE #1
END



13. WAP to view those records from “Employee.dat” sequential data file having employee’s name, department, appointment data and salary whose salary is more than RS. 5000.
OPEN  "Employee.dat”  FOR  INPUT  AS  #1CLS
WHILE NOT EOF  (1)
INPUT #1,  N$, D$, A$, s
IF S>5000 THEN PRINT   N$, D$, A$, s
WEND
CLOSE #1
END



14. WAP to create a data file “teldir.dat” to store name, address and telephone number of employee’s according to the need of the user.
OPEN  “teldir.dat”  FOR OUTPUT  AS  #1
DO
CLS
INPUT “Enter name “; N$
INPUT  “Enter ADDRESS"; A$
INPUT “Enter telephone number ";T
WRITE #1, N$, A$, T
INPUT "Do you want to continue (Y/N)";CH$
LOOP WHILE UCASE$ (CH$) ="Y" 
CLOSE #1
END



15.A sequential data file “marks.dat” contains name, English , Nepali, Math and science fields. WAP to display all contents of data file.



OPEN  “marks.dat”  FOR INPUT  AS  #1
CLS
PRINT "Name", "English", "Nepali", "Maths", "Science"
WHILE NOT EOF (1)
INPUT #1, N$, E, N, M, S
PRINT N$, E, N, M, S
WEND
CLOSE #1
END




16.A data file “Salary.dat” contains the information of employee regarding their name, post and salary. WAP to display all the information of employee whose salary is greater than 15000 and less than 40000.
OPEN  “salary.dat”  FOR INPUT  AS  #1
CLS
PRINT "Name", "Post", "Salary"
WHILE NOT EOF (1)
INPUT #1, N$, P$, S
IF S<40000 AND S>15000 THEN PRINT N$, P$, S
WEND
CLOSE #1
END



17.A sequential data file called ‘marks.dat’ contains name, age, city and telephone fields. WAP to display all the records of that file.
OPEN  “marks.dat”  FOR INPUT  AS  #1
CLS
PRINT "Name", "Age", "City", "Telephone"
WHILE NOT EOF (1)
INPUT #1, N$, A, C$, T
PRINT N$, A, C$, T
WEND
CLOSE #1
END





  


Comments

Popular posts from this blog

QBASIC Solutions

Q.1) WAP to change degree Celsius into degree Fahrenheit.   => CLS        INPUT "Enter degree celsius value" ; D        F = ( 9 * C / 5 ) + 32        PRINT "Degree Fahrenheit value = "; F        END Q.2) WAP to change dollar into Nepali currency.   => CLS       INPUT "Enter Dollar value"; USD        NRS = USD * 100       PRINT "Nepali currency value = "; NRS       END Q.3) WAP to change Indian currency into Nepali currency. => CLS                   INPUT "Enter Indian currency value"; IC       NRS = IC * 1.6        PRINT "Nepali currency value = "; NRS   ...
MOTHER'S DAY Mother's Day  is a celebration honoring the mother  of the family, as well as motherhood, maternal bonds, and the influence of mothers in society. It is celebrated on various days in many parts of the world, most commonly in the months of March  or May .  MOTHER'S DAY is complements similar celebrations honoring family members, such as Father's day  and Siblings day . Mother's day is the most special day for a mom. This is the day the children's show there love to there mom. The mom always waits for this day.  In Nepal it is known as amma ko mukh herne din.  My mother is the most important person in my life. She always cares about me. She is the most caring and loving mom in the world. my mother's name is Sunita Dangol. She is thirty-eight years old. She gave birth to me. She taught me to walk. She sent me school so that, I can do better. It's always have been my dream to make my mother  be proud for my go...