Wednesday, September 27, 2017

[SEE QBASIC PROGRAM PRACTICE 2074] Download 300 Qbasic Programming Questions + 300 Qbasic Programs [Output(100), Debug(100) and Analytical Questions(100)]



SEE Qbasic Practice 2074

Download 300 Qbasic Programming Questions + 300 Qbasic Programs [Output(100), Debug(100) and Analytical Questions(100)] and 100 Theory Qbasic Modular Programming, File Handling and C Language Questions.


[Total 700 Questions Collections]

  1. Click here to download 100  Qbasic Debugging Questions

  1. Click here to download 100  Qbasic Output Questions

  1. Click here to download 100  Qbasic Analytical Questions

  1. Click here to download 300  Qbasic Programming Questions

  1. Click here to download 100 Theory Qbasic Modular Programming, File Handling and C Language Questions

Analytical Questions Qbasic Programs [SEE Qbasic Practice PART IV]

1.      DECLARE FUNCTION EVE(A)
CLS
FOR I=1 TO 10
READ E    
B=B+EVE(E)
NEXT  I
PRINT "NUMBER OF EVEN NUMBERS =";B
DATA 3, 4, 2, 5, 22, 33, 67, 76, 88, 65,
END

FUNCTION EVE(M)
C=M MOD 2
IF C= 0 THEN
D=1
ELSE
D=0
ENDIF
EVE=D
END FUNCTION

i.List out the different types of parameters used in the program.
ii.How many times the function module will be called?

2.      DECLARE FUNCTION KAT(N())
CLS
DIM AR(4)
FOR I=1 TO 4
READ AR(I)
NEXT
PRINT KAT(AR(I))
DATA 2,1,0,4        
END

FUNCTION KAT(N())
FOR I=1 TO 4
S=S+N(I)
NEXT
KAT=S
END FUNCTION

i.What is the return type of the function?
ii.Which line returns value to the calling module?

3.      DECLARE FUNCTION CELLS$(W$)
W$=”CYBER”
PRINT CELL$(W$)
END

FUNCTION CELL$(W$)
K=LEN(W$)
FOR I = K TO 1 STEP -2
M$=M$+MID$(W$,I,1)
NEXT I
CELLS$=M$
END FUNCTION

i.Why is $(dollar) sign followed in the function name?
ii.What will be the output of the program when it is executed?


4.      DECLARE SUB ANALYTICAL()
CLS
CALL ANALYTICAL
END
SUB ANALYTICAL
FOR I = 5 TO 1 STEP -1
FOR J = I TO 5
PRINT J;
NEXT
PRINT
NEXT
 END SUB

a) Find the value of J in the 2nd execution of outer loop and the 1st execution of the inner loop.
b) Find the out of the above program if we change outer loop as FOR I=1 To 5.

5.      DECLARE SUB SUM (N)
INPUT”ANY NUMBERS”; N
CALL SUM (N)
END

SUB SUM (N)
S=0
WHILE N<>0
R= N MOD 10
S=S-R
N=N\10
WEND
PRINT”SUM”;S
END SUB

i.Why MOD operator is used in the program? Write down its necessity?
ii.Will the output be the same if the place”\” instead of”/” in the above program? If not, why?

6.      DECLARE SUB PROTABLE ()
CLS
SHARED num, range
INPUT "A number to generate the table of"; num
INPUT "The Range of the table"; range
CALL PROTABLE
END

SUB PROTABLE
FOR i = 1 TO range
PRINT num; "*"; i; "="; num * i
NEXT i
END SUB
i.Write the use of SHARED statement in the above program
ii.What change shall be made in the program if the SHARED statement is removed?


7.      DECLARE SUB OUTPUT (A$)
X$=”COMPUTER SCIENCE”
END

SUB OUTPUT (A$)
L=LEN(A$)
FOR I= L TO 1 STEP-5
PRINT MID$(X$,I,1);
NEXT I
END SUB

i.What statement should be added in the main module to execute program?
ii.What will be the output of the program after correcting the bugs?

