ENOTES

Find output of QBASIC modular programming

access_time Aug 13, 2021 remove_red_eye 9247

Secondary Education Examination is the 10th standard board examination taken by Nepal Government in national level. Class 10 students appear SEE examination as their final examination. Among several subject that students enroll in Class 10, Computer Science and Account are the optional subjects. Computer Science consists of modular programming from which altogether 15 marks out of 50 is asked in board example. 2 marks of find output that may be either from sub or function is compulsory. Here are some of the old questions solution of find output of QBASIC modular programming.

Find output from Sub End Sub QBASIC programs

DECLARE SUB NUMBER ()
CLS
CALL NUMBER
END
SUB NUMBER
N=3:C=1
WHILE C<=5
       PRINT N
       N=N*10+3
       C=C+1
WEND
END SUB

Solution:

NCC<=5
311<=5 (TRUE)
3*10+3=331+1=22<=5(TRUE)
33*10+3=3332+1=33<=5(TRUE)
333*10+3=33333+1=44<=5(TRUE)
3333*10+3=333334+1=55<=5(TRUE)
33333*10+3=3333335+1=66<=5(FALSE)

Output of given program is:

3

33

333

3333

33333

DECLARE SUB SERI ()
CLS
CALL SERI
END
SUB SERI
A=1
B=1
FOR I=1 TO 3
       PRINT A; B;
       A=A+B
       B=A+B
NEXT I
END SUB

Solution:

ABI<=3
111<=3(TRUE)
1+1=22+1=32<=3(TRUE)
2+3=55+3=83<=3(TRUE)
5+8=1313+8=214<=3(FALSE)

Output of given program is:

1 1 2 3 5 8

DECLARE SUB NUMB(N)
N=6
CALL NUMB(N)
END
SUB NUMB(N)
       FOR I=1 TO N
              IF N MOD I =0 THEN
                      PRINT I;
              END IF
       NEXT I
END SUB

Solution:

NI<=NN MOD I = 0
61<=6(true)6 MOD 1 = 0 (T)
 2<=6(true)6 MOD 2 = 0 (T)
 3<=6(true)6 MOD 3 = 0 (T)
 4<=6(true)6 MOD 4 = 0 (F)
 5<=6(true)6 MOD 5 = 0 (F)
 6<=6(true)6 MOD 6 = 0 (T)
 7<=6(false) 

Output of given program is:

1 2 3 6

DECLARE SUB exam(x)
CLS
FOR i = 1 TO 5
       READ x
       CALL exam (x)
NEXT i
DATA 2, 3, 4, 5, 6
END
SUB exam (x)
       PRINT x^2;
END SUB

Solution:

xI<=5
 1<=5 (T)
22<=5 (T)
33<=5 (T)
44<=5 (T)
55<=5 (T)
66<=5 (F)

Output of given program is:

4 9 16 25 36

DECLARE SUB res(st$)
CLS 
DATA 4, 6, 11, 1, 3, 7, 5, 13
CALL res(st$)
END
SUB res (st$)
st$ = “BOOKREADKEYED”
FOR x=1 to 8
       READ n
       PRINT MID$(st$, n ,1);
NEXT x
END SUB

Solution:

st$X<=8n
BOOKREADKEYED1<=8 (T)4
 2<=8 (T)6
 3<=8 (T)11
 4<=8 (T)1
 5<=8 (T)3
 6<=8 (T)7
 7<=8 (T) 5
 8<=8 (T)13
 9<=8 (F) 

Output of given program is:

K E Y B O A R D