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.
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:
N | C | C<=5 |
3 | 1 | 1<=5 (TRUE) |
3*10+3=33 | 1+1=2 | 2<=5(TRUE) |
33*10+3=333 | 2+1=3 | 3<=5(TRUE) |
333*10+3=3333 | 3+1=4 | 4<=5(TRUE) |
3333*10+3=33333 | 4+1=5 | 5<=5(TRUE) |
33333*10+3=333333 | 5+1=6 | 6<=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:
A | B | I<=3 |
1 | 1 | 1<=3(TRUE) |
1+1=2 | 2+1=3 | 2<=3(TRUE) |
2+3=5 | 5+3=8 | 3<=3(TRUE) |
5+8=13 | 13+8=21 | 4<=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:
N | I<=N | N MOD I = 0 |
6 | 1<=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:
x | I<=5 |
1<=5 (T) | |
2 | 2<=5 (T) |
3 | 3<=5 (T) |
4 | 4<=5 (T) |
5 | 5<=5 (T) |
6 | 6<=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<=8 | n |
BOOKREADKEYED | 1<=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