8.      DECLARE SUB ABC(X)
N = 105
CALL ABC (N)
END

SUB ABC(X)
N=X
WHILE N>0
R= N MOD 10
IF R MOD 2 =1 THEN
PRINT R
S=S+R
END IF
N=N\10
WEND
END SUB

i.Write any two keywords used in the above program.
ii.What happens if  “N = N\10” is removed from the above program.

9.      DECLARE SUB series (I,C,F)
INPUT” ENTER  INITIAL VALUE”;A
INPUT”ENTER COMMON RATIO”;B
INPUT”ENTER FINAL TERMS”;C
CALL series(A,B,C)
END

SUB series(I,C,F)
CLS
FOR J=1 TO F
PRINT I
I=I*C
NEXT J
END SUB

a)      List the parameters in the given program.
b)     What will be the value of variable 1 after the completion of 3rd repetition of loop if A=1,B=3 and C=5.
c)      Will the program work if we write series$(I,C,F) instead os series(I,C,F) in first line of the given program.Give reason to justify your answer.

10.   DECLARE FUNCTION B$(N$)
R$ = “COMPUTER”
PRINT B$(R$)
END

FUNCTION B$(N$)
FOR I = LEN(N$) TO 1 STEP -1
M$ = M$ + MID$(N$,I,1)
NEXT I
B$ = M$
END FUNCTION

a)      Name any two library functions used in above program.
b)     List parameter and arguments.

11.   DECLARE SUB MultiTABLE()
SHARED Num, Range
INPUT "Enter a number to generate a table: "; Num
INPUT "The Range of the table"; Range
CALL MultiTABLE
END

SUB MultiTABLE
FOR i = 1 TO Range
PRINT num; "*"; i; "="; Num * i
NEXT i
END SUB

i.Write the use of CALL statement in the above program
ii. What change shall be made in the program if the SHARED statement is removed?
12.   DECLARE SUB test(c, d)
DIM SHARED c
CLS
a = 90
a = 100
c = 95
CALL test(a, b)
x = x + 2
PRINT a, b, c, x
END

SUB test(e, f)
SHARED x
x = 12
e = a + 12
f = b + 3
c = c + 5
PRINT x;
END SUB

a)      What will be the output of the program?
b)     What will be the output if the statement “SHARED x” is removed from the above program?

13.   DECLARE SUB SUM(N)
INPUT”ANY NUMBER”;N
CALL SUM(N)
END
SUB SUM(N)
S=0
WHILE N<>0
R=N MOD 10
S=S+R
N=N\10
WEND
PRINT “SUM”;S
END SUB
a)      In which condition the statements within the WHILE….WEND looping statement will not be executed?
b)     Will the output be the same if we place “/” instead of”\” in the above program.

14.   DECLARE SUB TEST (A, B)
CLS
X = 5
Y = 10
CALL TEST(X, Y)
PRINT X, Y, T, P, Q, R
END

SUB TEST (P, Q)
T = 5
P = P + T
Q = Q + 12
R = 10
END SUB
15.   DECLARE SUB take(x, y)
CLS
FOR i = 1 TO 5
READ c, d
CALL take(c, d)
NEXT i
DATA 13, 15, 16, 12, 31, 12, 16, 17, 21, 22
END
SUB take(a, b)
STATIC s
IF a > b THEN
s = s + a
ELSE
s = s + b
END IF
PRINT s;
END SUB

a)      If the statement STATIC s is removed, then what will be the change in its output?
b)     List out the formal arguments and actual arguments from the above program.





16.   DECLARE FUNCTION SUM%(A AS INTEGER, B AS INTEGER)
DIM A AS INTEGER, B AS INTEGER
INPUT “Enter the first number”; A
INPUT “Enter the second number”; B
PRINT “The sum of the two nos=”; SUM(A, B)
END

FUNCTION SUM%(A AS INTEGER, B AS INTEGER)
VALUE% = A + B
SUM% = VALUE%
END FUNCTION

a)      Write the output of the program if the user inputs 10 for the first and 10.5 for the second number.
b)     What type of value will the function return?

