1. Write a program in QBASIC that asks length, breadth and height of room and calculates its area and volume. Create a user-defined function to calculate area and sub-program to calculate volume.
Hint: [A=L x B], [V=L x B x H]. CDC Model Set 2077
Answer:
DECLARE FUNCTION AREA(L,B)
DECLARE SUB VOLUME(L,B,H)
INPUT " Enter L, B and H value ";L,B,H
PRINT " Area is ";AREA(L,B)
CALL VOLUME(L,B,H)
END
FUNCTION AREA(L,B)
AREA = L * B
END FUNCTION
SUB VOLUME(L,B,H)
V = L * B * H
PRINT " Volume is " ;V
END SUB
2. Write a program in QBASIC that asks length, breadth of a room and calculate its area and perimeter. Create a user defined function to calculate area and sub program to calculate perimeter. [Hint: [Area=LxB], [p=2(L+B]] SEE 2078 (2022) Answer: DECLARE FUNCTION AREA(L,B) DECLARE SUB PERI(L,B) INPUT " Enter L and B value ";L,B PRINT " Area is ";AREA(L,B) CALL PERI(L,B) END FUNCTION AREA(L,B) AREA = L * B END FUNCTION SUB PERI(L,B) P = 2 * (L + B) PRINT " Perimeter is " ;P END SUB
3. Write a program in QBASIC that asks radius of a circle to calculate its area and circumference. Create a user-defined function to calculate area and sub-program to calculate circumference. [Hint: A=πr2 C=2πr] SEE 2079 (2023) Answer: DECLARE FUNCTION AREA(R) DECLARE SUB CIR(R) INPUT "Enter r value ";R PRINT " Area is "; AREA(R) CALL CIR(R) END FUNCTION AREA(R) AREA = 3.14 * R ^ 2 END FUNCTION SUB CIR(R) C = 2 * 3.14 * R PRINT "Circumference is ";C END SUB
4. Write a program in QBASIC to calculate total surface area of a cylinder using function procedure and volume using sub procedure. [Area=Total surface area=2ℼr(r+h) and volume=ℼr2h] SEE Pre Qualify 2079 Answer: DECLARE FUNCTION TAS(R,H) DECLARE SUB VOL(R) INPUT "Enter R and H value ";R,H PRINT " Total Surafce Area is "; TSA(R,H) CALL VOL(R,H) END FUNCTION TSA(R,H) TSA = 2 * 3.14 * R * (R + H) END FUNCTION SUB VOL(R,H) V = 3.14 * R ^ 2 * H PRINT "Volume is ";V END SUB 5. Write a program in QBASIC that ask the radius of circle. Write a program to calculate the area and circumference of a circle. Create a user defined function first (r) to calculate area and sub procedure second (r) to calculate circumference of a circle. PABSON Board Exam Set B - 2078 (2022) 6. Write a program in QBASIC that allows user to enter radius of a circle. Create a user defined function to find area of circle and sub procedure to find volume of a cylinder. Hint: [A=πr2, V=πr2h] PABSON Board Exam Set B - 2078 (2022) 7. Write a program in QBASIC to input radius of circle and calculate its area using function and circumference using sub procedure. [Area=pie×r2 and Circumference=2pier]SEE Pre-Qualify 2078 8. Write a program in Q-BASIC that asks length and breadth of a room and calculate its area and perimeter. Create a user-defined FUNCTION to calculate area and SUB program to calculate perimeter. [Hint: A=L×B, P=2(L+B)] GIE Exam Set B - 2079 (2023) 9. Input two numbers and display greater number using function and smaller number using sub procedure. Ans: DECLARE FUNCTION GREAT(A,B) DECLARE SUB SMALL (A,B) INPUT "Enter two numbers: ",A,B PRINT GREAT(A,B) ; "is greater" CALL SMALL(A,B) END FUNCTION GREAT(A,B) IF A>B THEN G = A ELSE G = B END IF GREAT = G END FUNCTION SUB SMALL(A,B) IF A <B THEN PRINT A ; "is samller" ELSE PRINT B ; "is smaller" END IF END SUB
2. Write a program in QBASIC that asks length, breadth of a room and calculate its area and perimeter. Create a user defined function to calculate area and sub program to calculate perimeter. [Hint: [Area=LxB], [p=2(L+B]] SEE 2078 (2022) Answer: DECLARE FUNCTION AREA(L,B) DECLARE SUB PERI(L,B) INPUT " Enter L and B value ";L,B PRINT " Area is ";AREA(L,B) CALL PERI(L,B) END FUNCTION AREA(L,B) AREA = L * B END FUNCTION SUB PERI(L,B) P = 2 * (L + B) PRINT " Perimeter is " ;P END SUB
3. Write a program in QBASIC that asks radius of a circle to calculate its area and circumference. Create a user-defined function to calculate area and sub-program to calculate circumference. [Hint: A=πr2 C=2πr] SEE 2079 (2023) Answer: DECLARE FUNCTION AREA(R) DECLARE SUB CIR(R) INPUT "Enter r value ";R PRINT " Area is "; AREA(R) CALL CIR(R) END FUNCTION AREA(R) AREA = 3.14 * R ^ 2 END FUNCTION SUB CIR(R) C = 2 * 3.14 * R PRINT "Circumference is ";C END SUB
4. Write a program in QBASIC to calculate total surface area of a cylinder using function procedure and volume using sub procedure. [Area=Total surface area=2ℼr(r+h) and volume=ℼr2h] SEE Pre Qualify 2079 Answer: DECLARE FUNCTION TAS(R,H) DECLARE SUB VOL(R) INPUT "Enter R and H value ";R,H PRINT " Total Surafce Area is "; TSA(R,H) CALL VOL(R,H) END FUNCTION TSA(R,H) TSA = 2 * 3.14 * R * (R + H) END FUNCTION SUB VOL(R,H) V = 3.14 * R ^ 2 * H PRINT "Volume is ";V END SUB 5. Write a program in QBASIC that ask the radius of circle. Write a program to calculate the area and circumference of a circle. Create a user defined function first (r) to calculate area and sub procedure second (r) to calculate circumference of a circle. PABSON Board Exam Set B - 2078 (2022) 6. Write a program in QBASIC that allows user to enter radius of a circle. Create a user defined function to find area of circle and sub procedure to find volume of a cylinder. Hint: [A=πr2, V=πr2h] PABSON Board Exam Set B - 2078 (2022) 7. Write a program in QBASIC to input radius of circle and calculate its area using function and circumference using sub procedure. [Area=pie×r2 and Circumference=2pier]SEE Pre-Qualify 2078 8. Write a program in Q-BASIC that asks length and breadth of a room and calculate its area and perimeter. Create a user-defined FUNCTION to calculate area and SUB program to calculate perimeter. [Hint: A=L×B, P=2(L+B)] GIE Exam Set B - 2079 (2023) 9. Input two numbers and display greater number using function and smaller number using sub procedure. Ans: DECLARE FUNCTION GREAT(A,B) DECLARE SUB SMALL (A,B) INPUT "Enter two numbers: ",A,B PRINT GREAT(A,B) ; "is greater" CALL SMALL(A,B) END FUNCTION GREAT(A,B) IF A>B THEN G = A ELSE G = B END IF GREAT = G END FUNCTION SUB SMALL(A,B) IF A <B THEN PRINT A ; "is samller" ELSE PRINT B ; "is smaller" END IF END SUB