SET-8
11. Rewrite the following program after correcting the bugs.
DECLARE SUB Series(.)
DLC
EXECUTE Series
END
SUB Series
REM to generate 2 2 4 6 10….. upto 10th term
P=2
Q=2
FOR Ctr=1 TO 5
DISPLAY P,Q,
P=P+Q
Q=P+Q
WEND
END Series()
Ans: Correct program
DECLARE SUB Series(.)
DLC
CALL Series
END
SUB Series
REM to generate 2 2 4 6 10….. upto 10th term
P=2
Q=2
FOR Ctr=1 TO 5
PRINT P,Q,
P=P+Q
Q=P+Q
NEXT ctr
END SUB
12. Write the output of the following program. 2
DECLARE FUNCTION AREA(L,B)
LET L=10
LET B=5
PRINT “The area=”;AREA(L,B)
END
FUNCTION AREA(L,B)
A=L*B
AREA=A
END FUNCTION
Ans: Output
The area= 50
13. Study the following program and answer the questions: 2
DECLARE FUNCTION Sum(A,B)
INPUT “Enter first number:”; A
INPUT “Enter second number:”; B
PRINT “The sum of the two number=”;Sum(A,B)
END
FUNCTION SUM(A,B)
S=A+B
Sum=S
END FUNCTION
a) List the numerical variables used in the above program.
Ans: The numerical variables used in the above program are A, B and S.
b) Will the program run if the first line (i.e. DECLARE….) is deleted?
Ans: Yes, the program will run if the first line (i.e. DECLARE……) is deleted.
11. Rewrite the following program after correcting the bugs.
DECLARE SUB Series(.)
DLC
EXECUTE Series
END
SUB Series
REM to generate 2 2 4 6 10….. upto 10th term
P=2
Q=2
FOR Ctr=1 TO 5
DISPLAY P,Q,
P=P+Q
Q=P+Q
WEND
END Series()
Ans: Correct program
DECLARE SUB Series(.)
DLC
CALL Series
END
SUB Series
REM to generate 2 2 4 6 10….. upto 10th term
P=2
Q=2
FOR Ctr=1 TO 5
PRINT P,Q,
P=P+Q
Q=P+Q
NEXT ctr
END SUB
12. Write the output of the following program. 2
DECLARE FUNCTION AREA(L,B)
LET L=10
LET B=5
PRINT “The area=”;AREA(L,B)
END
FUNCTION AREA(L,B)
A=L*B
AREA=A
END FUNCTION
Ans: Output
The area= 50
13. Study the following program and answer the questions: 2
DECLARE FUNCTION Sum(A,B)
INPUT “Enter first number:”; A
INPUT “Enter second number:”; B
PRINT “The sum of the two number=”;Sum(A,B)
END
FUNCTION SUM(A,B)
S=A+B
Sum=S
END FUNCTION
a) List the numerical variables used in the above program.
Ans: The numerical variables used in the above program are A, B and S.
b) Will the program run if the first line (i.e. DECLARE….) is deleted?
Ans: Yes, the program will run if the first line (i.e. DECLARE……) is deleted.
No comments:
Post a Comment