17.   CLS
OPEN "data.text" FOR INPUT AS #1
CONST PI=22/7
WHILE NOT EOD(1)
INPUT #1, R
AREA=PI*R^2
WEND
CLOSE #1
END

i)What is the function of INPUT # statement?
ii)What happens if you removed "#1" from the line "INPUT #1, R"

18.   OPEN”DETAIL.DAT” FOR INPUT AS #1
OPEN”TEMP.DAT” FOR OUTPUT AS # 1
INPUT”NAME OF THE STUDENTS”;NM$
FOR I = 1 TO 10
INPUT #1,N$,C,A
IF NM$<>N$ THEN
WRITE #2,N$,C,A
ENDIF
NEXT I
CLOSE #1,#2
KILL “DETAIL.DAT”
NAME “TEMP.DAT” AS “DETAIL.DAT”
END

i.What is the main objective if the above program.
ii.If the data file “DETAIL.DAT” contains only 8 records then the program will run ?If not then what will be the error message?



19.   CLS
OPEN”exam.txt” FOR OUTPUT as #1
M=1
DO WHILE M<=5
INPUT”NAME”;N$
INPUT”ADDRESS
WRITE #1,N$,A$
M=M+1
LOOP
CLOSE #1
END

i.How many records can be stored in the above program?
ii.What is the data file name used in the above program?
iii.Will this program work if we emplace OUTPUT by INPUT?

20.   OPEN”EXAM.DAT” FOR APPEND AS #1
TOP:
C=C+2
WRITE #1,C,C*5
B=B+1
IF B<>5 THEN GOTO TOP:
CLOSE #1
END

i.How many records this program will add?
ii.List the operators used in the program.

21.   OPEN "Detail.Dat" FOR INPUT AS #1
OPEN "Temp.Dat" FOR OUTPUT AS #2
INPUT "Name of the students "; NM$
FOR I = 1 TO 10
INPUT #1, N$, C, A
IF NM$ <> N$ THEN
WRITE #2, N$, C, A
END IF
NEXT I
CLOSE #1, #2
KILL "Detail.Dat"
NAME "Temp.Dat" AS "Detail.Dat"
END

i.What is the main objective of the above program?
ii.If the data file "Detail.Dat" contains only 8 records, then the program will run? If not then what will be the error message?



22.   CLS
OPEN "REC.DAT" FOR INPUT AS #1
OPEN "TEMP.DAT" FOR OUTPUT AS #2
WHILE NOT EOF (1)
INPUT #1, NM$, POST$, SAL
NSAL=SAL+SAL*0.1
WRITE #2, NM$, POST$, NSAL
WEND
CLOSE #1, #2
KILL "REC.DAT"
NAME "TEMP.DAT" AS "REC.DAT"

i.What is the main purpose of the above program?
ii.What is the function of EOF?

23.   CLS         
OPEN "data.text" FOR INPUT AS #1
CONST PI=22/7
WHILE NOT EOF(1)
INPUT #1, R
AREA=PI * R ^ 2
WEND
PRINT “AREA OF CIRCLE”;AREA
CLOSE #1
END

i.What is the function of INPUT statement?
ii.What will be the output if data file contain the value of 5?

24.   CLS          
OPEN "Record.dat" FOR INPUT AS #1
WHILE NOT EOF(1)
INPUT #1, N$,A$,P
PRINT N$,A$,P
WEND
CLOSE #1
END

i.Which command is used as mode?
ii.What is the main propose of making above program?

25.   OPEN “RECORD.DAT” FOR INPUT AS #1
OPEN “TEMP.DAT” FOR OUTPUT AS #2
CLS
INPUT “Enter name of the students”; N$
WHILE NOT EOF(1)
INPUT #1, NM$, AD$, S
IF N$<>NM$ THEN WRITE #2, NM$, AD$, S
WEND
CLOSE
KILL “RECORD.DAT”
NAME “TEMP.DAT” AS “RECORD.DAT”
END

i.What is the main objective of the program?

ii.Write down the function of EOF().