0% found this document useful (0 votes)
14 views50 pages

Computer Notes 2081

The document contains a series of programming exercises and outputs related to various functions and subroutines in a programming language. Each section includes declarations, function definitions, and expected outputs, often requiring dry runs or debugging of the code. The exercises cover topics such as calculating interest, area, and series, as well as input/output operations and control structures.

Uploaded by

Vinayak Pradhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views50 pages

Computer Notes 2081

The document contains a series of programming exercises and outputs related to various functions and subroutines in a programming language. Each section includes declarations, function definitions, and expected outputs, often requiring dry runs or debugging of the code. The exercises cover topics such as calculating interest, area, and series, as well as input/output operations and control structures.

Uploaded by

Vinayak Pradhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

OUTPUT QUESTIONS A=L*B

DECLARE FUNCTION Interest(p,t,r) area=A 8.


CLS END FUNCTION DECLARE FUNCTION SQD(N)
LET p=30 CLS
LET t=40 5. Write down the output: S=0
LET r=6 DECLARE FUNCTION AVGE(A,B,C) FOR L = 1 TO 3
LET d=Interest(p,t,r) X=10 READ NUM
PRINT “The simple interest will be”; d Y=5 S = S + SQD(NUM)
END Z=15 NEXT L
FUNCTION Interest(p,t,r) AV= AVGE(X,Y,Z) PRINT "Sum"; S
answer = (p*t*r)/100 PRINT “Average of three numbers”; AV DATA 2,4,6
Interest=answer END END
END FUNCTION FUNCTION AVGE(A, B, C) FUNCTION SQD (N)
S=A+B+C SQD = N ^ 2
2. AVGE = S/3 END FUNCTION
DECLARE FUNCTION Interest(p,t,r) END FUNCTION
CLS 9.
LET p=100 6. Write down the output of the given program and show them in dry DECLARE FUNCTION test (N)
LET t=2 run table. CLS
LET r=5 DECLARE FUNCTION Series (N) FOR Ctr = 1 TO 3
LET d=Interest(p,t,r) CLS READ N
PRINT “The simple interest=”;d A=2 Sum = Sum + test (N)
END PRINT "Sum of the series"; Series (A) NEXT Ctr
END PRINT “The result=”; Sum
FUNCTION Interest (p,t,r) DATA 3, 2, 1
Interest=(p*t*r)/100 FUNCTION Series (N) END
End FUNCTION Sum=0
FOR J = 1 TO 4 FUNCTION test (N)
3. Sum=Sum + N Test = N^2
DECLARE FUNCTION AREA(L,B) N=N+3 END FUNCTION
CLS NEXT J
LET L =100 Series= Sum 10. Write the output of the given program: Show with dry run in
LET B = 20 END FUNCTION table.
LET ans=AREA(L,B) DECLARE SUB SHOW(A)
PRINT “The area=”,ans 7. Write down the output of the given program and show them in dry CLS
END run table: N=87
FUNCTION AREA(L,B) DECLARE FUNCTION SQN (N) CALL SHOW(N)
ar=L*B CLS END
AREA=ar S=0 SUB SHOW(A)
END FUNCTION FOR L=1 TO 3 DO
READ NUM B=A MOD 6+3
4. Write down the output of the following program: S=S+SQN (NUM) IF B MOD 4=0 THEN GOTO AA
DECLARE FUNCTION area(L,B) NEXT L PRINT B;
LET L=10 PRINT "Sum of square"; S AA:
LET B=5 DATA 1, 4, 5 A=A-10
PRINT “The area=”; area(L,B) END LOOP WHILE A>=50
END FUNCTION SQN (N) END SUB
SQN = N^2
FUNCTION area(L,B) END FUNCTION
1
11. Write down the output of the given program: PRINT X;
DECLARE SUB Series(A) X=X+K
CLS NEXT K 18. Write the output of the given program:
A=20 END SUB DECLARE SUB CHECK (N)
CALL Series(A) CLS
END 15. Write the output of the following program. N = 1436
SUB Series(A) DECLARE SUB Series() CALL CHECK (N)
FOR K=1 to 5 CLS END
PRINT A; CALL Series
A=A+10 END SUB CHECK (N)
NEXT K SUB Series DO WHILE n< >0
END SUB A=1 R = N MOD 10
B=1 S = S*10+R
12. Write the output of the given program: (Workout with a dry run). FOR I = 1 TO 2 N = N\10
DECLARE SUB ABC(A) PRINT A; B; LOOP
CLS A=A+B PRINT "NOW N BECOMES"; S
A=2 B=A+B END SUB
CALL ABC(A) NEXT I
END END SUB 19. Write the output of the following program. [2]
SUB ABC(A)
FOR J= 1 TO 5 16. Write the output of the following program. DECLARE FUNCTION SUM ( a )
PRINT A; DECLARE SUB Series() CLS
A=A+3; CLS a=9
NEXT J CALL Series PRINT SUM ( a )
END SUB END END
SUB Series
13. Write the output of the following program. A=2 FUNCTION SUM ( a )
DECLARE SUB Series() B=2 FOR K = 1 to a
CALL Series FOR ctr = 1 TO 2 IF K MOD 2 = 0 THEN
END PRINT A; B; S=S+K
A=A+B END IF
SUB Series B=A+B NEXT K
X=1 NEXT ctr SUM = S
Y=1 END SUB END FUNCTION
FOR Z=1 TO 4
PRINT X; 17. Write the output of the following program 20. FIND OUTPUT
Y=Y+1 DELARE SUB NUMBER() DECLARE SUB SERIES ()
X=X*10+Y CLS CLS
NEXT Z CALL NUMBER CALL SERIES
END SUB END END
SUB NUMBER
14. N=3 SUB SERIES ( )
DECLARE SUB series() C=1 X=1
CALL series WHILE C<=5 Y=2
END PRINT N FOR P =1 TO 10
N=N*10+3 PRINT X;
SUB series C=C+1 X=X+Y
X=1 WEND Y=Y+1
FOR K = 1 TO 4 END SUB NEXT P
2
END SUB NEXT I N=N-10
DATA 56, 28, 8, 48 LOOP
21. Write the output of the given program: END END SUB
DECLARE SUB Result SUB REMINDER (R)
CALL Result R1 = R MOD 4 27. Write down the output of the given program. \Show with dry
END R2 = R MOD 3 run in table.
IF R1 = 0 AND R2<> 0 THEN DECLARE SUB SERU ( )
SUB Result PRINT R CLS
For I = 1 to 9 STEP 2 END IF CALL SERU
Sum=Sum +I^2 END SUB END
Next I SUB SERU ( )
PRINT Sum 25. Write the output of the given program showing the dry run table. X=2
END SUB (2) C=1
WHILE C<=10
22. Write the output of the following programs: DECLARE FUNCTION OUT (A, B) S=X^C
DECLARE SUB Series () CLS PRINT S;
CALL Series A=17 C=C+1
END B=7 WEND
SUB Series PRINT OUT (A, B) END SUB
X=0 END
FOR K = 10 TO 4 STEP -2 28. Write the output of the following
A = K ^2 FUNCTION OUT (A, B) program. [2]
X=X+A
NEXT K R=A MOD B DECLARE SUB series ()
PRINT X IF R MOD 2=0 THEN CALL series
END SUB C=R MOD 6+30 END
ELSE
23. Write down the output of the given program. Show with dry run SUB series ()
in table C=R MOD 6+15 i=3
ENDIF FOR c = 1T0 5
DECLARE SUB SERI() D=C\5 PRINT i *c^2;
CLS OUT=D NEXT c
CALL SERI END FUNCTION END SUB
END
26. Write the output of the following program showing necessary 29. Write the output of the given program showing the dry run table.
SUB SERI rough: (2)
X# = 1 DECLARE SUB test()
FOR I = 1 TO 5 DECLARE SUB DISPLAY ( ) CALL test
PRINT X# * X# CLS END
X# = X# * 10 +1 CALL DISPLAY SUB test
NEXT I END X=0
END SUB FOR K=10 TO 4 STEP-2
SUB DISPLAY A=K^2
24. LET N = 100 X=X+A
DECLARE SUB REMINDER (R) DO UNTIL N < 50 NEXT K
CLS R=N MOD 9+3 PRINT X
FOR I = 1 TO 4 IF R MOD 4=0 THEN GOTO BOTTOM END SUB
READ X PRINT R
CALL REMINDER (X) BOTTOM:
3
30. Write down the output of the given program and show them in CLS CALL PATTERN(B$)
dry run table: T$ = "COMPUTER" END
DECLARE SUB SERIES ( ) CALL Display (T$) SUB PATTERN(S$)
CLS END H=LEN(S$)
CALL SERIES I=10
END SUB Display (T$) FOR J=1 TO H STEP 2
SUB SERIES ( ) FOR C = 1 to LEN (T$) STEP 2 PRINT TAB(I); MID$(S$,J,H)
X=1 D$ = MID$(T$, C, 1) H=H-2
Y=1 PRINT D$; I=I+1
FOR P = 1 TO 10 NEXT C NEXT J
PRINT X; END SUB END SUB
X=X+Y
Y=Y+1 37. FIND OUTPUT
NEXT P DECLARE SUB Show (XY$)
END SUB CLS
34.Write the output of: XY$ = "HTUOMENXSA"
31. Write down the output of the given program. Show with dry-run DECLARE SUB RESULT(A$) CALL Show(XY$)
in table. A$ = "education" END
CLS CALL RESULT(A$)
P=1: Q=1 END SUB Show(XY$)
CALL DISP(P,Q) A = 47
END SUB RESULT (A$) FOR I = 1 TO 5
FOR C = 1 TO LEN(A$) STEP 2 N = A MOD 7
X$ = MID$(A$, C, 1) PRINT MID$(XY$, N, 1)
SUB DISP(M,N) PRINT X$ A=A-1
WHILE (N<=5) NEXT C NEXT I
PRINT M END SUB END SUB
M=M*10+N
N=N+1 35. Write the output of the following program. 38. Write down the output of the given program:
WEND DECLARE SUB RESULT(N$) DECLARE SUB SERIES ( )
END SUB N$ = "SCIENCE" CALL SERIES
CALL RESULT(N$) END
32. Write down the output of the given program. Show in dry run END SUB SERIES
table. SUB RESULT (N$) N$ = “*”
DECLARE SUB Result (C$) B = LEN(N$) FOR 1 TO 5
C$= “COMPUTER" COUNT = 1 FOR J=1 TO I
CALL Result (C$) WHILE COUNT <= B PRINT N$;
END X$ = X$ + MID$(N$, COUNT, 1) NEXT J
SUB Result (C$) COUNT = COUNT + 2 PRINT
FOR C=1 TO LEN(C$) STEP 2 WEND NEXT I
M$=MIDS (C$,C,1) PRINT X$ END SUB
N$=N$+MS END SUB
NEXT C
PRINT N$ 36. Write down the output of the given program. 1. Re-write the given program after correcting the
END SUB \Show with dry run in bugs:
table. (2) REM to add record in an existing file
33. [2] DECLARE SUB PATTERN(S$) CLS
CLS OPEN “Record.Dat” FOR OUTPUT AS #1
DECLARE SUB Display (T$) B$=”PROGRAM” AA:
4
INPUT “Enter Name, Class and Roll No.”; Nm$, Cl, Rn ABC.DAT END IF
INPUT #2, Nm$, Cl, Rn OPEN “ABC.DAT” FOR OUTPUT AS # 1 NEXT
INPUT “More records”; Y$ DO WHILE NOT EOF(“ABC.DAT”) CLOSE #2
IF UCASE$(Y$)=”Y” THEN GOTO aa INPUT # 1,N$,A END
CLOSE “Record.dat” PRINT N$,A
END CLOSE 1 11. Re-write the following program after correcting:
END DECLARE FUNCTION SUM(a,b)
2. Debug the given program: REM Program to sum given two numbers
OPEN "STUDENT.DAT" FOR APPEND AS 1# 7. Rewrite the following program after correcting the bugs. Input ”Enter first number”; x
INPUT "NAME"; N$ Rem to display the contents of a data file. Input “Enter second number; y
INPUT "ADDRESS"; ADD$ OPEN “Marks.dat” FOR OUTPUT AS #1 PRINT SUM(a,b)
INPUT "AGE"; AGE$ CLS END
WRITE #1, N$, ADD$, AGE WHILE EOF(1)
END# 1 INPUT #1, Name$, Age, Add$ FUNCTION SUM(x,y)
STOP DISPLAY Name$, Age, Add$ SUM=a+b
WEND END
3. Re-Write the given program after correcting the bags: CLOSE 1
REM to display name, post and salary of 10 employees END 12. Re-write the following program after correcting the bugs:
OPEN "EMP.TXT" FOR IN AS #1
FOR I=10 TO 1 8. Rewrite the given program after correcting the bugs: FUNCTION SUM(m,n)
INPUT #1, Name$, Post$, Salary REM display Records of students From Data File Rem to print sum of two numbers
DISPLAY Name$, Post$, Salary OPEN “STDREC.DAT” FOR INP AS #1 a=6
NEXT I PRINT “ROLL”,”NAME”,”ADDRESS”,”CLASS”,”SECTION” b=7
CLOSE “EMP.TXT” DO WHILE NOT EOF DISPLAY SUM(a,b)
END INPUT #1,RN,N$,AD$,CL,S$ END
PRINT RN,N$,AD$,CL,S$
4. Rewrite the given program after correcting the bugs: NEXT FUNCTION SUM(m,n)
REM to display records from existing file. CLOSE #1 S=m+n
OPEN "emp.text" FOR APPEND AS #1 END S=SUM
WHILE NOT EOF (#1) END SUM
WRITE # 1, eN$, posts, salaryS 9. Rewrite the given program after correcting the bugs. [2]
PRINT eN$, post$, salary REM program to read data from the data file. 13. Re-Write the given program after correcting the bugs:
NEXT OPEN “STD.DAT” FOR OUTPUT AS #1 DECLARE SUB Square (A)
CLOSE #1 CLS REM to print square of a input number
END WHILE NOT EOF(#1) CLS
WRITE#1, N$, R, C, P GET "Enter a number"; N
PRINT N$, R, C, P Square (N)
5. Rewrite the following program after correcting the bugs: WEND END
REM to store Name, post and salary CLOSE “STD.DAT” SUB Square (A)
OPEN EMP.DOC FOR OUT AS #1 END Sq = A^ 4
INPUT “Enter Name”; N Display "Square of a number is "; Sq
INPUT “Enter post”; P$ 10. Re-write the given program after correcting the bugs: End Sub
INPUT “Enter salary”; S Rem To print only class 10 record from "student.dat"
WRITE #2, N$,P$,S CLS 14. Re-write the given program after correcting the bugs:
CLOSE #1 OPEN "I",#2, "Student.Dat" CREATE FUNCTION Square(A)
END WHILE NOT EOF (#2) Rem to print square of a number
WRITE#2, N$,C,R CLS
6. Rewrite the given program after correcting the bugs. IF C=10 THEN Get “a number”; A
REM to display all the records from sequential Rem data file DISPLAY N$,C,R CALL square(A)
5
END FOR x=1 to 10 B=2
DISPLAY a; FOR Ctr = 5 TO 1
FUNCTION square(A) a=a+b DISPLAY A; B;
Ans=A^2 b=a+b A=A+B
Square=Ans END Fibonic B=A+B
END Square(A) NEXT Ctr
END FUNCTION
18. Rewrite the following program after correcting the bugs:
15. Re-write the given program after correcting the bugs: DECLARE SUB Series() 21. Re-write the given program after correcting the bugs:
DECLARE SUB Series ( ) CLS DECLARE SUB Series ( )
CLS EXECUTE Series CLS
EXECUTE Series END EXECUTE Series
END END
SUB Series( ) SUB Series() SUB Series
REM Program to generate 1 1 2 3 5 .....upto the 20th terms REM program to generate 1 1 2 3 5…. Up to 20th terms REM Program to print 4 4 8 12 20 ....... 20th terms
A=1 A=1 X=4
B=1 B=1 Y=4
FOR ctr=10 to 1 FOR ctr= 10 TO 1 FOR ctr = 10 To 1
DISPLAY A:B: DISPLAY A;B; DISPLAY X; Y;
A=A+B A=A+B X = X+Y
B=A+B B=A+B Y = X+ Y
NEXT ctr EXT ctr Next ctr
END Series ( ) END Series() End Series

19. Rewrite the following program after correcting the bugs: 2 22. Re-write the following correcting the bugs:
16. Re-write the given program correcting the bugs: DECLARE SUB Series(.) DECLARE SUB CUBE(N)
DECLARE SUB Series() DLC CLS
CLS EXECUTE Series FOR I = 1 TO 5
EXECUTE Series END READ
END SUB Series CALL CUBE(No)
SUB Series REM to generate 2 2 4 6 10….. upto 10th term NEXT X
A=2 P=2 DATA 3, 5, 2, 6, 4
B=2 Q=2 END
FOR ctr= 1 to 5 FOR Ctr=1 TO 5 SUB CUBE( )
DISPLAY A;B; DISPLAY P,Q, DISPLAY N^3
A=A+B P=P+Q END SUB
B=A+B Q=P+Q
LOOP ctr WEND 23. Re-write the given program after correcting the bugs: [4×0.5=2]
END Series() END Series()
REM TO find the factorial of a given number.
17. Debug the given program: 20. Re-write the given program after correcting the bugs: DECLARE FUNCTION FACTO (N$)
DECLARE SUB Fibonic() DECLARE SUB FIBO ( ) CLS
REM *Fibonic series* CLS INPUT "Enter a number"; X
CALL SUB Fibonic EXECUTE FIBO PRINT "The Factorial is: ", FACTO (N)
END END END

SUB Fibonic SUB FIBO FUNCTION FACTO (N)


a=1 REM Program to generate 2, 2, 4, 6, 10…upto 10th terms. F=1
b=1 A=2 WHILE N = 0
6
F=F*N CLOSE SUB a) Which statement should be added in the main module to execute
N=N-1 the program?
WEND 27. Re-Write the given program after correcting the bugs: b) List out the variables used in the above program.
F = FACTO DECLARE FUNCTION reverse$(N$)
END FUNCTION INPUT “Any String”; N$ 3. Study the following program and answer the given questions:
X$ = reverse$(N$) DECLARE FUNCTION Count (W$)
PRINT N$ INPUT "Enter a word"; R$
24. Re-write the given program after correcting the bugs: END C = Count (R$)
DECLARE SUB SUM(N) FUNCTION reverse(N$) PRINT C
INPUT “Any Number”; N L = LEN$(N$) END
PRINT SUM(N) FOR X = L to 1 STEP – 1 FUNCTION Count (W$)
END A$ = MID$(N$, X, I) FOR L = 1 TO LEN (W$)
SUB SUM (N) B$ = B$ + A$ Ch$=MID$ (W$, L, 1)
S=0 NEXT X IF UCASES (Ch$) = "K" THEN
WHILE N=0 B$ = reverse$(N$) N=N+1
R= R MOD 10 END FUNCTION END IF
S=S+R NEXT L
N=N/10 Count = N
WEND END FUNCTION
PRINT “Sum of digits”;S 1. Study the following program and answer the given a) List any two library functions used in the above program.
END questions. [2×1=2] b) Write the use of variable 'C' in line 3 [i.e. C = Count (R$)] given in
OPEN “Detail.dat” FOR INPUT AS #1 the above program.
25. Re-Write the given program after correcting the bugs: OPEN “Temp.dat” FOR OUTPUT AS #2
REM program to make a word reverse INPUT “Enter name of the students”; S$ 4. Study the following program and answer the given questions:
DECLARE FUNCTION Rev$(N$) FOR I=1 TO 10 DECLARE FUNCTION SUM(N)
CLS INPUT #1, Nm$, Cl, A CLS
LNPUT “Enter a word”; N$ IF S$< >Nm$ THEN INPUT “Enter any number”; N
DISPLAY “Reversed is”; Rev$(N$) WRITE #2, Nm$, Cl, A X=SUM(N)
END END IF PRINT “The sum of individual digit is “; X
EUNCTION Rev$(N$) NEXT I END
FOR K=LEN$(N$) To 1 STEP-1 CLOSE #1, #2 FUNCTION SUM(N)
B$=B$+MID$(N$,1,K) KILL “Detail.dat” WHILE N<>0
NEXT K NAME “Temp.dat” AS “Detail.dat” R=N MOD 10
B$=Rev$ END S=S+R
END FUNCTION a. What is the main objective of the program given above? N=INT(N/10)
b. Do you get any problem in the above program if “Kill” WEND
26. Re-write the given program correcting the bugs: statement is removed? Give reason. SUM=S
Rem program to reverse the string or word END FUNCTION
DECLARE SUB REV(W$) 2. Study the following program and answer the given questions: a) Write the function of INT.
CLS DECLARE SUB SEE (A$) b) How many times does the WHILE ….WEND loop repeat if the
INPUT “Enter a wod”;W$ A$="COMPUTER SCIENCE” value of N is 123?
CALL REV(W$) END
END 5. Read the program given below and answer the following
SUB REV(W$) SUB SEE (A$) questions.
FOR I=LEN(W$) to 1 step -1 L=LEN(A$) DECLARE SUB SUM(N)
C$=LEFT$(W$,I,1) FOR I=L TO 1 STEP-2 INPUT”ANY NUMBER”;N
S$=D$+1 PRINT MID$ (A$, I, 1) CALL SUM(N)
LOOP NEXT I END
PRINT “Reverse string is:”; D$ END SUB SUB SUM(N)
7
S=0 PRINT X INPUT N
WHILE N<>0 END S=Num(N)
R=N MOD 10 FUNCTION SUM (A, B) PRINT S
S=S+R S = A+B END
N=N\10 SUM = S
WEND END FUNCTION. FUNCTION Num(N)
PRINT “SUM”;S a) Write the name of local variable used in the above FUNCTION X=Int(17/N)
END SUB procedure. Y=15 MOD N
i) In which condition the statements within the WHILE….WEND b) Write the Mathematical operator and Relation operator used in Num=X +Y
looping statement will not be executed? above program. END FUNCTION
ii) Will the output be the same if we place “/” instead of”\” in the i) Write the name of the function used in the above program.
above program. 9. Study the following program and answer the given ii) List out the mathematical function (Library function) used in the
questions. 2x1=2 above program.
6. Study the following program and answer the given questions. DECLARE FUNCTION TEST(X)
DECLARE FUNCTION prod (A,B) X=100 12. Study the following program and answer the given questions:
CLS Z=TEST(X) DECLARE FUNCTION JPT (N)
INPUT “Enter first number'; A PRINT Z FOR ctr = 1 TO 6
INPUT „Enter second number"; B END READ N
PRINT „“The product of the two number="; prod (A,B) J = JPT (N)
END FUNCTION TEST(X) Sum = Sum + J
FUNCTION prod (A,B) FOR R=1 TO X NEXT ctr
P=A*B S=S+I PRINT Sum
prod=P NEXT R DATA 10, 20, 30, 40, 50, 60
END FUNCTION TEST=S END
List all the numerical variables used in the program above. END FUNCTION
List the local variables used in program above. a) How many parameters are used in the above program? FUNCTION JPT (N)
b) How many times does the statement S=S+I execute in the above IF N MOD 2 = 0 THEN JPT = N
7. State the following program and answer the given questions: program? END FUNCTION
DECLARE FUNCTION Diff(A, B)
CLS 10. Study the following program and answer the following question: a) What is name to the function used in the above program?
INPUT “Enter first number”; A DECLARE FUNCTION xyz(N) b) How many times the function will be executed in the above
INPUT “Enter second number”; B FOR I = 1 TO 5 program?
PRINT “The difference”; Diff(A, B) READ N
END Z=xyz(N) 13. Study the following program and answer the given
S=S+Z questions. [2×1=2]
FUNCTION Diff(A, B) NEXT I
Difference= A – B PRINT S DECLARE SUB TEST (N$ )
Diff = difference DATA 10,13,15,4,6 INPUT N$
END FUNCTION END CALL TEST ( N$ )
END
List all the numeric variables used in the above program. FUNCTION xyz(N)
List the local variables used in the above program. IF N MOD 2=0 THEN xyz=N SUB TEST (N$ )
END FUNCTION FOR P = 1 TO LEN ( N$ )
a) What is the name of the function used in the above program? B$ = MID$ (N$, P, 1)
8. Study the following program and answer the given questions: b) How many times the function will be called in the above program? IF LCASE$ (B$) = “a” THEN
DECLARE FUNCTION SUM (A, B) C=C+1
INPUT A END IF
INPUT B 11. Read the given program and answer the following questions: NEXT P
X = SUM (A, B) DECLARE FUNCTION Num(N) PRINT C
8
END SUB FOR I=1 TO B DATA NISHA, RUDHRA
E$=MID$(C$,I,1) CALL Stde(NM$U)
a) Write the name of the sub procedure used in the above program. IF E$=”A” OR E$=”E” OR E$=”I” OR E$=”O” OR E$=”U” END
b) Write any two library functions used in the above program. THEN C=C+1 SUB Stde(N$U)
END IF PRINT “Name starting from P”
14. Study the following program and answer the given questions: NEXT I FOR J = 1 TO 5
DECLARE SUB SUM(N) COUNT=C C$=MID$(N$,(J),1,1)
N=5 END FUNCTION IF C$=”P” THEN
CALL SUM (N) a) List the string Library functions used in the above program. PRINT N$(J)
END b) Write down the missing statements in the main module to execute END IF
the program. NEXT J
SUB SUM(N) END SUB
FOR X = 1 TO N 17. Study the following program and answer the given questions: List the library function used in the above program.
S =S + X DECLARE SUB EXAM(N$) List the conditional statement used in the above program is:
NEXT X CLS
PRINT S INPUT “Enter word”;WO$
END SUB CALL EXAM(WO$) 20. Analyse the program given below and answer the questions:
a) In the above program how many times does the FOR END DECLARE FUNCTION Diff(A,B)
………..NEXT loop executes? SUB EXAM (N$) CLS
b) Write the name of the procedure used in the above program. FOR I = 1 TO LEN (N$) INPUT “Enter first number”;A
PRINT RIGHT$(N$,I) INPUT “Enter second number”;B
15. Study the following program and answer the following NEXT I
questions: END SUB PRINT “The difference of the two number=”;Diff(A,B)
a) Write the names of two built-in functions used in the above END
DECLARE FUNCTION Prod(N) program. FUNCTION Diff(A,B)
INPUT “Any number”;N b) List the real parameter in the program. D=A-B
X=Prod(N) Diff=D
PRINT X 18. Study the following programs and answer the question: END FUNCTION
END DECLARE FUNCTION rev$ (N$) a) What will be the output of the program if the user enters 200 as the
INPUT "Any string"; N$ first number and 100 as the second number?
FUNCTION Prod(N) PRINT rev$ (N$) b) Will the program run if the first line (i.e. DECLARE…..) is
F=1 END deleted?
FOR K=1 TO N FUNCTION rev$ (N$)
F=F*K FOR X = LEN (N$) to 1 STEP -1
NEXT K A$=MID$ (N$, X, 1) 21. Analyse the program and answer the following question:
Prod=F B$ = B$ + A$ DECLARE SUB ABC(X,Y,Z)
END FUNCTION NEXT X FOR P=1 TO 3
rev$ = B$ READ A,B,C
a) Write the name of the user defined function used in the above END FUNCTION CALL ABC(A,B,C)
program. a. List the library function used in the above program. NEXT P
b) Name the loop in the above program. b. What will be the maximum value of X if the N$ is equal to DATA 5,4,3,2,1,6,7,8,4
16. Study the following program and answer the following questions: "Computer". END
DECLARE FUNCTION COUNT(A$) SUB ABC(X,Y,Z)
Input “Enter a word”; W$ 19. Study the following program and answer the following: T=X+Y+Z
END DECLARE SUB Stde(N$U) IF T MOD 2 = 0 THEN
FOR Loop = 1 TO 5 PRINT T
Function Count(A$) READ NM$(Loop) END IF
B=LEN(A$) NEXT Loop END SUB
C$=UCASE$(A$) DATA RAMA, PRATIMA, PRASANT a) List any two variables used in the above program.
9
b) How many times SUB-procedure will be called when program
is executed? FUNCTION SUM (N) 26. Study the following program and answer the given questions:
WHILE N > 0 DECLARE SUB TEST (A, B, C)
R = N MOD 10 LET X=4
22. Analyse the program given below and answer the questions: T=T+R LET Y=7
DECLARE FUNCTION CHK$(N) N = N \ 10 LETZ=12
CLS WEND CALL TEST (X, Y, Z)
N=57 SUM = T PRINT X, Y, Z
PRINT “The number is”; CHK$(N) END FUNCTION END
END SUB TEST (A, B, C)
FUNCTION CHK$(N) a) State the purpose of suing variable S in line 4 in above program. A=A+3
FOR I = 1 TO N b) Write the use of MOD in the above program. B-B+2
IF N MOD I = 0 THEN C=C+1 SUM=A+B+C
NEXT I 25. Study the following program and answer the given questions: PRINT SUM
IF C>2 THEN DECLARE SUB TRIM(W$) END SUB
CHK$=”Composite” CLS
ELSE INPUT "Enter word"; WO$ a. List the arguments and parameters used in the above program.
CHK$=”Prime” CALL TRIM(WO$) b. List local variables used in each module.
END IF END
END FUNCTION SUB TRIM (W$) 27. Study the following program and answer the given questions:
a) Will the above program execute if “DECLARE FOR I = 1 TO LEN(W$) 2x1=2
FUNCTION….” is deleted? PRINT LEFT$(W$, I) DECLARE FUNCTION SUM (N)
b) Why $ sign is used in the name of the above function. NEXT I CLS
END SUB INPUT “ENTER MULTIDIGIT NUMBER”; A
23. Study the following program and answer the questions: 1×2=2 SU = SUM(A)
DECLARE FUNCTION Sum(A,B) a) What will be the maximum value of I if input string is “SEE” in PRINT “SUM OF DIGITS”; SU
INPUT “Enter first number:”; A the above program? END
INPUT “Enter second number:”; B b) List the real parameter used in the above program.
PRINT “The sum of the two number=”;Sum(A,B) FUNCTION SUM(N)
END 25. Read the following program and answer the following questions: S=0
WHILE N < > 0
FUNCTION SUM(A,B) OPEN "BUSRIDER.TXT" FOR INPUT AS #1 R = N MOD 10
S=A+B OPEN "TEMP.TXT" FOR OUTPUT AS #2 S=S+R
Sum=S CLS N = N \ 10
END FUNCTION WHILE NOT EOF (1) WEND
INPUT #1. STUDENTNAME$, CLASS, BUSCODE, BUSSTOP$ SUM = S
a) List the numerical variables used in the above program. IF UCASE$(BUSSTOP$) < > UCASE$("KATHMANDU") THEN END FUNCITON
b) Will the program run if the first line (i.e. DECLARE….) is WRITE #2, STUDENTNAME$, CLASS, BUSCODE, BUSSTOP$
deleted? PRINT STUDENTNAME$, CLASS, BUSCODE, BUSSTOP$ a. What is the name of the function used in the above program?
END IF b. List the formal and real parameters used in the above program.
24. Study the following program and answer the given questions: WEND
[2×1=2] CLOSE #1, #2
KILL"BUSRIDER.TXT" 28. Study the following program and answer the given questions:
DECLARE FUNCTION SUM (N) NAME "TEMP.TXT" AS "BUSRIDER.TXT" 2x1=2
CLS END DIM N (10)
INPUT "Enter any number"; N DECLARE SUB MIN (N ( ))
S = SUM (N) a) What is the main objective of the program given above? CLS
PRINT "The Sum of individual digit is"; S b) Do you get any problem in above program if "Kill" statement is FOR I=1 TO 10
END removed? Give reason. INPUT "ENTER A NUMBER"; N (I)
10
NEXT I DECLARE FUNCTION ODDEVEN$(N)
CALL MIN (N ( )) 31. Study the following program and answer the given CLS
END questions: (2x1=2) INPUT "Enter a number"; N
SUB MIN (N ()) PRINT "Number is"; ODDEVEN$(N)
S=N (1) REM “to count vowels” END
FOR 1=2 TO 10 DECLARE FUNCTION count (A$)
IF SN > N(I) THEN S=N (I) INPUT "Enter a word"; A$ FUNCTION ODDEVEN$(N)
NEXT I IF N MOD 2=0 THEN
PRINT "THE SMALLEST NUMBER=”;S End MS$="even"
END SUB ELSE
FUNCTION count (A$) MS$="odd"
a. Which is array variable in above program? B=LEN (A$) END IF
b. Which is control statement in above program? C$=UCASE$(A$) ODDEVEN$=MS$
FOR I=1 to B END FUNCTION
29. Study the following program and answer the given questions: E$=MID$(C$, I, 1) Questions:
(2´1=2) IF E$="A" or E$= "E" or E$= "I" or E$="O" or E$ = "U" THEN
DECLARE SUB RESULT(A$) C=C+1 a) What is the main objective of the above program?
A$="COMPUTER" END IF b) What is the use of MOD in the above program?
CALL RESULT(A$) NEXT I
END Count=C 34. Study the following programs and answer the given questions:
SUB RESULT(A$) END FUNCTION
FOR I= 1 TO LEN(A$) STEP 2 DECLARE SUB question (a, b, c)
X$=MID$(A$,C, I ) Questions: CLS
PRINT X$; x=10: y=20 : z=15
NEXT I a) List the string library functions used in the above program. CALL question(x,y,z)
END SUB b) Write down the missing execute the program. statements in the END
main module to execute the program.
Questions: SUB question(a,b,c)
a) List the library functions used in above program. 32. Study the following program and answer the given a = a +10
b) How many times loop executes in above program. questions: (2x1=2) b=b+a
c=a+b
30. Study the following program and answer the given questions: DECLARE SUB TEST (B$) PRINT a,b,c
(2´1=2) CLS END SUB
DECLARE SUB FACTORS(N) INPUT W$ a) What would be its output if x=1, y=2, z=3?
N=10 CALL TEST (W$) b) Write actual and formal parameters used in the program.
CALL FACTORS(N) END
END SUB TEST (B$) 35. Study the following program and answer the given questions:
FOR I =1 To LEN (B$)
SUB FACTORS(N) PRINT RIGHT$(B$), i) DECLARE FUNCTION text$(N$)
FOR J=1 TO N NEXT I CLS
R=N MOD J END SUB INPUT "Enter any string":X$
IF R=0 THEN PRINT J; PRINT text$(X$)
NEXT J Questions: END
END SUB a) Write the name of two built in functions used in the above
program. FUNCTION text$(N$)
Questions: b) List the real parameters of the above program. FOR i=len (N$) TO 1 STEP-1
W$=W$+MID$(N$,i,1)
a) Write down the use of MOD in the program. 33. Study the following program and answer the given questions: NEXT i
b) How many time the loop executes in the above program? text$ = WS
11
NEXT Q 12. WAP in SUB procedure to find the volume of cylinder and in displays all information about personnel whose salaries exceed
END FUNCTION function procedure to find the area of circle in Qbasic. [vol=pir2h, 60000.
area=pir2] 28. A data file “Salary.Dat” contains the information of employee
a) What is the main objective of above program? 13. Write a program in QBASIC that asks height and radius of regarding their name, post and salary. Write a program to display all
b) List all the parameters used in above program. cylinder and calculate its volume by user define function and total the information of employee whose salary is greater than 15000 and
surface area by sub procedure. less than 40000
PROGRAMMING PRACTICE QUESTIONS 14. Write a program in QBASIC that allow user to enter radius of a 29. A sequential data file called “Record.dat” has stored data under
1. Write a program in QBASIC that asks two numbers to find circle. Create a user defined FUNCTION…END FUNCTION to find the field headings: Roll No., Name, Gender, English, Nepali, Maths
remainder using SUB…END SUB program and product of two volume of cylinder and SUB…END SUB to find circumference of a and Computer. Write a program to display all the information of
numbers using FUNCTION…END FUNCTION. circle. those students whose marks in English is more than 40.
2. Write a program in QBASIC that ask to enter any three different 15. Write a program in QBASIC that asks radius of a circle to 30. A sequential data file called “Record.txt” has stored data under
numbers then find out the product and average. Create a user defined calculate its area and circumference. Create a user defined function to the field heading Roll No., Name, Gender, English, Nepali, Maths
function PROD() to calculate product and sub procedure AVG() to calculate area and sub program to calculate circumference.[Hint and Computer. Write a program to display all the information of
calculate average. A= pr2, C= 2pr] those students whose gender is “F” and obtained marks in computer
3. Wise a program in QBASIC that asks any number and display 16. Write a program in QBASIC that ask the radius of circle. Write a is more than 90.
its square and square root: Create a user- defined function to program to calculate the area and circumference of a circle. Create a 31. WAP to ask student's name, class and marks secured in three
calculate square root and a sub program to display the square of a user defined function first (r) to calculate area and sub procedure subjects. Store the data in a sequential data file “result.dat” along
number. second (r) to calculate circumference of a circle. with total marks. Make provision to ask user to enter another record.
4. Write a program in QBASIC that asks length, breadth and 17. WAP that asks principal, time and rate of interest and calculate 32. A sequential data file called “student.txt” has stored data under
height of room and calculate its area and volume. Create a user simple interest using SUB..END SUB and amount using the field heading Name, Class, Address and Age. Write a program to
defined function to calculate area and sub-program to calculate FUNCTION..END FUNCTION. [Hint : SI =P*T*R/100, Amount = display all the information of those whose class is 10 and gender is
volume. Hint: [A=L×B], [V=L×B×H] P+SI]. “male”.
5. Write a program in Q-BASIC that asks length and breadth of a 18. Write a program in QBASIC to display the greater number using 33. A data file "Staff.dat” has stored records of few employers with
room and calculate its area and perimeter. Create a user-defined a function procedure and the smaller number using a sub procedure EmpID, name, address post and salary. Write a program is display all
FUNCTION to calculate area and SUB program to calculate among three numbers. the records of the employees whose address is "Nepal" and salary is
perimeter. [Hint: A=L×B, P=2(L+B)] than 40.000.
6. Write a program to calculate area of rectangle using 19. Write a program to create a sequential data file "student.dat" to 34. Write a program to read the data from the file "empinfo.txt" and
FUNCTION and area of a circle using SUB. store 10 students name and obtain marks in four different subjects. display their NAME, EMPID, POST whose POST is Clerk.
7. Write a program to calculate area of a circle using SUB..... END 20. Write a program to store Roll no., Name, Class and Address of 35. A sequential data file called "marks.dat" has stored data under
SUB and perimeter of rectangle using FUNCTION... END any five students the field heading student's name, eng, nep and math. Write a program
FUNCTION. 21. Write a program to create a sequential data file “salary.dat” to to display all the record whose marks is greater than 35 in all subjects
8. WAP to Find area of Four walls using FUNCTION END store programmer‟s name, salary and post according to the need of 36. A sequential data file called „data.dat‟ has stored data under the
FUNCTION and area of rectangle using SUB END SUB the user. field heading item name, quantity and rate. Write a program to
9. Write a program in QBASIC that asks radius and height of a 22. Write a program to store records regarding the information of display all the records with total.
cylinder Create a User Defined Function to calculate total surface Book number, Book‟s name and Writer‟s name in a sequential data 37. Write a program to open data file new.dat which may contain
area and a Sub Program to calculate the volume of a cylinder.[Hint: file called “Library.dat”. name, address, phone no. and salary. The program should allow user
TSA=2pr (r+h) and Volume pr2h] 23. Write a program to create a sequential data file “Employee.Dat” to add few records on it.
10. Write a program in QBasic that ask the radius and height of a to store employees‟ name, address, age, gender and salary. 38. A data file “LIB.TXT” consists of book‟s name, author‟s name
cylinder and calculate the volume and curve surface area. Create a 24. Students' name, class, section and address are stored in a data file and price of books. Write a program to count and display the total
user-defined function to calculate volume and sub-procedure to called "STUDENT.DAT" Write a program to print all the records of number of records present in the file.
calculate curve surface area of a cylinder. [Hints: V=πr2 h, students. 39. A sequential data file “EMP.DAT” contains name, post and
CSA=2πrh] 25. A sequential data file called “Marks.dat” contains roll number, salary fields of information about employees. Write a program to
11. Write a program in Qbasic that ask the radius of a hemisphere name, English, Nepali, and Maths field. Write a program to display display all the information of employees along with tax amount (also
and calculate its volume and total surface area. Create a user-defined all the content of the data file. tax is 15% of salary)
function First(r) to calculate volume and sub-procedure Second(r) to 26. A sequential data file "RECORD.DAT" has records with field 40. A sequential file "detail.dat" contain Name, Age and mobile
calculate total surface area of a hemisphere. [Hints: TSA=3pr2, name, address, age and salary. WAP to display only those records number of few persons. Write a QBASIC program to display the
V=2/3pr3) whose age is greater than 26. name of those persons who are eligible to cast the vote. [ Age must
27. Employee's name, address, gender and salary are stored in the be 18 or above to cast the vote.]
"EMP.DAT" sequential data file. Write a QBASIC program that
12
41. A sequential data file called "list.dat" has stored data under the 66. Write a program in C to sum of odd number from 80 to 90. 90. Write a program using SUB…END SUB to print the first ten
field heading items name quantity and rate. Write a program to 67. Write a program in C language to display the series with their odd numbers.
update all the records by increasing the rate by 10%. sum 40, 41, 42, 43…….10th terms. 91. Write a program to print the natural numbers from 1 to 5 using
42. A sequential data file "record.dat” contains the name, address, 68. Write a program in C language to display the odd numbers from SUB…END SUB
salary of employees, and displays the record of those whose salary is 1000 to 500 with their sum. 92. Using FUNCTION……END FUNCTION, write a program to
more than 37000 and whose name ends with "DHA. calculate distance travelled by a body. (Hint: s=ut+ (1/2) at2)
43. Write C program to find average number of any two numbers. EXTRA 93. Write a program using Function Module to calculate and print
44. Write a program in C language to ask to enter two numbers and 69. WAP in SUB procedure to find whether the input number is the volume of a box.
find out the sum and product. Armstrong or not in Q-basic. 94. Write a program to calculate the area of four walls using
45. Write a program in 'C' language to find simple interest where 70. WAP in SUB procedure to enter a number and find the reverse SUB…END SUB.
user need to input Principle, Rate and Time. of a number. 95. Write a program in QBASIC to find the total surface area of a
46. Write a program in C language to ask length, breadth and height 71. WAP to find the sum of digits of a number using SUB….END box using FUNCTION….END FUNCTION.
and display volume of box SUB. 96. Write a program using Function…..End Function to get
47. Write a program in C language that asks a number and check 72. WAP in SUB procedure to enter decimal number and find the temperature in Celsius from the user and then print the temperature in
whether it is odd or even. binary number in QBASIC. Fahrenheit.(hint: F=9C/5+32).
48. Write a program in C language that asks for an integer value and 73. WAP in Q-basic to enter a number and check whether the 97. WAP to print the sum of the digits of a given numbers using
checks whether it is divisible by 7 or not. number is positive, negative or zero using FUNCTION procedure. SUB Procedure
49. Write a program in C language to input a number then check 74. Write a FUNCTION program to check whether the supplied 98. Write a program using FUNCTION…END FUNCTION to find
whether the number is fully divisible by 5 or not. number is divisible by 5 or not. area of the triangle
50. Write a C program to test whether the given number is exactly 75. Write a program to ask a number and check it is exactly divisible 99. Write a program using a SUB procedure module to print the
divisible by 13 or not. by 3 and 7 using FUNCTION..END FUNCTION. multiplication table of any input number up to 10th term
51. Write a program in C language to enter a number and find out 76. Write a program to ask a number and check it is exactly divisible 100. Using Functions……End Functions Write a program
whether it is positive or negative by using 4 and 6 using SUB…END SUB. to find odd or even
52. Write a C program that asks a number and check whether it is 77. Write a program to accept age and citizen of a person to check
negative, positive or zero. whether he/she is eligible to cast vote or not using SUB…END SUB. TECHNICAL TERMS
53. Write a program in C language that asks any two numbers and 78. WAP to find the greatest number out of three numbers using 1. The rules and regulations to systematize the computer related
displays the greatest among them. FUNCTION….END FUNCTION. technology.
54. Write a program to read any three integer numbers from the 79. Write a program to count the occurrence of letter „e‟ in the 2. Rules and format to accept and transfer data in the computer
keyboard and find the smallest number using C-Language. supplied string using SUB…END SUB. network.
55. WAP to read two numbers and display the smaller one using C- 80. Write a program to count the occurrence of letter „a‟ in the 3. A set of rules that governs how computer exchange information
Program supplied string using SUB…END SUB. over computer network.
56. Write a progam is C language to check the students whether that 81. Write a program to declare SUB procedure to print only the 4. A set of rules that governs the communication among the
are pass or fail, when the pass mark is 45 vowels from a given word. computers in a network.
57. Write a program in C language to input length of three rods and 82. Write a program to find the numbers of vowels in an input string 5. A set of rules and procedures that govern transmission of
display whether the triangle can be formed by those rods or not. using „FUNCTION…..END FUNCTION‟. messages.
58. Write a program in C language that asks the value of 3 sides of a 83. Write a program using FUNCTION….END FUNCTION to 6. The rules that make the network communication possible.
triangle then check whether triangle is Scalene or not. input a string and count the total number of consonants 7. The volume of bits that can be transferred per second through the
59. Write a program in C language to display the series with their 84. Write a program using FUNCTION.....END FUNCTION to communication media.
sum.1, 2, 3, 4 upto 10th terms. count the number of words in a sentence 8. A software which enables to view HTML pages in the Internet.
60. Write a program in C-language to display the series 2, 4, 6, 8 up 85. Write a program using FUNCTION….END FUNCTION to get a 9. A device that can connect networks which may use different
to the 10th term. word from the user and print the word in the reverse order. communication protocols.
61. Write a program in C language to display the series with their 86. Write a program to check whether a string is palindrome or not 10. Network sharing and exchanging information between different
sum 1, 4, 9, 16.... up to 10th term. using SUB….END SUB. people.
62. Write a program in C language to display first 10 odd numbers. 87. Write a program in QBASIC to display sum of first natural 11. Learning through electronic media.
63. Write a C program to display the sum of first 20 even number. numbers using FUNCTION…END FUNCTION. 12. A card used to connect network cable to computer.
64. Write a program to print first 10 natural number using C 88. Using SUB……….END sub, write a program to print the 13. A main computer in the computer network.
language. following serial 9, 7, 5,……1 14. A powerful computer which controls and co-ordinates all
65. Write a program in „C‟ language to find the sum of first ten 89. Write a program using sub procedure module to print the series computers connected in a network.
natural numbers. 1,1,2,3,5,8.. up to ten terms.
13
15. A computer in a network which can provide services to other 54. An artificial environment created by a computer system that B$=B$+MID$(N$,1,K)
computer appears real. NEXT K
16. A device which can convert analog signal to digital codes and 55. Digital trails created while using internet. B$=Rev$
vice versa. 56. Data transmission in only one direction. END FUNCTION
17. The device used to connect PC with telephone line.
18. A computer network limited within a room. DEBUGGING 5. [SEE 2079 GP]
19. Network of networks. 1. [SEE MODEL SET] REM to display records from existing file.
20. A company that provides the internet facility. REM to add record in an existing file OPEN "emp.text" FOR APPEND AS #1
21. The data carrying capacity of communication channel. CLS WHILE NOT EOF (#1)
22. Hub or switch based network topology. OPEN “Record.Dat” FOR OUTPUT AS #1 WRITE # 1, eN$, posts, salary
23. Physical layout of LAN. AA: PRINT eN$, post$, salary
24. A type of network in which every computer works as both client INPUT “Enter Name, Class and Roll No.”; Nm$, Cl, Rn NEXT
and server. INPUT #2, Nm$, Cl, Rn CLOSE #1
25. Protocol used to receive email from the mail server. INPUT “More records”; Y$ END
26. An internet tool that helps to upload/download the file. IF UCASE$(Y$)=”Y” THEN GOTO aa
27. The process of sending file from user‟s computer to web server. CLOSE “Record.dat” 6. [SEE 2078]
28. A virus that corrupts system files of operating system. END DECLARE SUB Series ( )
29. A program that destroys other program CLS
30. A program that effect the normal functioning of computer. 2. [SEE 2080] EXECUTE Series
31. Computer program that protects computer from computer virus. DECLARE SUB Square (A) END
32. A computer virus that damages the documents created in MS- REM to print square of a input number SUB Series( )
Word & MS-Excel. CLS REM Program to generate 1 1 2 3 5 .....upto the 20th terms
33. Program used to detect and eliminate computer virus. GET "Enter a number"; N A=1
34. A program that can disinfect a file from virus Square (N) B=1
35. A person who steals or destroys other‟s data, information and END FOR ctr=10 to 1
program SUB Square (A) DISPLAY A;B;
36. A secret code that gives the user to access particular program and Sq = A^ 4 A=A+B
system. Display "Square of a number is "; Sq B=A+B
37. A secret group of characters used to protect computer system End Sub NEXT ctr
from unauthorized users. END Series ( )
38. Making an extra copy of data and software. 3. [SEE 2080 GI]
39. Device used for power protection. REM to display name, post and salary of 10 employees 7. [PABSON PB 2081]
40. An electronic device that supply electronic current when OPEN "EMP.TXT" FOR IN AS #1 REM to display the data from sequential data file "marks.dat” having
electricity is cut off. FOR I=10 TO 1 marks in english more than 35
41. Making duplicate copy of file for security purpose. INPUT #1, Name$, Post$, Salary CLS
42. A spare copy of important program or document. DISPLAY Name$, Post$, Salary OPEN “marks.dat” FOR OUTPUT AS#1
43. The method of consolidating fragmented files on the computers. NEXT I WHILE NOT EOF(2)
44. Moral rules to be followed by computer and other professionals. CLOSE “EMP.TXT” INPUT #1, N$, ENG, NEP, SCI
45. The moral principles that control cyber-crime. END ENG+NEP+SCI = TOT
46. The law that controls cyber crimes. IF TOT >35 THEN PRINT N$, ENG, NEP, SCI
47. Law regarding internet (or Legal issues of Cyber Space). 4. [SEE 2079] NEXT
48. Law that governs the legal issues of cyberspace. REM program to make a word reverse CLOSE #1
49. Illegal activities committed through the use of computers and DECLARE FUNCTION Rev$(N$) END
Internet. CLS
50. Buying and selling products and services online. LNPUT “Enter a word”; N$ 8. [PABSON PQ 2081]
51. Business through internet. DISPLAY “Reversed is”; Rev$(N$) REM To store name, age and salary in a sequential data file
52. Use of Internet to buy and sell goods and services. END REC.DAT
53. The smallest unit to represent information on a quantum EUNCTION Rev$(N$) CLS OPEN "Employee.dat" FOR OUTPUT AS #1
computer FOR K=LEN$(N$) To 1 STEP-1 DO
14
INPUT "Enter employee's name"; N$ REM to print cube of a number END
INPUT "Enter employee's address"; A$ CLS SUB SS
INPUT "Enter employee's age"; Al Get "Enter a number"; A REM Program to generate 2 2 4 6 10 .....upto the 10th terms
INPUT "Enter employee's gender";G$ Call CUBE(A) A=2
INPUT "Enter employee's salary";S END B=2
WRITE #1,A$,AI,G$,S FUNCTION CUBE(A) FOR JN=10 to 1
INPUT "Add more records(Y/N)";A ANS=A^3 DISPLAY A;B;
LOOP WHILE UCASE(A$)="Y" ANS=CUBE A=A+B
CLOSE 1 END FUNCTION B=A+B
END NEXT JN
12. [PABSON FT 2081 B] END S$ ( )
9. [PABSON MT 2081 A] CREATE FUNCTION SQUA(A)
REM to display greatest number REM to print square of a number 16. [PABSON FT 2080]
DECLARE GREAT FUNCTION (a, b, c) CLS CREATE FUNCTION Square(A)
ACCEPT a, b, c Get "Enter a number"; A REM to print square of a number
PRINT GREAT (x, y, z) Call SQUA(A) CLS
END END Get "Enter a number"; A
FUNCTION SQUA(A) Call Square(A)
FUNCTION GREAT (a, b, c) ANS=A^2 END
IF a>b or a>c THEN 8ANS=SQUA FUNCTION Square(A)
G=a END FUNCTION Ans=A^2
ELSEIF b>a AND b>c THEN Square=Ans
G=b 13. [PABSON PB 2080] END Square(A)
ELSE REM display records of students from sequential data file.
G=c OPEN “STUDENT.DAT” FOR INP AS #1 17. [PABSON 2079 A]
NEXT PRINT “SNO”, “NAME”, “ADDRESS”, “CLASS”, “SECTION” FUNCTION SUM(M, N)
G=GREAT WHILE NOT EOF REM to print sum of two numbers
END SUB INPUT #1, SN, N$, AD$, C, SE$ A=6
PRINT SN, N$, AD$, C, SE$ B=7
10. [PABSON MT 2081 B] NEXT DISPLAY sum(M,N)
REM To check the supplied no. is odd or even CLOSE #1 END
DECLARE FUNCTION Check$ (X) STOP
CLS FUNCTION SUM(M,N)
ACCEPT “ANY NUMBER:”; N 14. [PABSON PQ 2080] S=M+N
CALL Check$ (X) REM to count total no. of passed student S=SUM
END WHILE NOT EOF() END FUNCTION
SUB Check$ (N) OPEN "pab.txt" FOR OUTPUT AS#1
Y=2 INPU T#2,ID,M1,M2,M3 18. [PABSON 2079 B]
R= Y MOD N IF M1>=32, M2>=32, M3>=32 THEN REM To store name and age in a sequential data file STD.DOC
IF R=0 THEN X=X+1 OPEN STD.DOC FOR OUT AS#1
C$= “EVEN” END IF CLS
ELSE WEND INPUT "Enter name";N
C$= “ODD” PRINT "TOTAL RECORD";X INPUT "Enter age";A
END END WRITE 1,N$,A
C$=Check$ CLOSE #1
END FUNCTION 15. [PABSON MT 2080] END
DECLARE SUB S$ ( )
11. [PABSON FT 2081 A] CLS 19. [PABSON 2079 C]
CREATE FUNCTION CUBE(A) EXECUTE SS REM to store record in data file
15
CLS END SUB
OPEN "employee.dat" FOR INPUT AS #1 27. [SLC 2066]
DO 23. [PABSON 2079 FT] DECLARE SUB Fibonic()
INPUT "Enter Name, address and gender": N$, A, G DECLARE SUB SUM (P, Q, R) REM *Fibonic series*
INPUT #1, N$, A. G CLS CALL SUB Fibonic
INPUT "Do you want to continue "; Y$ INPUT “Enter the numbers”: P,Q,R END
WHILE UCASE$(Y$) = "Y" CALL SUM
CLOSE "employee.dat" END SUB SUB Fibonic
END a=1
20. [PABSON 2079 D] SUB Check(P,Q,R) b=1
REM to create sequential data file "record.dat" to enter some records. S=P+Q+R FOR x=1 to 10
CLS PRINT “Sum of three numbers is”; SUM DISPLAY a;
OPEN "record.dat" FOR INPUT AS #1 END SUB a=a+b
UP: b=a+b
INPUT "ENTER NAME";N$ 24. [PABSON PB 2078] END Fibonic
INPUT "ENTER ADDRESS";A$ REM to add more data in a sequential file.
INPUT "ENTER PHONE NUMBER";PH OPEN “EMP.DAT” FOR INPUT AS #2
WRITE #2, N$,A$,PH DO
INPUT "Do you want to continue(y/n)?";an INPUT “ENTER NAME”; N$ 28. [SLC 2067]
IF LCASE(an$)="y" THEN GOTO UP INPUT “ENTER ADDRESS”; A$ REM to display all the records from sequential Rem data file
CLOSE #1 INPUT “ENTER SALARY”; S$ ABC.DAT
END WRITE #1, N$, A$, S OPEN “ABC.DAT” FOR OUTPUT AS # 1
21. [PABSON 2079 PQ] INPUT” Do you want to add more records.”; M$ DO WHILE NOT EOF(“ABC.DAT”)
REM to store name, address in the file "store.dat" LOOP WHILE UCASE(M$) = “Y” INPUT # 1,N$,A
CLS END PRINT N$,A
OPEN "store.dat" FOR INPUT AS #1 CLOSE 1
DO 25.[SEE PB 2077] END
INPUT "Enter name"; name$ REM to count total no. of passed student
INPUT "Enter address"; address CLS 29. [SLC 2069]
WRITE name$, address$ WHILE NOT EOF ( ) REM display Records of students From Data File
INPUT "do you want to continue"; ans$ OPEN “I”, #1, RESULT.DAT OPEN “STDREC.DAT” FOR INP AS #1
LOOP WHILE UCASE$(ans$)="Y" INPUT #1, ID, M1, M2, M3 PRINT “ROLL”,”NAME”,”ADDRESS”,”CLASS”,”SECTION”
CLOSE #2 IF M1>=32, M2>=32, M3>=32 THEN DO WHILE NOT EOF
END X=X+1 INPUT #1,RN,N$,AD$,CL,S$
END IF PRINT RN,N$,AD$,CL,S$
22. [PABSON 2079 MT] WEND NEXT
REM to display the reverse of the supplied string PRINT “TOTAL RECORD”; X CLOSE #1
DECLARE SUB rev (s$) END END
CLS
INPUT n$ 26. [SLC 2065] 30. [SLC 2070]
CALL rev$(n$) REM Program to sum given two numbers DECLARE SUB Series(.)
END Input ”Enter first number”; x DLC
Input “Enter second number; y EXECUTE Series
SUB rev (n$) PRINT SUM(a,b) END
FOR k=1 TO LEN(n$). END SUB Series
a$ = MID$(n$, 1, k) REM to generate 2 2 4 6 10….. upto 10th term
p$ = p$ + n$ FUNCTION SUM(x,y) P=2
NEXT k SUM=a+b Q=2
PRINT p$ END FOR Ctr=1 TO 5
16
DISPLAY P,Q, OPEN EMP.DOC FOR OUTAS#1 PRINT “Reverse string is:”; D$
P=P+Q INPUT “Enter Name”; N CLOSE SUB
Q=P+Q INPUT “Enter post”; P$
WEND INPUT “Enter salary”; S 38. [SLC 2070 S]
END Series() WRITE #2, N$,P$,S
CLOSE #1 OPEN "STUDENT.DAT" FOR APPEND AS 1#
31. [SLC 2071] END INPUT "NAME"; N$
DECLARE SUB CUBE(N) INPUT "ADDRESS"; ADD$
CLS 35. [SLC 2067 S] INPUT "AGE"; AGE$
FOR I = 1 TO 5 DECLARE SUB Series() WRITE #1, N$, ADD$, AGE
READ CLS END# 1
CALL CUBE(No) EXECUTE Series STOP
NEXT X END
DATA 3, 5, 2, 6, 4 39. [SLC 2071 S]
END SUB Series() DECLARE SUB FIBO ( )
SUB CUBE( ) REM program to generate 1 1 2 3 5…. Up to 20th terms CLS
DISPLAY N^3 A=1 EXECUTE FIBO
END SUB B=1 END
FOR ctr= 10 TO 1
32. [SLC 2072] DISPLAY A;B; SUB FIBO
FUNCTION SUM(m,n) A=A+B REM Program to generate 2, 2, 4, 6, 10…upto 10th terms.
Rem to print sum of two numbers B=A+B A=2
a=6 EXT ctr B=2
b=7 END Series() FOR Ctr = 5 TO 1
DISPLAY SUM(a,b) DISPLAY A; B;
END A=A+B
36. [SLC 2068 S] B=A+B
FUNCTION SUM(m,n) Rem to display the contents of a data file. NEXT Ctr
S=m+n OPEN “Marks.dat” FOR OUTPUT AS #1 END FUNCTION
S=SUM CLS
END SUM WHILE EOF(1) 40. [SLC 2073]
INPUT #1, Name$, Age, Add$ DECLARE SUB SUM(N)
33. [SLC 2065 S] DISPLAY Name$, Age, Add$ INPUT “Any Number”; N
DECLARE SUB Series() WEND PRINT SUM(N)
CLS CLOSE 1 END
EXECUTE Series END SUB SUM (N)
END S=0
SUB Series 37. [SLC 2069 S] WHILE N=0
A=2 Rem program to reverse the string or word R= R MOD 10
B=2 DECLARE SUB REV(W$) S=S+R
FOR ctr= 1 to 5 CLS N=N/10
DISPLAY A;B; INPUT “Enter a word”; W$ WEND
A=A+B CALL REV(W$) PRINT “Sum of digits”;S
B=A+B END END
LOOP ctr SUB REV(W$)
END Series() FOR I=LEN(W$) to 1 step -1 41. [SLC 2074]
C$=LEFT$(W$,I,1) REM TO find the factorial of a given number.
34. [SLC 2066 S] S$=D$+1 DECLARE FUNCTION FACTO (N$)
LOOP CLS
17
INPUT "Enter a number"; X FUNCTION reverse(N$) PRINT Ssum of even numbers:"; S
PRINT "The Factorial is: ", FACTO (N) L = LEN$(N$) DATA 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
END FOR X = L to 1 STEP – 1 END
A$ = MID$(N$, X, I) FUNCTION evenpro(A)
FUNCTION FACTO (N) B$ = B$ + A$ R=A MOD 2
F=1 NEXT X IF R< >0 THEN
WHILE N = 0 B$ = reverse$(N$) A=evenpro
F=F*N END FUNCTION ENDIF
N=N-1 END FUNCTION
WEND 45. [SEE 2075 U]
F = FACTO REM program to read data from the data file. 48. [SEDIPS 2079]
END FUNCTION OPEN “STD.DAT” FOR OUTPUT AS #1 DECLARE FUNCTION vowel(S$)
CLS w$=we love our country
42. [SEE 2073 U] WHILE NOT EOF(#1) v=vowel(w$)
DECLARE SUB Series ( ) WRITE#1, N$, R, C, P PRINT "The total no. of vowel::"; v
CLS PRINT N$, R, C, P END
EXECUTE Series WEND FUNCTION vowel$(S$)
END CLOSE “STD.DAT” c=0
SUB Series END FOR K=1 TO length(S$)
REM Program to print 4 4 8 12 20 ....... 20th terms B$=MID$(S$, K, 1)
X=4 46. [SEDIPS 2081] B$=LCASE$(B$)
Y=4 REM to count total number of values existing among a different SELECT CASE B$
FOR ctr = 10 To 1 number input by a user DIVISIBLE BY 3. CASE "a", "e", "i", "o", "u"
DISPLAY X; Y; DECLARE FUNCTION DIVBY3 (a( ), n) c=c+1
X = X+Y CLS END SELECT
Y = X+ Y FOR CNT=0 TO n-1 NEXT K
Next ctr INPUT "Enter the number"; a(n) C=vowel
End Series NEXT CNT END FUNCTION
Totno=DIVBY3 (a, n)
43. [SEE 2074 U] 49. [NPABSAN 2081]
Rem To print only class 10 record from "student.dat" PRINT "Total number of values divisible by 3 is"; totno DECLARE FUNCTION SQ$ (N)
CLS END CLS
OPEN "I",#2, "Student.Dat" FOR I=1 TO 10
WHILE NOT EOF (#2) FUNCTION DIVBY3( ) DISPLAY SQ (N)
WRITE#2, N$,C,R count=0 NEXT N
IF C=10 THEN FOR CNT=0 to n-1 END
DISPLAY N$,C,R IF a(CNT) MOD 3=0 THEN count=count+1 FUNCTION SQ (N)
END IF NEXT CNT SQ=N^2
NEXT COUNT=DIVBY3 END FUNNCTION
CLOSE #2 END FUNCTION
END 50. [NPABSAN 2080]
47. [SEDIPS 2080] REM Program to add records to an existing file "Student.dat"
REM to calculate the sum of even numbers existing in the set of OPEN "Student.dat" FOR APPEND AS #1
44. [SEE 2075] given numbers. DO
DECLARE FUNCTION reverse$(N$) DECLARE FUNCTION evenpro(A) CLS
INPUT “Any String”; N$ FOR C=1 TO 5 INPUT "Enter name: "; N$
X$ = reverse$(N$) READ N INPUT "Enter Address: "; Ad$
PRINT N$ S=S+evenpro(A) INPUT "Enter Total Marks: "; TM$
END NEXT C COPY #1, N$, Ad$, TM
18
INPUT "Do you want to add more records? Press Y or N: "; CH$ PRINT “THE NUMBER IS “; TEST$ SUB AA (N$)
LOOP WHILE UCASE$(CH$) < > “Y” END R=LEN(N$) \ 2
CLOSE "Student.dat" FUNCTION TEST$(N) E$=RIGHT$(N$,R) + LEFT$(N$,R)
END R = R MOD 2 PRINT E$
IF R = 0 THEN END SUB
51. [NPABSAN 2080 A] A$= “EVEN” Questions:
DECLARE SUB great(p,q) ELSE
CLS A$ = “ODD” a) List the parameter(s) and argument(s) of the program.
INPUT "Any two numbers”; a, b END IF b) List all the string library functions from the program.
DISPLAY great (p, q) A$ = TEST$
END END FUNCTION 3. [SEE 2080 P]
SUB great (p, q) 55. [PABSON 2081 L] DECLARE FUNCTION OUTPUTS(W$)
IF a < b THEN REM To copy all data from sequential data file INFO.DAT to CLS
PRINT p; NEWINFO.DAT. W$="CYBER CRIME"
ELSE OPEN "INFO.DAT" FOR INPUT AS #1 PRINT OUTPUT$ (W$)
PRINT q; OPEN "NEWINFO.DAT" FOR INPUT AS #2 END
END DO WHILE NOT EOF(1)
END SUB LINE INPUT #1, ALL$ FUNCTION OUTPUT$ (W$)
COPY #2, ALL$ FOR M= LEN(W$) TO 1 STEP-2
52. [NPABSAN 2079] WEND M$=M$+MID$(W$, M, 1)
DECLARE SUB sbn() FINISH #1,#2 NEXT M
CLS END OUTPUT$=M$
CALL SUB sbn (14) END FUNCTION
END SUB ANALYTICAL QUESTIONS a Why is $ sign is followed by function name?
SUB sbn() 1. [SLC 2064] Ans: The $ sign is followed by function name because the function
INPUT "enter the variable value”; var DECLARE FUNCTION CELLS$(W$) returns string value.
PRINT "Square of given number"; var^2 W$=”CYBER” b. List the library function used in the above program.
END PRINT CELL$(W$) Ans: The library function used in the above program are LEN( ) and
53. [NPABSAN 2078] END MID$( ).
DECLARE FUNCTION PAL$ (W$) FUNCTION CELL$
CLS K=LEN(W$) 4. [SLC 2065]
INPUT "Enter a word"; W$ FOR I = K TO 1 STEP -2 DECLARE FUNCTION xyz(N)
SHOW PAL$ (W$) M$=M$+MID$(W$,I,1) FOR I = 1 TO 5
END NEXT I READ N
FUNCTION PAL$ (W$) CELLS$=M$ Z=xyz(N)
FOR I= LEN (W$) TO 1 STEP1 END FUNCTION S=S+Z
R$=R$+MID$ (W$, I, 1) a) Why is $(dollar) sign followed in the function name? NEXT I
NECT I b) What will be the output of the program when it is executed? PRINT S
IF R$-W$ THEM c) What will be the output of the program when FOR loop is DATA 10,13,15,4,6
P$="Palindrome" changed as FOR I= 1 TO K STEP 2? END
ELSE d) What is the name of sign “+” used in the program and what
P$="Not palindrome" operation does it perform? FUNCTION xyz(N)
ENDIF IF N MOD 2=0 THEN xyz=N
P$=PAL$ 2. [SEE 2080 L] END FUNCTION
54. [PABSON 2081 K] DECLARE SUB AA (N$) a) What is the name of the function used in the above program?
REM TO CHECK ODD OR EVEN NUMBERS. W$=CYBERCRIME" b) How many times the function will be called in the above program?
DECLARE FUNCTION TEST$(N) CALL AA(W$)
CLS END 3. [SLC 2072]
INPUT “ENTER ANY NUMBER”; N$ DECLARE FUNCTION Prod(N)
19
INPUT “Any number”;N PRINT "Composite number" PRINT “The sum of the two number=”;Sum(A,B)
X=Prod(N) ENDIF END
PRINT X END SUB FUNCTION SUM(A,B)
END a. What is the name of sub procedure? S=A+B
b. List the local variable. Sum=S
FUNCTION Prod(N) END FUNCTION
F=1 a) List the numerical variables used in the above program.
FOR K=1 TO N 7. [SEE 2080 P] b) Will the program run if the first line (i.e. DECLARE….) is
F=F*K deleted?
NEXT K DECLARE FUNCTION prod(a,b)
Prod=F CLS
END FUNCTION INPUT "Enter first number" ;a 10. [SEE 2073]
INPUT "Enter second number" ;b DECLARE FUNCTION Diff(A, B)
a) Write the name of the user defined function used in the above PRINT "The product of two number is" ;prod(a,b) CLS
program. END INPUT “Enter first number”; A
b) Name the loop in the above program. INPUT “Enter second number”; B
FUNCTION prod(a,b) PRINT “The difference”; Diff(A, B)
P=a*b END
5. [SLC 2071 S] Prod=p FUNCTION Diff(A, B)
DECLARE FUNCTION JPT (N) END FUNCTION Difference= A – B
FOR ctr = 1 TO 6 Diff = difference
READ N i) List the numerical variables used in above program. END FUNCTION
J = JPT (N) List all the numeric variables used in th
Sum = Sum + J ii) List the local variables used in above program. above program
NEXT ctr List the local variables used in the above program.
PRINT Sum
DATA 10, 20, 30, 40, 50, 60 8. [SLC 2067] 11. [SLC 2067 S] [SEE 2078 GP] [SEE 2079 GP]
END DECLARE SUB SUM(N)
INPUT”ANY NUMBER”;N DECLARE FUNCTION Prod(A,B)
FUNCTION JPT (N) CALL SUM(N) CLS
IF N MOD 2 = 0 THEN JPT = N END INPUT “Enter first number:”;A
END FUNCTION SUB SUM(N) INPUT “Enter second number:”;B
S=0 PRINT “the product of two number=”;Prod(A,B)
a) What is name to the function used in the above program? WHILE N<>0 END
b) How many times the function will be executed in the above R=N MOD 10 FUNCTION Prod(A,B)
program? S=S+R P=A*B
N=N\10 Prod=P
6. [SEE 2078 NP] WEND END FUNCTION
DECLARE SUB PC$ (N) PRINT “SUM”;S a) List all the numerical variables used in the program.
CLS END SUB b) List all the local variables used in the program.
INPUT "Enter a number"; N i) In which condition the statements within the WHILE….WEND
CALL PC$ (N) looping statement will not be executed? 12. [SEE 2074]
END ii) Will the output be the same if we place “/” instead of”\” in the DECLARE FUNCTION SUM (N)
SUB PC$ (N) above program. CLS
FOR I=2 TO N-1
R=N MOD I 9. [SLC 2070] INPUT "Enter any number"; N
IF C=0 THEN DECLARE FUNCTION Sum(A,B) S = SUM (N)
PRINT "Prime number" INPUT “Enter first number:”; A PRINT "The Sum of individual digit is"; S
ELSE INPUT “Enter second number:”; B END
20
DECLARE FUNCTION ABC$(N$)
FUNCTION SUM (N) CLS
WHILE N > 0 INPUT “ENTER ANY WORD”; W$ 18. [SEE 2080 NP]
R = N MOD 10 PRINT “THE RESULT STRING IS”; ABC(W$) DECLARE FUNCTION Calculate (X,Y)
T=T+R END CLS
N = N \ 10 INPUT "Enter a multi-digit number"; N
WEND FUNCTION ABC$ (N$) LET S = Calculate (N,T)
SUM = T FOR I=1 TO LEN (N$) PRINT "The sum =”; S
END FUNCTION P$=MID$ (N$,I,1) END
R$=P$+R$
a) State the purpose of suing variable S in line 4 in above program. NEXT I FUNCTION Calculate (X,Y)
b) Write the use of MOD in the above program. SHARED R$ WHILE X < > 0
ABC$=R$ R=X MOD 10
END FUNCTION Y=Y+R
13. [SEE 2080 P] X=X\10
DECLARE SUB FACTORS(N) a) List the arguments and parameters used in above program WEND
N=10 b) What is the use of SHARED in above program? Calculate = Y
CALL FACTORS(N) END FUNCTION
END a) List formal parameters and real parameters of procedure
16. [SEE 2080 PB] Calculate'.
SUB FACTORS(N) DECLARE SUB question (a, b, c) b) What is the purpose of the above program?
FOR J=1 TO N CLS
R=N MOD J x=10: y=20 : z=15
IF R=0 THEN PRINT J; CALL question(x,y,z) 19. [SEE 2078] [SEE 2074 U]
NEXT J END DECLARE FUNCTION TEST(X)
END SUB SUB question(a,b,c) X=100
a = a +10 Z=TEST(X)
Questions: b=b+a PRINT Z
a) Write down the use of MOD in the program. c=a+b END
PRINT a,b,c
b) How many time the loop executes in the above program? END SUB FUNCTION TEST(X)
a) What would be its output if x=1,y=2, z=3? FOR R=1 TO X
14. [SEE 2075 S2] b) Write actual and formal parameters used in the program. S=S+I
DECLARE SUB TRIM(W$) NEXT R
CLS 17. [SEE 2078 P] TEST=S
INPUT "Enter word"; WO$ DECLARE FUNCTION test$ (A$) END FUNCTION
CALL TRIM(WO$) CLS
END INPUT “ENTER ANY WORD”; T$ a) How many parameters are used in the above program?
SUB TRIM (W$) PRINT test$(t$) b) How many times does the statement S=S+I execute in the above
FOR I = 1 TO LEN(W$) END program?
PRINT LEFT$(W$, I) FUNCTION test$ (A$)
NEXT I FOR M = LEN(A$) TO 1 STEP -1 20. [SEE PABSON 2080 PD]
END SUB C$= C$+ MID$(A$, M,1) DECLARE FUNCTION text$(N$)
NEXT M CLS
a) What will be the maximum value of I if input string is “SEE” in Test$ = C$ INPUT "Enter any string":X$
the above program? END FUNCTION PRINT text$(X$)
b) List the real parameter used in the above program. a) List the formal and actual parameters used in the program given END
above.
15. [SEE 2079 B] b) List the library function used in the above program. FUNCTION text$(N$)
21
FOR i=len (N$) TO 1 STEP-1 END SUB
W$=W$+MID$(N$,i,1) 23. [SLC 2065 S] a) List any two variables used in the above program.
NEXT i DECLARE FUNCTION Diff(A,B) b) How many times SUB-procedure will be called when program is
text$ = WS CLS executed?
NEXT Q INPUT “Enter first number”;A
END FUNCTION INPUT “Enter second number”;B 26. [SLC 2069 S]
DECLARE FUNCTION CHK$(N)
Questions: PRINT “The difference of the two number=”;Diff(A,B) CLS
END N=57
a) What is the main objective of above program? FUNCTION Diff(A,B) PRINT “The number is”; CHK$(N)
b) List all the parameters used in above program. D=A-B END
Diff=D FUNCTION CHK$(N)
21. [SEE 2079] [SEE 2078 GP] END FUNCTION FOR I = 1 TO N
DECLARE FUNCTION SUM(N) a) What will be the output of the program if the user enters 200 as the IF N MOD I = 0 THEN C=C+1
CLS first number and 100 as the second number. NEXT I
INPUT “Enter any number”; N b) Will the program run if the first line (i.e. DECLARE…..) is IF C>2 THEN
X=SUM(N) deleted? CHK$=”Composite”
PRINT “The sum of individual digit is “; X ELSE
END CHK$=”Prime”
FUNCTION SUM(N) 24. [SEE 2080 P END IF
WHILE N<>0 DECLARE SUB TEST(A$) END FUNCTION
R=N MOD 10 CLS a) Will the above program execute if “DECLARE FUNCTION….”
S=S+R A$= “COMPUTER” Is deleted
N=INT(N/10) END b) Why $ sign is used in the name of the above function
WEND
SUM=S SUB TEST (A$) 27. [SEE 2073 U]
END FUNCTION L= LEN(A$)
FOR I = L TO 1 STEP -2 DECLARE FUNCTION SUM (A, B)
a) Write the function of INT. PRINT MID$(A$, I, 1) INPUT A
b) How many times does the WHILE ….WEND loop repeat if the NEXT I INPUT B
value of N is 123? END SUB X = SUM (A, B)
PRINT X
a) What statement should be added in the main module to execute END
22. [SEE 2080 P] the program? FUNCTION SUM (A, B)
DECLARE SUB string(x$) b) List out the variables used in the above program with types. S = A+B
CLS SUM = S
X$=“COMPUTER" 25. [SLC 2068 S] END FUNCTION.
CALL string(X$) DECLARE SUB ABC(X,Y,Z) a) Write the name of local variable used in the above FUNCTION
END FOR P=1 TO 3 procedure.
READ A,B,C b) Write the Mathematical operator and Relation operator used in
SUB string(x$) CALL ABC(A,B,C) above program.
L=LEN(X$) NEXT P
FOR A = L to 1 step -2 DATA 5,4,3,2,1,6,7,8,4
PRINT MID$(x$.A,1); END 28. [SLC 2070 S]
NEXT A SUB ABC(X,Y,Z) DECLARE FUNCTION rev$ (N$)
END SUB T=X+Y+Z INPUT "Any string"; N$
Questions: IF T MOD 2 = 0 THEN PRINT rev$ (N$)
a) What is the value of L in the above program? PRINT T END
b) List the numeric and string variable in the above program. END IF FUNCTION rev$ (N$)
22
FOR X = LEN (N$) to 1 STEP -1 FUNCTION COUNT(z$)
A$=MID$ (N$, X, 1) 31. [SEE 2080]
B$ = B$ + A$ DECLARE FUNCTION Count (W$) m=LEN(z$)
NEXT X INPUT "Enter a word"; R$ v$=UCASE$(z$)
rev$ = B$ C = Count (R$) FOR I = 1 TO m
END FUNCTION PRINT C v$=MID$(z$,I,1)
List the library function used in the above program. END IF v$= "A","E","I","O","U" THEN
What will be the maximum value of X if the N$ is equal to FUNCTION Count (W$) g=g+1
"Computer". FOR L = 1 TO LEN (W$) END IF
Ch$MID$ (W$, L, 1) NEXT I v
29. [SEE 2080 P IF UCASES (Ch$) = "K" THEN owel =g
DECLARE FUNCTION num (N) N=N+1 END FUNCTION
FOR 1=1 to 5 END IF
READ N NEXT L What is the name of the functions used in the above program.
Z=num(N) Count = N
S=S+Z END FUNCTION Write down the missing statement in the main module to execute the
NEXT 1 program.
PRINT S List any two library functions used in the above program.
DATA 11, 14, 16,5, 7 34. [SEE 2080 P
END Write the use of variable 'C' in line 3 [i.e. C = Count (R$)] given in DECLARE FUNCTION prod(x,y)
the above program. CLS
FUNCTION num (N) INPUT "Enter first number" ;x
IF N MOD 2=0 THEN num =N 32. [SLC 2068] INPUT "Enter second number" ;y
END FUNCTION Declare function count(N$) PRINT "The product of two number is" ;prod(x,y)
Input “Enter a word”; R$ END
Questions: C= Count(R$)
Print C FUNCTION prod(x,y)
a) List the library functions used in the above program. END P=x*y
b ) Write the name of the function used in the above program. Function count(N$) Prod=p
For k=1 to LEN(n$) END FUNCTION
30. [SLC 2066 S] X$=MID$(N$,K,1)
DECLARE FUNCTION COUNT(A$) IF UCASE$(X$)=”A” then List the numerical variables used in above program.
Input “Enter a word”; W$ X=X+1
END End if List the local variables used in above program.
Next K
Function Count(A$) Count = X
B=LEN(A$) End function 35. [SEE 2080 P]
C$=UCASE$(A$) i) List any two library functions used in the above program.
FOR I=1 TO B ii) Write the use of variable „C‟ inline 3 [i.e. C=Count(R$)] given in DECLARE FUNCTION COUNT (NS)
E$=MID$(C$,I,1) the above program. INPUT "Enter a word"; RS
IF E$=”A” OR E$=”E” OR E$=”I” OR E$=”O” OR E$=”U” C=COUNT(RS)
THEN C=C+1 PRINT C
END IF END
NEXT I 33. [SEE 2080 P]
COUNT=C DECLARE FUNCTION COUNT(z$) FUNCTION COUNT(NS)
END FUNCTION CLS FOR K=1 TO LEN(NS)
a) List the string Library functions used in the above program. INPUT"ENTER A WORDS="; z$ XS=MIDS(NS,K,1)
b) Write down the missing statements in the main module to execute END IF UCASES(XS)="A" THEN
the program. X=X+1
23
END IF 38. [SLC 2069]
NEXT K DECLARE SUB EXAM(N$) 41. [SEE 2080 R]
COUNT=X CLS DECLARE SUB TEST (A, B)
END FUNCTION INPUT “Enter word”;WO$ CLS
CALL EXAM(WO$) X= 7
Questions: END Y=5
SUB EXAM (N$) CALL TEST (X, Y)
a) List any two library functions used in above program. FOR I = 1 TO LEN (N$) END
PRINT RIGHT$(N$,I)
b) Write the use of variable "C" in line 3 [i.e. C=COUNT(RS)] given NEXT I SUB TEST (A, B)
in the above program. END SUB FOR I = A to B STEP -1
a) Write the names of two built-in functions used in the above A = A+ B
36. [SEE 2080 P] program. B=B+A
DECLARE FUNCTION NUM(N) b) List the real parameter in the program. NEXT I
INPUT N END SUB
S = NUM(N) 39. [SLC 2066]
PRINT S DECLARE FUNCTION Num(N)
END INPUT N a. List the formal parameter and argument.
FUNCTION NUM(N) S=Num(N)
X = INT(17/N) PRINT S b. Which loop is used in the above program?
Y =15 MOD N END
NUM = X + Y 42. [SEE 2080 PC]
END FUNCTON FUNCTION Num(N) DECLARE FUNCTION text$(N$)
X=Int(17/N) CLS
i. What is the name of function used in above program? Y=15 MOD N INPUT "Enter any string":X$
Num=X +Y PRINT text$(X$)
ii. List the mathematical function used in above program. END FUNCTION END
i) Write the name of the function used in the above program.
37. [SLC 2071] ii) List out the mathematical function (Library function) used in the FUNCTION text$(N$)
DECLARE SUB Stde(N$U) above program. FOR i=len (N$) TO 1 STEP-1
FOR Loop = 1 TO 5 W$=W$+MID$(N$,i,1)
READ NM$(Loop) NEXT i
NEXT Loop 40. [SEE 2080 P] text$ = WS
DATA RAMA, PRATIMA, PRASANT DECLARE FUNCTION ODDEVEN$(N) NEXT Q
DATA NISHA, RUDHRA CLS END FUNCTION
CALL Stde(NM$U) INPUT ”Enter a number”; N
END PRINT “Number is”; ODDEVEN$(N) Questions:
SUB Stde(N$U) END
PRINT “Name starting from P” a) What is the main objective of above program?
FOR J = 1 TO 5 FUNCTION ODDEVEN$(N) b) List all the parameters used in above program.
C$=MID$(N$,(J),1,1) IF N MOD 2=0 THEN
IF C$=”P” THEN MS$=”even”
PRINT N$(J) ELSE
END IF MS$=”odd” 43. [SEE 2075]
NEXT J END IF
END SUB ODDEVEN$=MS$ DECLARE SUB SUM(N)
a. List the library function used in the above program. END FUNCTION N=5
b. List the conditional statement used in the above program. a) What is the main objective of above program? CALL SUM (N)
b) What is the use of MOD in above program?. END
24
a) Variable P remained uncalled in the main module. Why? END
SUB SUM(N) b) Find the output if the user supplies P=9 and c=4 running the Questions:
FOR X = 1 TO N program. a) List the variables used in above program.
S =S + X
NEXT X 46. [SEE MODEL 2067] b) What is the name of data file used in above program?
PRINT S OPEN “Detail.dat” FOR INPUT AS #1
END SUB OPEN “Temp.dat” FOR OUTPUT AS #2 49. [SEE 2079 S]
a) In the above program how many times does the FOR INPUT “Enter name of the students”; S$ OPEN “MARKINFO.TXT” FOR INPUT AS #1
………..NEXT loop executes? FOR I=1 TO 10 OPEN “TEMP.TXT” FOR OUTPUT AS #2
b) Write the name of the procedure used in the above program. INPUT #1, Nm$, Cl, A CLS
IF S$< >Nm$ THEN DO UNTIL EOF(1)
44. [SEE 2075 U] WRITE #2, Nm$, Cl, A INPUT #1, REGISTRATIONNUMBER,
DECLARE SUB TEST (N$ ) END IF STUDENTNAME$, ENGLISH, NEPALI,
INPUT N$ NEXT I MATHEMATICS
CALL TEST ( N$ ) CLOSE #1, #2 IF MATHEMATICS<20 THEN
END KILL “Detail.dat” MATHEMATICS=MATHEMATICS+10
NAME “Temp.dat” AS “Detail.dat” END IF
SUB TEST (N$ ) END WRITE #2, REGISTRATIONNUMBER,
FOR P = 1 TO LEN ( N$ ) a. What is the main objective of the program given above? STUDENTNAME$, ENGLISH, NEPALI,
B$ = MID$ (N$, P, 1) b. Do you get any problem in the above program if “Kill” MATHEMATICS
IF LCASE$ (B$) = “a” THEN statement is removed? Give reason. LOOP
C=C+1 CLOSE#1
END IF 47. [SEE 2079 NP] CLOSE #2
NEXT P OPEN "student.txt" FOR OUTPUT AS #1 KILL “MARKINFO.TXT”
PRINT C OPEN "Tem.txt" FOR INPUT AS #2 NAME “TEMP.TXT” AS “MARKINFO.TXT”
END SUB WHILE NOT EOF (2) END
INPUT #2, reg, Name$, Add$ a) What is the main objective of the program given above?
a) Write the name of the sub procedure used in the above program. IF reg>10 AND reg <20 then b) Do you get any problem in above program if “Kill” statement is
WRITE #1, reg, Name$, Add$ removed? Give reason.
b) Write any two library functions used in the above program. END IF
WEND 50. [SEE 2080 S]
45. [SEE 2080 K] CLOSE #1, #2 OPEN "BUSRIDER.TXT" FOR INPUT AS #1
DECLARE FUNCTION MATH$(R) END OPEN "TEMP.TXT" FOR OUTPUT AS #2
CLS CLS
DIM SHARED P ( a) Write down the mode used in above program WHILE NOT EOF (1)
INPUT "Enter first number:"; P (b) Write the name of String variable used in file based on above INPUT #1, STUDENTNAME$, CLASS, BUSCODE, BUSSTOP$
INPUT "Enter second number:"; C program. IF UCASE$(BUSSTOP$) < > UCASE$("KATHMANDU") THEN
Y$ = MATH$(C) WRITE #2, STUDENTNAME$, CLASS, BUSCODE, BUSSTOP$
PRINT Y$ 48. [SEE 2080 P] PRINT STUDENTNAME$, CLASS, BUSCODE, BUSSTOP$
END CLS
OPEN "INFO.DAT" FOR INPUT AS #5 END IF
FUNCTION MATH$(R) TOP:
F=100 MOD R INPUT "ENTER NAME"; N$ WEND
IF 20 MOD P > 3 AND F < P THEN INPUT "ENTER ADDRESS";A$ CLOSE #1 #2
MATH$=”True” INPUT "ENTER PHONE NUMBER";P KILL BUSRIDER.TXT"
ELSE WRITE #5, N$, A$, P NAME "TEMP.TXT" AS "BUSRIDER TXT”
MATH$=”False” INPUT "DO YOU WANT TO CONTINUE (Y/N)?"; AN$ END
END IF IF UCASE$ (AN$) = "Y" THEN GOTO TOP
END FUNCTION CLOSE #5 a) What is the main objective of the program given above?
25
28. (684)10 into octal 20. 1010-111/101
b) Do you get any problem in above program if "Kill" statement is 29. (2074)10 into hexadecimal 21. 1 0 1 – 1 1
removed? Give reason. 30. (99)10 = (?)16 22. 110111 - 11001
31. (AC3)16 into decimal 23. 110111-1011
51. [SEE 2080] 32. (31A)16 into binary 24. 10101 – 1011
33. (7AF)16 into binary 25. 1011+1101
OPEN “EMP.DAT” FOR INPUT AS #1 34. (ABC) 16 = (?)2 – (1011)2 = (?)2
DO 35. (ABC)16 = (?)8 27. (1011) 2 × (101) 2 + (101) 2 =(?)2
INPUT #1, N$, A$, S 36. (110010)2 into octal 28. (1001 + 110)2 – (1000)2
IF UCASE$(A$)=”KATHMANDU” THEN 37. (1101101)2 into octal 29. 110 / 10
PRINT N$, A$, S 38. (1111001)2 into octal 30. Divide 1101 by 11
END IF 39. (1101010)2 into octal. 31. 1110 / 11
LOOP WHILE NOT EOF(1) 40.(1010111)2 into octal 32. 1010 / 10
CLOSE #1 41. (10011011)2 = (?)8 33. 1101 ÷ 101
END 42. (1011100111)2 into Hexadecimal. 34. 1101 / 111
a. Write the use of statement “INPUT #1, N$, A$, S” in the above 43. (1011011011)2 into hexadecimal 35. (10011) ÷/10
program. 44. (11001101)2 = (?)16 36. 10101 / 11
b. What happens if you remove “UCASE$” from the above 45. (10110011)2 – (?)16 37. 100101 / 110
program? 46. (11111101)2 = (?)16 38. 111010 / 110
47. (537)8-(x)2 100101 ÷ 101
NUMBER SYSTEM 48. (756)8 into binary 39. 111100/1000
2. a) Perform the conversion as per the direction: 49. (173)8 into binary 40. 100101 / 110
1. (1011)2 into decimal 50. (523)8 into binary (101101)2 / (11) 2
2. (101011)2 into decimal 51. (AB)16 into binary 41. (10101)2 / (11)2
3. (104)8 into decimal 52. (CA3)16 into binary 42. (101101) / (101)
4. (364)8 into decimal 53. (FAC)16 into binary 43. (10110)2 ÷ (101)2
5. (227)8 into decimal 54. (FA)16 into binary
6. (78)8 into decimal 55. (BAD)16 into binary
7. (442)8 into decimal 56. (BED)16 into binary IMPORTANT THEORY QUESTIONS
8. (765)8 into decimal 1. What is social media? Write any two examples of data
9. (74)8 to decimal 1. 11x11 communication.
10. (546)8 into decimal 2. 111×11 2. What is computer network? Write any two reasons for computer
11. (CCA)16 into decimal 3. 111×10 network.
12. (39C)16 into decimal 4. 110*11 3. Write any two advantage and disadvantage of computer network.
13. (208)10 into Binary 5. 101 x 10 4. What is communication channel? Write any two features of
14. 209)10-(x)2 6. 101 x 111 Guided media.
15. (217)10 into binary 7. 110 x 101 5. What is unguided media? Give the name of any two unguided
16. (108)10 into binary 8. 1011 x 11 transmission media
17. (101)10 into binary 9. 1010 x 10 6. Differentiate between guided and unguided communication media.
18. (168)10 into binary 10. 1011 × 101 7. What is network protocol? List out any four services of internet.
19. (108)10 into binary 11. (1010) x (111) 8. Give two-two difference between peer-to-peer and client/server
20. (524)10 = (?)2 12. (10110) 2 x (101)2 = (?)2 network architecture.
21. (435)10 = (?)2 13. (1010) 2 x (101) 2 =(?)2 9. What is the function of file transfer protocol (FTP)?
22. (410)10 = (?)2 14. (101)2x (101)2=(?)2 10. Give the importance of MODEM to the computer network.
23. (214) 10 = (?)2 15. 11 × 10 + 11 11. Define network topology and write any two types of topology.
24. (245)10 = (?)2 16. 11x11+11 12. Write any two advantages of BUS topology.
25. (479)10 into octal 17. 11x11 – 101 13. Define star topology with figure.
26. (420)10 into octal 18. 11011x110-11101 14. Draw the diagram of BUS topology. Write any two advantage of
27. (524)10 into octal 19. 1010-11+11 star topology.
26
15. What is bandwidth? Write the use/function of File Transfer 49. Define virtual reality. Write any two areas where virtual reality is 0021 Deepanjali 73
Protocol. used. 87. Define modular programming. Write any two advantages of
16. Define Bus topology? Write any two advantages of Bus topology. 50. Write any two benefits of e-governance service. modular programming
17. What is internet? Write any two advantages of Internet. 51. What is database? Name any two examples of database. 88. Write down one difference between function and sub procedure.
18. What is Search Engine? Give any two examples of search engine. 52. What is DBMS? Write any two examples of DBMS software. 89. Write any one difference between Q-Basic and C language.
19. Define web browser with examples. 53. Write any two advantages of computerized database. 90. What is procedure? Which statement is used to call sub-
20. What is E-mail? Give an example of valid E-mail I.D. 54. Define data type. Name any four data types that can be defined in procedure?
21. Give two advantages of e-mail over traditional mail. MS-ACCESS. 91. What is formal parameter? What is user defined function?
22. Define computer ethics. Write any four commandments of 55. While designing table structure which data types are suitable to 92. What is a loop? What is a variable? 1
computer ethics. store information about teacher‟s 93. Define global and local variables.
23. Write any one reason why social media is popular now days. name, address, salary, and date of birth. 94. Write one difference between String function and Numeric
24. Write any two advantages and disadvantages of social media. 56. What data types are used to store salary and date of the birth? function.
25. What is computer security? Write any four possible threats to 57. Name any four objects of MS-Access database. 95. Define logical operators. What is meant by mode of data file?
computer security. 58. Define data and information. 96. List any two data type used in C language.
26. What is hardware security? Write any two protection measures of 59. What is primary key? Write any two importance. 97. Write any two characteristics of C language.
software security. 60. Write any two things to be considered after assigning primary 98. Write any two advantages of Structured programming.
27. What is software security? Write any two measures of hardware key for a field. 99. List the different types of procedures in QBasic.
security. 61. What is data redundancy? How can it be reduced in database? 100. Which format specifier do you use in C language for 'int' data
28. What are the computer security threats? Mention any two 62. What is a form? Write any two advantages of using form. type ?
measures to protect from security threats. 63. Write down any two advantages of Query. Why is reporter 101. Write down the functions of:
29. Give the importance of UPS to the computer system. created?
30. Write the importance of power protection device to protect 64. Differentiate between fields and records with an example. RMDIR ,NAME ,CLOSE, MKDIR, KILL FILES ,EOF
computer system 65. What are validation text and validation rule? SHARED COMMON SHARED CALL WRITE# OPEN INPUT#
31. What is Backup? How it helps to secure data? 66. What is data sorting? List any two advantages of using it.
32. Write the importance of backup in data and software security. 67. What type of work is done in MS-Access using form and query Analaytical Questions
33. What is password? Write any two importance of password object. 1. DECLARE SUB TEST(A, B, C)
protection. 68. What is query? List two types of it. LET X=4
34. What is cybercrime? Give any two examples. 69. Which object of MS-Access is used to retrieve data from the LET Y=7
35. Define cyber law. List any two main aims of formulating cyber table? LET Z=12
law in Nepal. 70. Which type of query do you use to calculate the total marks of CALL TEST (X, Y, Z)
36. What is anti-virus? Write down any two examples of anti-virus students from table in MS Access? PRINT X, Y, Z
software. 71. Give the differences between the Select Query and Action Query. END
37. What is a computer virus? Write any two medium for 72. Define report and mention any two uses of it.
transmission of computer virus. 73. Write any two elements of database. What is the default SUB TEST(A, B, C)
38. Write any four preventive measures to protect computer system extension of MS-Access? A=A+3
from virus infection. 74. What is the default size of text field in MS-Access? B=B+2
39. Write any four symptoms that show, computer is infected by 75. List any four features of MS-Access. SUM=A+B+C/3
computer virus. 76. Which data type is used to store alpha numeric characters or PRINT SUM
40. What is Ecommerce? Write any two names of Nepali e- special symbols in MS-Access? END SUB
commerce sites. 77. Which data type is used to store date of birth in MS-Access? i) What happens if CALL TEST(X, Y, Z) is replaced by CALL
41. Write any two benefits of e-commerce. 78. Which data type is suitable to store photographs of students in TEST(A, B, C)
42. What is the business done through internet? MS-Access? Ans: If CALL TEST(X, Y, Z) is replaced by CALL TEST(A, B, C)
43. What is the business done through the mobile? 79. Which in the logical data type of MS-Access? then the output will be:
44. What is M-Commerce? Write any two important services. 80. Which view is used to modify a table structure in MS-Access? 5
45. Give two differences between E-commerce and Traditional 81. What is the maximum length of the field name in MS-Access? 4 7 12
Commerce. 86. Identify a record and field name from the following table ii) List the formal and real parameters used in the above program.
46. What is IoT? Write any two importance of it. structure: Ans: Formal Parameters = A, B, C
47. Define Artificial Intelligence with examples. Symbol no Name Marks Real Parameters = X, Y, Z
48. Write any two uses of AI. 0011 Aayesha Amatya 74 2. DECLARE SUB word(B$)
27
CLS END CLS
A$ = “Computer science” FOR CNT= 1 TO 3
B$ = “Computer Programming” SUB SEQUENCE (C,B,A) READ NUM
Call word(a$) PRINT A,B,C PRINT ADD (NUM)
Print A$ END SUB NEXT CNT
Call word (B$) i. List the formal parameters and actual parameters used in the above DATA 8, 7, 3
End program. END
Ans: Formal parameter = C, B, A
SUB WORD (c$) Actual parameter = X, Y, Z FUNCTION ADD(N)
L = LEN(C$) ii. Will the above program execute if the position of parameter is to S=0
post = (80 – L)/2 be changed? If „yes‟ then which sequence of number list will it print FOR G=1 TO N
Print tab (post); C$ either 10,20,30 or 30,20,10? S=S+G
C$ = “examination” Ans: it will print 30, 20, 10 NEXT G
END SUB ADD=S
5. DECLARE SUB ADD(A,B) END FUNCTION
i)Write the output of the above program. CLS
Ans: The output of the program is: INPUT “ENTER TWO NUMBERS”; X,Y i. Name the actual and formal parameter used in above program.
Computer Science CALL ADD(X,Y) Ans: Actual parameter = NUM
examination END Formal parameter = N
Computer Programming SUB ADD(A,B)
ii) How is the arguments passed? C=A+B ii. What is the value of NUM when the value of CNT is 2?
Ans: Argument is passed by reference PRINT “Sum is”; C Ans: The value of NUM will be 7 when the value of CNT is 2.
iii) What will the print A$ statement in module print? END SUB
Ans: A$ statement will print examination. i. Write the name of procedure in above program. 8. DECLARE SUB RESULT (N)
iv) Is C$ actual or formal parameter? Ans: The name of the procedure is ADD. CLS
Ans: C$ is formal parameter ii. List arguments and parameters in the above program. INPUT "ENTER ANY NUMBER"; NUM
3. DECLARE SUB question (a, b, c) Ans: Arguments = X, Y CALL RESULT (NUM)
CLS Parameters= A, B END
x=10 : y=20 : z=15 6. DECLARE SUB TEST (A, B, C) SUB RESULT (N)
CALL question (x, y, z) LET X = 4 DO UNTIL N = 0
END LET Y = 7 R = N MOD 10
SUB question (a, b, c) LET Z = 12 IF R MOD 2 = 0 THEN
a=a+10 CALL TEST (X, Y, Z) S=S+R
b= b + a PRINT X, Y, Z END IF
c=a +b END N = N \ 10
PRINT a, b, c SUB TEST (A, B, C) LOOP
END SUB A=A+3 PRINT S
i. Write actual and formal parameter used in the program. B=B+2 END SUB
Ans: Actual parameter = x, y, z SUM=A+B+C/3 i. List the actual and formal parameters in the above program.
Formal parameter = a, b, c PRINT SUM Ans: Actual parameter = NUM
ii. What would be its output if x=1, y=2,z=3? END SUB Formal parameter = N
Ans: The output will be: i. What will be the output of the above program? ii. What will be the output of the program if the input is 1234?
11 13 24 Ans: The output is: Ans: The output is 6
4. DECLARE SUB SEQUENCE (A,B,C) 20 9. [SLC 2069]
CLS 7 9 12 DECLARE SUB EXAM (N$)
X=10 ii. List the arguments and parameters used in the above program. CLS
Y=20 Ans: Arguments = X, Y, Z INPUT "Enter Word", WO$
Z=30 Paramarers = A, B, C CALL EXAM (WO$)
CALL SEQUENCE (X,Y,Z) 7. DECLARE FUNCTION ADD(N) END
28
Ans: The output is: Global variables = X, Y and N
SUB EXAM(N$) 1110 14. DECLARE SUB SERIES(X, Y, Z)
FOR I=1 TO LEN (N$) 12. DECLARE SUB TEST(A,B) DECLARE FUNCTION SUM(X, Y)
PRINT RIGHT$(N$,1) CLS DIM SHARED I
NEXT I X=2: Y=2 CLS
END SUB CALL TEXT(X,Y) INPUT “Enter First Term”;X
i. Write the names of two built in functions used in the program. PRINT X,Y INPUT “Common Difference”;Y
Ans: The names of two built in functions are LEN and RIGHT$ END INPUT “Enter Number of Terms to be generated”; Z
ii. List the real parameter and formal parameter in the program. SUB TEST(P,Q) CALL SERIES(X, Y, Z)
Ans: The real parameter is WO$ and formal parameter is N$ FOR I= P TO Q END
10. DECLARE SUB RESULT (TXT$) P=P+Q
TEXT$ = "SYSTEM PROGRAMMING" Q=P+Q SUB SERIES (X, Y, Z)
CALL RESULT (TEXT$) NEXT FOR I = 1 TO Z
END PRINT P,Q PRINT X
END SUB X = SUM(X, Y)
SUB RESULT (TXT$) i. What will be the output of the above program? NEXT I
FOR I = 1 TO LEN(TXT$) Ans: The output is END SUB
SCAN$ = UCASE$(MID$(TXT$, I, 1)) 4 6 FUNCTION SUM (X, Y)
IF I MOD 2 = 0 THEN 4 6 SUM=X+Y
TEMP$ = TEMP$ + UCASE$(SCAN$) ii. List down the global variable used in the above program. END FUNCTION
ELSE Ans: The global variables are X and Y a) What will be the output of the program if the user inputs 2, 3, 4
TEMP$ = TEMP$ + LCASE$(SCAN$) for the variables X, Y, Z respectively?
END IF 13. DECLARE SUB SERIES(A, B) Ans: The output is:
NEXT I DECLARE FUNCTION SUM(P,Q) 2
PRINT TEMP$ COMMON SHARED N 5
END SUB INPUT “Enter First Term”;X 8
i.What is the output of the above program? INPUT “Enter Second Term”;Y 11
Ans: The output is INPUT “Enter Number of Terms to be generated”; N b) How many times the function SUM(X, Y) will be executed if
sYsTeM PrOgRaMmInG CALL SERIES(X, Y) the values of X, Y, Z are 2, 4, 6 respectively?
ii.List the actual and the formal parameters used in the program. END Ans: The function will execute 6 times.
Ans: The actual parameter is TEXT$ and formal parameter is TXT$ SUB SERIES (A, B) c) What type of variables X, Y and I are?
11. DECLARE FUNCTION NUM(N) FOR I = 1 TO N Ans: X, Y and I are numerical variables.
CLS PRINT A d) Will the program run if the value of Z is less than X and Y?
N=14 A=SUM(A,B) Ans: Yes, the program will run.
PRINT NUM(N) NEXT I
END END SUB 15. [SLC 2066]
FUNCTION SUM (P,Q) DECLARE FUNCTION Num(N)
FUNCTION NUM(N) SUM=P+Q INPUT N
WHILE N<>0 END FUNCTION S=Num(N)
R=N MOD 2 i. What will the output if X=10, Y=8 and N=5. PRINT S
S=S+R*10^P The output is END
P=P+1 10
N=N\2 18 FUNCTION Num(N)
WEND 26 X=Int(17/N)
NUM=S 34 Y=15 MOD N
END FUNCTION 42 Num=X +Y
i. List the local variable used in the function procedure. ii. List out the local variables and global variable in the above END FUNCTION
Ans: The local variables are N, R, S and P program. i. Write the name of the function used in the above program.
ii. What will be the output if the program? Ans: Local variables = A, B, I, P and Q
29
Ans: The name of the function is Num. INPUT “Enter first number”;A Ans: The name of the user defined function used in above program is
ii. List out the mathematical function (Library function) used in the INPUT “Enter second number”;B Prod.
above program. PRINT “The difference of the two number=”;Diff(A,B) b) Name the loop in above program?
Ans: The library function is Int( ) END Ans: The name of loop is FOR….NEXT loop.
FUNCTION Diff(A,B)
16. [SLC 2065] D=A-B [SLC 2069 S]
DECLARE FUNCTION xyz(N) Diff=D 21. DECLARE FUNCTION CHK$(N)
FOR I = 1 TO 5 END FUNCTION CLS
READ N i. What will be the output of the program if the user enters 200 as the N=57
Z=xyz(N) first number and 100 as the second number. PRINT “The number is”; CHK$(N)
S=S+Z Ans: The output is: END
NEXT I The difference of the two number=100
PRINT S ii. Will the program run if the first line (i.e. DECLARE…..) is FUNCTION CHK$(N)
DATA 10,13,15,4,6 deleted? FOR I = 1 TO N
END Ans: Yes, the program will run if the first line (i.e. DECLARE…) is IF N MOD I = 0 THEN C=C+1
FUNCTION xyz(N) deleted. NEXT I
IF N MOD 2=0 THEN xyz=N IF C>2 THEN
END FUNCTION 19. [SEE 2073] CHK$=”Composite”
a) What is the name of the function used in the above program? DECLARE FUNCTION Diff (A, B) ELSE
Ans: The name of the function is xyz CLS CHK$=”Prime”
b) How many times the function will be called in the above program? INPUT "Enter first number" ; A END IF
Ans: The function will be called 5 times. INPUT "Enter second number" ; B END FUNCTION
17. DECLARE FUNCTION count (S$) PRINT "The difference" ; Diff (A, B)
CLS END i. Will the above program execute if “DECLARE FUNCTION….” is
INPUT"ENTER ANY STRING:";S$ FUNCTION Diff (A, B) deleted.
PRINT "Number of words="; count (S$) difference = A - B Ans: Yes, the program will run if the first line (i.e. DECLARE…) is
END Diff = difference deleted.
END FUNCTION. ii. Why $ sign is used in the name of the above function.
FUNCTION count (S$) a) List all the numeric variables used in the above program. Ans: $ sign is used in the name of the above function because the
C=1 Ans: The numeric variables are A, B and difference. function returns string value.
FOR I=1 TO LEN (S$) b) List the local variables used in the above program.
A$= MID$(S$, I, 1) Ans: The local variables are A, B and difference
IF A$=" " THEN C=C+1 20. [SLC 2072] 22. DECLARE FUNCTION SHAPE$(TXT$)
NEXT I DECLARE FUNCTION Prod (N) CLS
count = C INPUT "Any Number"; N INPUT ”Enter a string”; T$
END FUNCTION X = Prod (N) RV$=SHAPE$(T$)
a) What is the name and type of function in above program? PRINT x PRINT “The text in reverse order is”; RV$
Ans: The name of the function is count and type of function is user END END
defined function. FUNCTION Prod (N)
b) What will be the output if value of S$="I am a robot"? F= 1 FUNCTION SHAPE$(TXT$)
Ans: The output is: FOR K = 1 TO N FOR I = LEN(TXT$) TO 1 STEP -1
Number of words=4 F=F*K CH$=MID$(TXT$,I,1)
c) How many time loops will execute if value of s$="Sunder NEXT K R$=R$+CH$
Nepal". Prod = F NEXT I
Ans: Loop will execute 12 times. END FUNCTION SHAPE$=R$
END FUNCTION
18. [SLC 2065 S] a) Write the name of the user defined function used in above i. Write the library functions used in the above program.
DECLARE FUNCTION Diff(A,B) program.
CLS
30
Ans: The library functions are LEN( ) and MID$( ) ii. Write down the missing statements in the main module to execute 27. DECLARE FUNCTION B(N)
ii. Write the use of expression SHAPE$=R$ written at the end of the the program. CLS
function procedure. Ans: The missing statements in the main module to execute the LET N = 12345
Ans: The use of the expression is to return the value to the calling program is PRINT COUNT(W$) PRINT "Sum of Digits :"; B(N)
function procedure. END
25. [SLC 2071] FUNCTION B(N)
23. [SLC 2068] DECLARE SUB Stde(N$U) WHILE N <> 0
Declare function count(N$) FOR Loop = 1 TO 5 R = N MOD 10
Input “Enter a word”; R$ READ NM$(Loop) C = C+R
C= Count(R$) NEXT Loop N = INT(N/10)
Print C DATA RAMA, PRATIMA, PRASANT WEND
END DATA NISHA, RUDHRA B=C
Function count(N$) CALL Stde(NM$U) END FNCITON
For k=1 to LEN(n$) END i. Write the variables used in the program with their type.
X$=MID$(N$,K,1) Ans: Numeric variables = N, R and C
IF UCASE$(X$)=”A” then SUB Stde(N$U) ii. List out the different types of operators with their type used in the
X=X+1 PRINT “Name starting from P” program.
End if FOR J = 1 TO 5 Ans: Arithmetic Operator = MOD, + and /
Next K C$=MID$(N$,(J),1,1) Relational Operator = < > and =
Count = X IF C$=”P” THEN
End function PRINT N$(J) 28. DECLARE SUB WORD (N$)
i) List any two library functions used in the above program. END IF CLS
Ans: Any two library functions are LEN( ) and MID$( ). NEXT J N$="PABSON”
ii) Write the use of variable „C‟ inline 3 [i.e. C=Count(R$)] given in END SUB CALL WORD (N$)
the above program. i. List the library function used in the above program. END
Ans: The use of variable „C‟ is to store the value returned by the Ans: The library function used in the above program is MID$( ). SUB WORD (N$)
function count. ii. List the conditional statement used in the above program. B=LEN (N$)
Ans: The conditional statement used in the above program is C=1
24. [SLC 2066 S] IF….THEN. WHILE C < B
DECLARE FUNCTION COUNT(A$) 26. [SLC 2068 S] M$=MID$(N$, C, 1)
Input “Enter a word”; W$ DECLARE SUB ABC(X,Y,Z) PRINT M$
END FOR P=1 TO 3 C=C+2
READ A,B,C WEND
Function Count(A$) CALL ABC(A,B,C) END SUB
B=LEN(A$) NEXT P
C$=UCASE$(A$) DATA 5,4,3,2,1,6,7,8,4 i) List the string and numeric variables used in the program.
FOR I=1 TO B END Ans: String variables = N$ and M$
E$=MID$(C$,I,1) SUB ABC(X,Y,Z) Numeric variables = C and B
IF E$=”A” OR E$=”E” OR E$=”I” OR E$=”O” OR E$=”U” T=X+Y+Z ii) What is the value of B in the above program?
THEN C=C+1 IF T MOD 2 = 0 THEN Ans: The value of B = 6
END IF PRINT T
NEXT I END IF 29. DECLARE SUB Exam()
COUNT=C END SUB CLS
END FUNCTION i. List any two variables used in the above program. CALL Exam
Ans: Any two variables used in the above program are X and Y END
i. List the string Library functions used in the above program. ii. How many times SUB-procedure will be called when program is SUB Exam
Ans: The string Library functions used in the above program are executed? LET X=567
LEN( ), UCASE$( ) and MID$( ). Ans: The SUB procedure will be called 3 times. LET Y= X MOD 10
LET X1= INT(X/10)
31
LET Y1=X1 MOD 10 Ans: Formal parameter = C$ i.What is the value the function returns in this program?
LET X2 = INT(X/10) Actual parameter = B$ The function will return the value 5.
LET A =X2+Y1+Y ii. Write the different operators used in the program and mention its ii.What will happen if R=T Mod P is replaced by R=P MOD T?
PRINT “The result is:”;A types. Ans: The output is
END SUB Ans: Arithmetic operator= MOD 10
Relational operator = “=”
i. List the mathematical operators used in the above program. String operator = + 34. DECLARE FUNCTION B (N)
Ans: Mathematical operator = MOD, / and + iii. What is the function of CALL TEST(B$) statements? INPUT “ENTER A NUMBER”; N
ii. Write the value of variable A. Ans: To pass control to the sub procedure. PRINT “THE EQUIVALENT NUMBER IS = “; B(N)
Ans: Tha vale of A is 69 iv. What will be the output if users entered NEPAL? END
Ans: The output is
30. DECLARE FUNCTION CUBE(T,R) NePaL FUNCTION B (N)
CLS 32. DECLARE FUNCTION A(X) WHILE N<>0
N=15 X=5 r = N MOD 2
S=CUBE (2,4) Z=A(X) j$ = STR$(r)
PRINT “CUBE=”; S PRINT Z SUM$ = j$ + SUM$
END END N = N\2
FUNCTION A(X) WEND
FUNCTION CUBE(P, M) FOR I = 1 TO X B = VAL(SUM$)
CUBE = P^3 S=S+I END FUNCTION
N=5*2 NEXT I
END FUNCTION A=S i. What will be the output of the program, if the value is 9?
END FUNCTION The output is
i. How many parameters are used in above program? 9
Ans: One parameter is used. a) How many parameters are used in the program? ii. What is the use of VAL function in the above program?
ii. List two mathematical operators used in the above program. Ans: One parameter is used. VAL will convert the string value to numeric value.
Ans: Any two mathematical operators are ^ and *. b) How many times execute the expression S=S+I in the above
program? 35. DECLARE FUNCTION RESULT(N)
31. DECLARE SUB TEST(A$) Ans: The expression S=S+I will be executed five times in the above PRINT RESULT(16)
CLS program END
INPUT “Enter a String”; B$ c) If the line S = S + I is changed to S = S + I ^ 2 then find the output. FUNCTION RESULT(N)
CALL TEST(B$) Ans: The output is: WHILE N<>0
END 15 A=N MOD 2
N=N\2
SUB TEST(C$) E$=STR$(A)
FOR I=1 TO LEN(C$) 33. DECLARE FUNCTION Highest (M, N) F$=E$+F$
D$ = MID$(C$,I,1) CLS WEND
E = ASC(D$) M=5 : N=10 RT= VAL(F$)
IF E MOD 2 = 0 THEN PRINT Highest (M, N) RESULT=RT
W$ = W$ + UCASE$(D$) END END FUNCTION
ELSE i.Write the output of the above program.
W$ = W$ + LCASE$(D$) FUNCTION Highest(T,P) Ans: The output is
ENDIF While P<>0 10000
NEXT I R=T MOD P ii.What happens if we write the statement F$=E$+F$ as F$=F$+E$
PRINT W$ T=P Ans: The output is 1
END SUB P=R 36. DECLARE FUNCTION SUM(N)
Wend CLS
i. List out the different parameters used in the program and mention Highest=T FOR I=1 TO 3
its types. End Function READ N
32
DATA 15,25,67 FOR I= L TO 1 STEP-5 END IF
PRINT SUM (N) PRINT MID$(A$,I,1); PRINT s;
NEXT NEXT I END SUB
END END SUB
a) If the statement STATIC s is removed, then what will be the
FUNCTION SUM(N) i.What statement should be added in the main module to execute change in its output?
S=0 program? Ans: The statement STATIC s is removed, then the output will be:
WHILE N<>0 Ans: CALL OUTPUT(X$) should be added in the main module to 15 16 31 17 22
R=N MOD 10 execute program
S=S+R ii.What will be the output of the program after correcting the bugs? b) List out the formal arguments and actual arguments from the
N=INT(N/10) Ans: The output is: above program.
WEND ECTC Ans: Formal arguments = a, b
SUM=S 39. [SLC 2067] Actual arguments = c, d
END FUNCTION DECLARE SUB SUM(N)
INPUT”ANY NUMBER”;N 41. DECLARE FUNCTION SUM%(A AS INTEGER, B AS
i. What will be the output of the program? CALL SUM(N) INTEGER)
Ans: The output is: END DIM A AS INTEGER, B AS INTEGER
6 SUB SUM(N) INPUT “Enter the first number”; A
7 S=0 INPUT “Enter the second number”; B
13 WHILE N<>0 PRINT “The sum of the two nos=”; SUM(A, B)
ii. How many times the main function will be called in this program? R=N MOD 10 END
Ans: The main function will be called three times in this program S=S+R
37. DECLARE FUNCTION HIGHEST (M, N) N=N\10 FUNCTION SUM%(A AS INTEGER, B AS INTEGER)
CLS WEND VALUE% = A + B
M=5 PRINT “SUM”;S SUM% = VALUE%
N=10 END SUB END FUNCTION
PRINT HIGHEST(M,N) a) In which condition the statements within the WHILE….WEND
END looping statement will not be executed? a) Write the output of the program if the user inputs 10 for the first
Ans: When the Value of N=0, the statements within the and 10.5 for the second number.
FUNCTION HIGHEST(T,P) WHILE….WEND looping statement will not be executed Ans: The sum of the two nos= 20
WHILE P<>0 b) Will the output be the same if we place “/” instead of”\” in the b) What type of value will the function return?
R=T MOD P above program. Ans: The function will return integer value.
T=P Ans: No. the output will not same if we place “/” instead of”\” in the
P=R above program. 42. [SLC 2064]
WEND DECLARE FUNCTION CELLS$(W$)
HIGHEST =35 40. DECLARE SUB take(x, y) W$=”CYBER”
END FUNCITON CLS PRINT CELL$(W$)
FOR i = 1 TO 5 END
a) Write down the use of MOD in the above program. READ c, d FUNCTION CELL$
Ans: The use of MOD operator is to return the remainder CALL take(c, d) K=LEN(W$)
b) What is the value the function returns in this program? NEXT i FOR I = K TO 1 STEP -2
Ans: The function returns the value 35. DATA 13, 15, 16, 12, 31, 12, 16, 17, 21, 22 M$=M$+MID$(W$,I,1)
END NEXT I
38. DECLARE SUB OUTPUT (A$) SUB take(a, b) CELLS$=M$
X$=”COMPUTER SCIENCE” STATIC s END FUNCTION
END IF a > b THEN a) Why is $(dollar) sign followed in the function name?
s=s+a Ans: $(dollar) sign followed in the function name because the
SUB OUTPUT (A$) ELSE function returns string value.
L=LEN(A$) s=s+b b) What will be the output of the program when it is executed?
33
Ans: The output is 45. [SLC 2074] A$ = “Computer science”
CBR DECLARE FUNCTION SUM (N) B$ = “Computer Programming”
c) What will be the output of the program when FOR loop is CLS Call word(a$)
changed as FOR I= 1 TO K STEP 2? INPUT "Enter any number", N Print A$
Ans: The output is S = SUM (N) Call word (B$)
RBC PRINT "The Sum of individual digit is:", S End
d) What is the name of sign “+” used in the program and what END
operation does it perform? FUNCTION SUM (N) SUB WORD (c$)
Ans: The name of sign “+” is string operator and it is used to join the WHILE N > 0 L = LEN(C$)
string i.e. string concatenation. R = N MOD 10 post = (80 – L)/2
T=T+R Print tab (post); C$
43. [SLC 2070] N = N\10 C$ = “examination”
DECLARE FUNCTION Sum(A,B) WEND END SUB
INPUT “Enter first number:”; A SUM = T
INPUT “Enter second number:”; B END FUNCTION.
PRINT “The sum of the two number=”;Sum(A,B) State the purpose of using variable S in line 4 in above program. i)Write the output of the above program.
END Ans: The purpose of using variable S in line 4 in above program is to Ans: The output of the program is:
FUNCTION SUM(A,B) store the value returned by the function SUM. Computer Science
S=A+B Write the use of MOD in above program. examination
Sum=S Ans: The use of MOD operator is to return the remainder. Computer Programming
END FUNCTION ii) How is the arguments passed?
a) List the numerical variables used in the above program. 1. DECLARE SUB TEST(A, B, C) Ans: Argument is passed by reference
Ans: The numerical variables used in the above program are S, A and LET X=4 iii) What will the print A$ statement in module print?
B. LET Y=7 Ans: A$ statement will print examination.
b) Will the program run if the first line (i.e. DECLARE….) is LET Z=12 iv) Is C$ actual or formal parameter?
deleted? CALL TEST (X, Y, Z) Ans: C$ is formal parameter
Ans: Yes, the program will run if the first line (i.e. DECLARE….) is PRINT X, Y, Z
deleted END 3. DECLARE SUB question (a, b, c)
CLS
44. [SLC 2070 S] SUB TEST(A, B, C) x=10 : y=20 : z=15
DECLARE FUNCTION rev$ (N$) A=A+3 CALL question (x, y, z)
INPUT "Any string"; N$ B=B+2 END
PRINT rev$ (N$) SUM=A+B+C/3 SUB question (a, b, c)
END PRINT SUM a=a+10
FUNCTION rev$ (N$) END SUB b= b + a
FOR X = LEN (N$) to 1 STEP -1 c=a +b
A$=MID$ (N$, X, 1) i) What happens if CALL TEST(X, Y, Z) is replaced by CALL PRINT a, b, c
B$ = B$ + A$ TEST(A, B, C) END SUB
NEXT X Ans: If CALL TEST(X, Y, Z) is replaced by CALL TEST(A, B, C) i. Write actual and formal parameter used in the program.
rev$ = B$ then the output will be: Ans: Actual parameter = x, y, z
END FUNCTION 5 Formal parameter = a, b, c
a. List the library function used in the above program. 4 7 12 ii. What would be its output if x=1, y=2,z=3?
Ans: The library function used in the above program are LEN( ) and Ans: The output will be:
MID$( ) ii) List the formal and real parameters used in the above program. 11 13 24
b. What will be the maximum value of X if the N$ is equal to Ans: Formal Parameters = A, B, C
"Computer". Real Parameters = X, Y, Z 4. DECLARE SUB SEQUENCE (A,B,C)
Ans: be the maximum value of X if the N$ is equal to "Computer" is CLS
8. 2. DECLARE SUB word(B$) X=10
CLS Y=20
34
Z=30 ii. List the arguments and parameters used in the above program. 6
CALL SEQUENCE (X,Y,Z) Ans: Arguments = X, Y, Z
END Paramarers = A, B, C 9. [SLC 2069]
DECLARE SUB EXAM (N$)
SUB SEQUENCE (C,B,A) 7. DECLARE FUNCTION ADD(N) CLS
PRINT A,B,C CLS INPUT "Enter Word", WO$
END SUB FOR CNT= 1 TO 3 CALL EXAM (WO$)
i. List the formal parameters and actual parameters used in the above READ NUM END
program. PRINT ADD (NUM)
Ans: Formal parameter = C, B, A NEXT CNT SUB EXAM(N$)
Actual parameter = X, Y, Z DATA 8, 7, 3 FOR I=1 TO LEN (N$)
ii. Will the above program execute if the position of parameter is to END PRINT RIGHT$(N$,1)
be changed? If „yes‟ then which sequence of number list will it print NEXT I
either 10,20,30 or 30,20,10? FUNCTION ADD(N) END SUB
Ans: it will print 30, 20, 10 S=0
FOR G=1 TO N i. Write the names of two built in functions used in the program.
5. DECLARE SUB ADD(A,B) S=S+G Ans: The names of two built in functions are LEN and RIGHT$
CLS NEXT G ii. List the real parameter and formal parameter in the program.
INPUT “ENTER TWO NUMBERS”; X,Y ADD=S Ans: The real parameter is WO$ and formal parameter is N$
CALL ADD(X,Y) END FUNCTION
END 10. DECLARE SUB RESULT (TXT$)
SUB ADD(A,B) i. Name the actual and formal parameter used in above program. TEXT$ = "SYSTEM PROGRAMMING"
C=A+B Ans: Actual parameter = NUM CALL RESULT (TEXT$)
PRINT “Sum is”; C Formal parameter = N END
END SUB
i. Write the name of procedure in above program. ii. What is the value of NUM when the value of CNT is 2? SUB RESULT (TXT$)
Ans: The name of the procedure is ADD. Ans: The value of NUM will be 7 when the value of CNT is 2. FOR I = 1 TO LEN(TXT$)
ii. List arguments and parameters in the above program. SCAN$ = UCASE$(MID$(TXT$, I, 1))
Ans: Arguments = X, Y 8. DECLARE SUB RESULT (N) IF I MOD 2 = 0 THEN
Parameters= A, B CLS TEMP$ = TEMP$ + UCASE$(SCAN$)
INPUT "ENTER ANY NUMBER"; NUM ELSE
6. DECLARE SUB TEST (A, B, C) CALL RESULT (NUM) TEMP$ = TEMP$ + LCASE$(SCAN$)
LET X = 4 END END IF
LET Y = 7 SUB RESULT (N) NEXT I
LET Z = 12 DO UNTIL N = 0 PRINT TEMP$
CALL TEST (X, Y, Z) R = N MOD 10 END SUB
PRINT X, Y, Z IF R MOD 2 = 0 THEN i.What is the output of the above program?
END S=S+R Ans: The output is
SUB TEST (A, B, C) END IF sYsTeM PrOgRaMmInG
A=A+3 N = N \ 10 ii.List the actual and the formal parameters used in the program.
B=B+2 LOOP Ans: The actual parameter is TEXT$ and formal parameter is TXT$
SUM=A+B+C/3 PRINT S
PRINT SUM END SUB
END SUB 11. DECLARE FUNCTION NUM(N)
i. What will be the output of the above program? i. List the actual and formal parameters in the above program. CLS
Ans: The output is: Ans: Actual parameter = NUM N=14
20 Formal parameter = N PRINT NUM(N)
7 9 12 ii. What will be the output of the program if the input is 1234? END
Ans: The output is
35
FUNCTION NUM(N) END SUB 15. [SLC 2066]
WHILE N<>0 FUNCTION SUM (P,Q) DECLARE FUNCTION Num(N)
R=N MOD 2 SUM=P+Q INPUT N
S=S+R*10^P END FUNCTION S=Num(N)
P=P+1 i. What will the output if X=10, Y=8 and N=5. PRINT S
N=N\2 The output is END
WEND 10
NUM=S 18 FUNCTION Num(N)
END FUNCTION 26 X=Int(17/N)
34 Y=15 MOD N
i. List the local variable used in the function procedure. 42 Num=X +Y
Ans: The local variables are N, R, S and P ii. List out the local variables and global variable in the above END FUNCTION
ii. What will be the output if the program? program. i. Write the name of the function used in the above program.
Ans: The output is: Ans: Local variables = A, B, I, P and Q Ans: The name of the function is Num.
1110 Global variables = X, Y and N ii. List out the mathematical function (Library function) used in the
14. DECLARE SUB SERIES(X, Y, Z) above program.
12. DECLARE SUB TEST(A,B) DECLARE FUNCTION SUM(X, Y) Ans: The library function is Int( )
CLS DIM SHARED I
X=2: Y=2 CLS 16. [SLC 2065]
CALL TEXT(X,Y) INPUT “Enter First Term”;X DECLARE FUNCTION xyz(N)
PRINT X,Y INPUT “Common Difference”;Y FOR I = 1 TO 5
END INPUT “Enter Number of Terms to be generated”; Z READ N
SUB TEST(P,Q) CALL SERIES(X, Y, Z) Z=xyz(N)
FOR I= P TO Q END S=S+Z
P=P+Q NEXT I
Q=P+Q SUB SERIES (X, Y, Z) PRINT S
NEXT FOR I = 1 TO Z DATA 10,13,15,4,6
PRINT P,Q PRINT X END
END SUB X = SUM(X, Y) FUNCTION xyz(N)
i. What will be the output of the above program? NEXT I IF N MOD 2=0 THEN xyz=N
Ans: The output is END SUB END FUNCTION
4 6 FUNCTION SUM (X, Y) a) What is the name of the function used in the above program?
4 6 SUM=X+Y Ans: The name of the function is xyz
ii. List down the global variable used in the above program. END FUNCTION b) How many times the function will be called in the above program?
Ans: The global variables are X and Y a) What will be the output of the program if the user inputs 2, 3, 4 Ans: The function will be called 5 times.
for the variables X, Y, Z respectively? 17. DECLARE FUNCTION count (S$)
13. DECLARE SUB SERIES(A, B) Ans: The output is: CLS
DECLARE FUNCTION SUM(P,Q) 2 INPUT"ENTER ANY STRING:";S$
COMMON SHARED N 5 PRINT "Number of words="; count (S$)
INPUT “Enter First Term”;X 8 END
INPUT “Enter Second Term”;Y 11
INPUT “Enter Number of Terms to be generated”; N b) How many times the function SUM(X, Y) will be executed if FUNCTION count (S$)
CALL SERIES(X, Y) the values of X, Y, Z are 2, 4, 6 respectively? C=1
END Ans: The function will execute 6 times. FOR I=1 TO LEN (S$)
SUB SERIES (A, B) c) What type of variables X, Y and I are? A$= MID$(S$, I, 1)
FOR I = 1 TO N Ans: X, Y and I are numerical variables. IF A$=" " THEN C=C+1
PRINT A d) Will the program run if the value of Z is less than X and Y? NEXT I
A=SUM(A,B) Ans: Yes, the program will run. count = C
NEXT I END FUNCTION
36
a) What is the name and type of function in above program? PRINT x
Ans: The name of the function is count and type of function is user END FUNCTION SHAPE$(TXT$)
defined function. FUNCTION Prod (N) FOR I = LEN(TXT$) TO 1 STEP -1
b) What will be the output if value of S$="I am a robot"? F= 1 CH$=MID$(TXT$,I,1)
Ans: The output is: FOR K = 1 TO N R$=R$+CH$
Number of words=4 F=F*K NEXT I
c) How many time loops will execute if value of s$="Sunder NEXT K SHAPE$=R$
Nepal". Prod = F END FUNCTION
Ans: Loop will execute 12 times. END FUNCTION i. Write the library functions used in the above program.
Ans: The library functions are LEN( ) and MID$( )
18. [SLC 2065 S] a) Write the name of the user defined function used in above ii. Write the use of expression SHAPE$=R$ written at the end of the
DECLARE FUNCTION Diff(A,B) program. function procedure.
CLS Ans: The name of the user defined function used in above program is Ans: The use of the expression is to return the value to the calling
INPUT “Enter first number”;A Prod. function procedure.
INPUT “Enter second number”;B b) Name the loop in above program?
PRINT “The difference of the two number=”;Diff(A,B) Ans: The name of loop is FOR….NEXT loop. 23. [SLC 2068]
END Declare function count(N$)
FUNCTION Diff(A,B) [SLC 2069 S] Input “Enter a word”; R$
D=A-B 21. DECLARE FUNCTION CHK$(N) C= Count(R$)
Diff=D CLS Print C
END FUNCTION N=57 END
i. What will be the output of the program if the user enters 200 as the PRINT “The number is”; CHK$(N) Function count(N$)
first number and 100 as the second number. END For k=1 to LEN(n$)
Ans: The output is: X$=MID$(N$,K,1)
The difference of the two number=100 FUNCTION CHK$(N) IF UCASE$(X$)=”A” then
ii. Will the program run if the first line (i.e. DECLARE…..) is FOR I = 1 TO N X=X+1
deleted? IF N MOD I = 0 THEN C=C+1 End if
Ans: Yes, the program will run if the first line (i.e. DECLARE…) is NEXT I Next K
deleted. IF C>2 THEN Count = X
CHK$=”Composite” End function
19. [SEE 2073] ELSE i) List any two library functions used in the above program.
DECLARE FUNCTION Diff (A, B) CHK$=”Prime” Ans: Any two library functions are LEN( ) and MID$( ).
CLS END IF ii) Write the use of variable „C‟ inline 3 [i.e. C=Count(R$)] given in
INPUT "Enter first number" ; A END FUNCTION the above program.
INPUT "Enter second number" ; B Ans: The use of variable „C‟ is to store the value returned by the
PRINT "The difference" ; Diff (A, B) i. Will the above program execute if “DECLARE FUNCTION….” is function count.
END deleted.
FUNCTION Diff (A, B) Ans: Yes, the program will run if the first line (i.e. DECLARE…) is 24. [SLC 2066 S]
difference = A - B deleted. DECLARE FUNCTION COUNT(A$)
Diff = difference ii. Why $ sign is used in the name of the above function. Input “Enter a word”; W$
END FUNCTION. Ans: $ sign is used in the name of the above function because the END
a) List all the numeric variables used in the above program. function returns string value.
Ans: The numeric variables are A, B and difference. Function Count(A$)
b) List the local variables used in the above program. 22. DECLARE FUNCTION SHAPE$(TXT$) B=LEN(A$)
Ans: The local variables are A, B and difference CLS C$=UCASE$(A$)
20. [SLC 2072] INPUT ”Enter a string”; T$ FOR I=1 TO B
DECLARE FUNCTION Prod (N) RV$=SHAPE$(T$) E$=MID$(C$,I,1)
INPUT "Any Number"; N PRINT “The text in reverse order is”; RV$ IF E$=”A” OR E$=”E” OR E$=”I” OR E$=”O” OR E$=”U”
X = Prod (N) END THEN C=C+1
37
END IF IF T MOD 2 = 0 THEN Ans: The value of B = 6
NEXT I PRINT T
COUNT=C END IF 29. DECLARE SUB Exam()
END FUNCTION END SUB CLS
i. List any two variables used in the above program. CALL Exam
i. List the string Library functions used in the above program. Ans: Any two variables used in the above program are X and Y END
Ans: The string Library functions used in the above program are ii. How many times SUB-procedure will be called when program is SUB Exam
LEN( ), UCASE$( ) and MID$( ). executed? LET X=567
ii. Write down the missing statements in the main module to execute Ans: The SUB procedure will be called 3 times. LET Y= X MOD 10
the program. LET X1= INT(X/10)
Ans: The missing statements in the main module to execute the 27. DECLARE FUNCTION B(N) LET Y1=X1 MOD 10
program is PRINT COUNT(W$) CLS LET X2 = INT(X/10)
LET N = 12345 LET A =X2+Y1+Y
25. [SLC 2071] PRINT "Sum of Digits :"; B(N) PRINT “The result is:”;A
DECLARE SUB Stde(N$U) END END SUB
FOR Loop = 1 TO 5 FUNCTION B(N)
READ NM$(Loop) WHILE N <> 0 i. List the mathematical operators used in the above program.
NEXT Loop R = N MOD 10 Ans: Mathematical operator = MOD, / and +
DATA RAMA, PRATIMA, PRASANT C = C+R ii. Write the value of variable A.
DATA NISHA, RUDHRA N = INT(N/10) Ans: Tha vale of A is 69
CALL Stde(NM$U) WEND
END B=C 30. DECLARE FUNCTION CUBE(T,R)
END FNCITON CLS
SUB Stde(N$U) i. Write the variables used in the program with their type. N=15
PRINT “Name starting from P” Ans: Numeric variables = N, R and C S=CUBE (2,4)
FOR J = 1 TO 5 ii. List out the different types of operators with their type used in the PRINT “CUBE=”; S
C$=MID$(N$,(J),1,1) program. END
IF C$=”P” THEN Ans: Arithmetic Operator = MOD, + and /
PRINT N$(J) Relational Operator = < > and = FUNCTION CUBE(P, M)
END IF CUBE = P^3
NEXT J 28. DECLARE SUB WORD (N$) N=5*2
END SUB CLS END FUNCTION
i. List the library function used in the above program. N$="PABSON”
Ans: The library function used in the above program is MID$( ). CALL WORD (N$) i. How many parameters are used in above program?
ii. List the conditional statement used in the above program. END Ans: One parameter is used.
Ans: The conditional statement used in the above program is SUB WORD (N$) ii. List two mathematical operators used in the above program.
IF….THEN. B=LEN (N$) Ans: Any two mathematical operators are ^ and *.
C=1
WHILE C < B 31. DECLARE SUB TEST(A$)
26. [SLC 2068 S] M$=MID$(N$, C, 1) CLS
DECLARE SUB ABC(X,Y,Z) PRINT M$ INPUT “Enter a String”; B$
FOR P=1 TO 3 C=C+2 CALL TEST(B$)
READ A,B,C WEND END
CALL ABC(A,B,C) END SUB
NEXT P SUB TEST(C$)
DATA 5,4,3,2,1,6,7,8,4 i) List the string and numeric variables used in the program. FOR I=1 TO LEN(C$)
END Ans: String variables = N$ and M$ D$ = MID$(C$,I,1)
SUB ABC(X,Y,Z) Numeric variables = C and B E = ASC(D$)
T=X+Y+Z ii) What is the value of B in the above program? IF E MOD 2 = 0 THEN
38
W$ = W$ + UCASE$(D$) RT= VAL(F$)
ELSE FUNCTION Highest(T,P) RESULT=RT
W$ = W$ + LCASE$(D$) While P<>0 END FUNCTION
ENDIF R=T MOD P
NEXT I T=P i.Write the output of the above program.
PRINT W$ P=R Ans: The output is
END SUB Wend 10000
Highest=T ii.What happens if we write the statement F$=E$+F$ as F$=F$+E$
i. List out the different parameters used in the program and mention End Function Ans: The output is
its types. i.What is the value the function returns in this program? 1
Ans: Formal parameter = C$ The function will return the value 5.
Actual parameter = B$ ii.What will happen if R=T Mod P is replaced by R=P MOD T? 36. DECLARE FUNCTION SUM(N)
ii. Write the different operators used in the program and mention its Ans: The output is CLS
types. 10 FOR I=1 TO 3
Ans: Arithmetic operator= MOD READ N
Relational operator = “=” 34. DECLARE FUNCTION B (N) DATA 15,25,67
String operator = + INPUT “ENTER A NUMBER”; N PRINT SUM (N)
iii. What is the function of CALL TEST(B$) statements? PRINT “THE EQUIVALENT NUMBER IS = “; B(N) NEXT
Ans: To pass control to the sub procedure. END END
iv. What will be the output if users entered NEPAL?
Ans: The output is FUNCTION B (N) FUNCTION SUM(N)
NePaL WHILE N<>0 S=0
r = N MOD 2 WHILE N<>0
32. DECLARE FUNCTION A(X) j$ = STR$(r) R=N MOD 10
X=5 SUM$ = j$ + SUM$ S=S+R
Z=A(X) N = N\2 N=INT(N/10)
PRINT Z WEND WEND
END B = VAL(SUM$) SUM=S
FUNCTION A(X) END FUNCTION END FUNCTION
FOR I = 1 TO X
S=S+I i. What will be the output of the program, if the value is 9? i. What will be the output of the program?
NEXT I The output is Ans: The output is:
A=S 9 6
END FUNCTION ii. What is the use of VAL function in the above program? 7
VAL will convert the string value to numeric value. 13
a) How many parameters are used in the program? ii. How many times the main function will be called in this program?
Ans: One parameter is used. 35. DECLARE FUNCTION RESULT(N) Ans: The main function will be called three times in this program
b) How many times execute the expression S=S+I in the above PRINT RESULT(16) 37. DECLARE FUNCTION HIGHEST (M, N)
program? END CLS
Ans: The expression S=S+I will be executed five times in the above M=5
program N=10
c) If the line S = S + I is changed to S = S + I ^ 2 then find the output. PRINT HIGHEST(M,N)
Ans: The output is: FUNCTION RESULT(N) END
15 WHILE N<>0
33. DECLARE FUNCTION Highest (M, N) A=N MOD 2 FUNCTION HIGHEST(T,P)
CLS N=N\2 WHILE P<>0
M=5 : N=10 E$=STR$(A) R=T MOD P
PRINT Highest (M, N) F$=E$+F$ T=P
END WEND P=R
39
WEND Ans: No. the output will not same if we place “/” instead of”\” in the 42. [SLC 2064]
HIGHEST =35 above program. DECLARE FUNCTION CELLS$(W$)
END FUNCITON W$=”CYBER”
40. DECLARE SUB take(x, y) PRINT CELL$(W$)
a) Write down the use of MOD in the above program. CLS END
Ans: The use of MOD operator is to return the remainder FOR i = 1 TO 5 FUNCTION CELL$
b) What is the value the function returns in this program? READ c, d K=LEN(W$)
Ans: The function returns the value 35. CALL take(c, d) FOR I = K TO 1 STEP -2
NEXT i M$=M$+MID$(W$,I,1)
38. DECLARE SUB OUTPUT (A$) DATA 13, 15, 16, 12, 31, 12, 16, 17, 21, 22 NEXT I
X$=”COMPUTER SCIENCE” END CELLS$=M$
END SUB take(a, b) END FUNCTION
STATIC s a) Why is $(dollar) sign followed in the function name?
SUB OUTPUT (A$) IF a > b THEN Ans: $(dollar) sign followed in the function name because the
L=LEN(A$) s=s+a function returns string value.
FOR I= L TO 1 STEP-5 ELSE b) What will be the output of the program when it is executed?
PRINT MID$(A$,I,1); s=s+b Ans: The output is
NEXT I END IF CBR
END SUB PRINT s; c) What will be the output of the program when FOR loop is
END SUB changed as FOR I= 1 TO K STEP 2?
i.What statement should be added in the main module to execute Ans: The output is
program? a) If the statement STATIC s is removed, then what will be the RBC
Ans: CALL OUTPUT(X$) should be added in the main module to change in its output? d) What is the name of sign “+” used in the program and what
execute program Ans: The statement STATIC s is removed, then the output will be: operation does it perform?
ii.What will be the output of the program after correcting the bugs? 15 16 31 17 22 Ans: The name of sign “+” is string operator and it is used to join the
Ans: The output is: string i.e. string concatenation.
ECTC b) List out the formal arguments and actual arguments from the
above program. 43. [SLC 2070]
Ans: Formal arguments = a, b DECLARE FUNCTION Sum(A,B)
39. [SLC 2067] Actual arguments = c, d INPUT “Enter first number:”; A
DECLARE SUB SUM(N) 41. DECLARE FUNCTION SUM%(A AS INTEGER, B AS INPUT “Enter second number:”; B
INPUT”ANY NUMBER”;N INTEGER) PRINT “The sum of the two number=”;Sum(A,B)
CALL SUM(N) DIM A AS INTEGER, B AS INTEGER END
END INPUT “Enter the first number”; A FUNCTION SUM(A,B)
SUB SUM(N) INPUT “Enter the second number”; B S=A+B
S=0 PRINT “The sum of the two nos=”; SUM(A, B) Sum=S
WHILE N<>0 END END FUNCTION
R=N MOD 10 a) List the numerical variables used in the above program.
S=S+R FUNCTION SUM%(A AS INTEGER, B AS INTEGER) Ans: The numerical variables used in the above program are S, A and
N=N\10 VALUE% = A + B B.
WEND SUM% = VALUE% b) Will the program run if the first line (i.e. DECLARE….) is
PRINT “SUM”;S END FUNCTION deleted?
END SUB Ans: Yes, the program will run if the first line (i.e. DECLARE….) is
a) In which condition the statements within the WHILE….WEND a) Write the output of the program if the user inputs 10 for the first deleted
looping statement will not be executed? and 10.5 for the second number.
Ans: When the Value of N=0, the statements within the Ans: The sum of the two nos= 20 44. [SLC 2070 S]
WHILE….WEND looping statement will not be executed b) What type of value will the function return? DECLARE FUNCTION rev$ (N$)
b) Will the output be the same if we place “/” instead of”\” in the Ans: The function will return integer value. INPUT "Any string"; N$
above program. PRINT rev$ (N$)
40
END An analog signal refers to a continuous electrical signal that varies Search engine is the communication program that searches
FUNCTION rev$ (N$) over time and represents data as a continuous waveform. documents on the basis of specified keywords and returns a list of the
FOR X = LEN (N$) to 1 STEP -1 5. What is computer network? web links that matches the keywords.
A$=MID$ (N$, X, 1) Computer network is a group of two or more computers and devices 20. Write the name of any two search engines.
B$ = B$ + A$ connected to each other through wired or wireless media to exchange The name of any two search engines is google.com and ask.com
NEXT X data and information and share hardware, software and other 21. What is web browser?
rev$ = B$ resources. Web browser is a computer program that access web pages and
END FUNCTION 6. Give reason in short that "Computer network reduces the cost displays them on the user‟s computer.
a. List the library function used in the above program. of operation." 22. Mention any two services provided by internet.
Ans: The library function used in the above program are LEN( ) and Ans: Computer network reduces the cost of operation by sharing Any two services provided by internet are Search engine and E-mail.
MID$( ) hardware and software. 23. What is e-mail?
b. What will be the maximum value of X if the N$ is equal to 7. What is network protocol? E-mail is the most widely used service on the Internet which sends
"Computer". A set of rules followed for interconnection and communication and receives messages electronically through the Internet.
Ans: be the maximum value of X if the N$ is equal to "Computer" is between computers in a network is called network protocol. 24. Define E-mail address.
8. 8. What is topology? An email address is a unique identifier used for sending and
Ans. Network topology is the inter-connected pattern of network receiving electronic messages over the internet.
45. [SLC 2074] components.
DECLARE FUNCTION SUM (N) 9. Define bandwidth. 25. Write the name of the protocol used for sending email messages.
CLS Bandwidth can be defined as the maximum volume of data that can -Simple Mail Transfer Protocol (SMTP)
INPUT "Enter any number", N be transmitted through a communication system.
S = SUM (N) 10. Write any two examples of full duplex modes of data 26. Define IP address.
PRINT "The Sum of individual digit is:", S transmission. IP address is an unique numerical identifier for every device or
END Any two examples of full duplex modes of data transmission are network that connects to the internet.
FUNCTION SUM (N) telephone and mobile.
WHILE N > 0 11. In which communication media data transfer is the fastest? 27. What is switch in network connecting device?
R = N MOD 10 In Fiber optic cable, data transfer is the fastest. Switch is a network connectivity device which joins multiple
T=T+R 12. Write two examples of bounded media. computers together to share information among them. The selected
N = N\10 Any two examples of bounded media are Twisted Pair Cable and computer can get information through switch.
WEND Fiber Optic Cable
SUM = T 13. Which connector is used with coaxial cable? 28. Which device is used to connect PC with telephone line?
END FUNCTION. BNC connector is used with coaxial cable MODEM is used to connect PC with telephone line.
State the purpose of using variable S in line 4 in above program. 14. Which type of cable typically uses RJ-45 connector?
Ans: The purpose of using variable S in line 4 in above program is to -Twisted pair cable 29. Why switch is also known as smart hub?
store the value returned by the function SUM. 15. What is communication media? Switch is also known as smart hub because it transfers packets to
Write the use of MOD in above program. A channel or path through which data and information are only those selected computers connected in network.
Ans: The use of MOD operator is to return the remainder. transmitted between connected devices in a network environment is 30. Where does intranet has been used?
called communication media Intranet has been used to share internal information and resources
1. What is communication? 16. What is internet? within an organization.
Communication is sending and receiving information between two or The Internet is a global network of interconnected computers that
more persons. allows people to share information and communicate from anywhere 31. What is the business done through internet?
2. What is Tele-Communication? in the world. The business done through internet is e-commerce.
The transmission of data and information from one place to another 17. What is mail server? 32. What is Ecommerce?
for the purpose of communication is known as telecommunication. A mail server is a computer system that is dedicated to handling and E-commerce is also known as electronic commerce or Internet
3. What are data communication mode? managing the sending, receiving, and storage of emails. commerce which means buying and selling of goods, products, or
Data communication modes refer to direction of data flow between 18. What is web server? services through Internet.
devices in a network or communication system. Simplex, Half A web server is a software or hardware that delivers web content to 33. What is M-Commerce?
Duplex and Full Duplex mode are the types of communication clients like browsers. The online transactions through the wireless handheld devices such
mode. 19. What is search engine? as mobile phone, laptop, palmtop, tablet, or any other personal digital
4. What is analog signal? assistant is called M-Commerce.
41
34. What is cyber-crime? Social media let us share anything with others around the world Mobile computing refers to a variety of devices that allow people to
Cyber crime refers to criminal activities that are carried out using 48. List any two commandments of computer ethics. access data and information from wherever they are via a mobile
computers, networks and the internet. Any two commandments of computer ethics. device.
35. What is cyber bulling? Do not use a computer to publish fake information. 61. What is Online Payment?
Cyber bullying is a kind of harassment using mobiles or computers. Do not search the file or record of other people. Online payment refers to the payment for buying goods or services
36. What is cyber law? 49. What is the vision of IT Policy of Nepal 2072? through the Internet using different online payment gateway
The law which governs the legal issues in the cyber space regarding The vision of IT Policy of Nepal 2072 is to transform Nepal into 62. Name any to modes of Electronic Payments.
the internet or WWW for digital data processing and transaction is information and knowledge based society and economy. Any two modes of electronic payments are:
called cyber law. i) Debit Card / Credit Card
37. Give some examples of cyber law 50. Define Computer security. ii) Mobile wallet like e-sewa, khalti
Computer crimes/Cyber-crime law Computer security refers to protecting computer and its content from 63. What is Cloud computing?
Intellectual property law damage, theft or misuse and action to prevent such incidents. Cloud computing is a technology that allows users to access and use
Data protection and privacy law 51. What is hardware security? of computing resources, like servers and software, over the internet.
Telecommunication law Hardware security is the protection given to the various hardware 64. Write any two benefits of cloud computing.
tools and equipment used in computer system from the accidental or Any two benefits of cloud computing are
38. When was cyber law introduced in Nepal? intentional harm. It allows to quickly and easily access, store information anywhere,
30th Bhadra 2061 B.S. 52. What is Software security? anytime in the whole world, using an internet connection.
Software security is the protection of computer systems and It is easier to get back-up and restore the data.
39. What is key logger? applications from threats, such as hacking, virus attacks, and 66. What is AI?
A keylogger is a tool that secretly records every key pressed on a unauthorized access, to ensure their confidentiality, integrity, and Artificial intelligence (AI) is an area of computer science that
computer or mobile device. availability. emphasizes the creation of intelligent machines that work and reacts
53. List any two software security measures. like humans.
40. What is a backup? Any two software security measures are password and backup 67. List some areas where Al can help us.
Backup is the system of copying data and programs into another 54. Write two methods for hardware security. Robotics and Education
location or creating a duplicate copy of it in a secured place. Any two methods for hardware security are Insurance and Regular 68. What is e-governance?
maintenance of computer hardware. E-Governance refers to the use of the digital technology by
41. Which software is used to remove virus from Computer System? 55. List some points about how we can protect our data. government to enhance the delivery of public services and engage
Antivirus Software is used to remove virus from Computer System. Antivirus software can detect and remove virus from the computer. with citizens more effectively.
Software for backup helps in securing the information by keeping 69. What is e-banking?
42. What is information security? backup. E-banking refers to a digital banking system that enables customers
Information security is the practice of preventing unauthorized 56. What is digital signature? to conduct financial transactions and manage their accounts online
access, use, disclosure, modification, recording or destruction of Digital signature is a security mechanism system used on the internet through the internet or mobile apps without the need for a physical
information. for data and information transaction by attaching a code at the end of visit to a bank branch.
43. Why do you connect your PC to the UPS? the electronic message that confirms the authenticity of sent message.
We connect PC to the UPS to control fluctuation of electric voltage 57. What is digital currency? 70. What is IoT?
and provides enough backup electric power to the computer system Digital currency is a type of electronic money that is stored and IoT is a system of interrelated computing device to exchange
when there is power failure. exchanged using computers and other digital devices. information over a network without human-to-human or human to
44. Why data decryption is necessary? 58. What is digital citizenship? computer interaction.
To convert encrypted (coded) data into readable form. Digital citizenship refers to the responsible and ethical use of
45. What is social media? technology and the internet which involves understanding, practicing, 71. Write any two examples of IOT.
Social media refers to online platforms and websites that allow users and promoting appropriate behavior when using digital tools and Any two examples of IOT are: Smart Watch, Smart TV
to create, share, and interact with content and other users. resources.
46. Write opportunities and threats in social media. 59. Define Cryptography. 72. Which data type is used to store alpha numeric characters or
Opportunities of social media is It creates awareness and innovate the Cryptography is the study of secure communications techniques that special symbols in MS-Access?
way people live and Threats of social media is personal data and allow only the sender and intended recipient of a message to view its Text data type is used to store alpha numeric characters or special
privacy can be easily hacked and shared on the internet. contents symbols in MS-Access.
47. Write any two advantages of social media. 60. What is mobile computing? 73. Which data type is suitable to store photographs of students in
Ans: Any two advantages of social media are: MS-Access?
It creates awareness and innovate the way people live
42
The suitable data type to store photographs of students in MS-Access 89. What is the storage size of memo and text data type in MS- Validation Rule is a field property which is used to limit the values
is OLE object. Access? that can be entered into a field.
74. Which data types are used to store graphics and numeric Text can store up to 255 characters and Memo can store up to 65,535
characters in MS-Access? characters. 107. What happens while we enter text in number data type?
OLE object is used for graphic and Numeric data type is used for 90. What is the maximum length of field name in MS-Access? It does not accept data and displays error message.
numeric character The maximum length of field name in MS-Access 64 characters.
75. Which data type is used to store your school fee in MS-Access? 91. Which query is used to modify and calculate data in DBMS? 108. What is primary key?
Currency is the data type used to store school fee in MS-Access. Update query is used to modify and calculate data in DBMS. A primary key is a field or combination of fields in a table that
76. Which data type is suitable to store salary of an employee in MS- uniquely identifies each record, and is used to establish relationships
Access? 92. Which view is used to modify a record in MS-Access? between tables and enforce data integrity.
Ans: Currency data type is suitable to store salary of an employee in Datasheet view 109. List the importance of primary key.
MS-Access. 93. Which object of MS-Access is used to retrieve data from the The importance of primary key are
table? To reduce and control duplication of record in a table.
77. Which data type is used in MS-Access to store address of a Select Query To set the relationship between tables.
person? 94. Which query is used to make changes in data stored in database?
Memo data type is used in MS-Access to store address of a person. Update Query 110. Write two examples of primary key fields.
78. Which data type is used to store date of birth of an employee in 95. List any two objects of MS-Access Any two examples of primary key fields are SEE Registration
MS-Access? Query and Form Number and Roll Number
Date/Time data type is used to store date of birth of an employee in 96. Which object of MS-Access is used to retrieve data from the 111. Which key sets relationship between tables?
MS-Access table? Primary Key
Query is used to retrieve data from a table.
79. Which in the logical data type of MS-Access? 97. Which object of DBMS is used to print information? 112. What is meant by data redundancy?
The logical data type of MS-Access is Yes/No. The object of DBMS which is used to print information is report. Data redundancy is the duplication of data within a database.
98. What is the primary component of a database that organizes 113. Define database.
80. Which data type of MS Access is used for data that can store data into rows and columns? Database is a collection of systematically organized inter-related data
only one of two possible values? -Table which stores, organizes and retrieves data
The data type that can store only one of two possible values is 99. What is the primary building block of a database? 114. What is DBMS?
Yes/No. -Table DBMS is a computerized system that stores data, processes them and
81. What data type is commonly represented as Boolean in MS - 100. Which object is used to store the data in database? provides information in an organized form.
Access? -Table
-Yes/No 101. Which object of MS Access is used to provide graphical 115. List two examples of DBMS.
82. What is the field size of yes/no field? interface to enter data into a table? Any two examples of DBMS are MS-Access and Oracle.
The field size of YES/NO field is 1 bit. -Form 116. Write two features of Database Management System.
83. Write any two data type used in MS-Access database ? It reduces data redundancy which means duplication of data.
Any two data type used in MS-Access database are text and number, 102. Which query is used to view the data stored in database? It allows multiple users to access the same data simultaneously.
84. Which view is used to modify a table structure in MS-Access? Select query is used to view the data stored in database 117. What is a RDBMS?
Design View is used to modify a table structure in MS-Access. 103. What is the purpose of a query in a database? RDBMS is a type of DBMS that uses a relational model to organize
85. What is the default extension of MS-Access? To ask question about the data stored in the database. and manage data, allowing users to easily retrieve and manipulate it.
The default extension of Ms-Access is : .mdb (2003 version) and 118. Define MS Access.
.accdb (2007 version). 104. Which field property speeds up searching and sorting of MS-Access is a relational database management system developed
86. What is the default size of text field in MS-Access? records based on a field? by Microsoft Corporation which is used to store and manipulates
The default size of text field is : 50 (2003 version) and 255(2007 Indexing large volume of data in multiple tables.
version). 105. Define validation text. 119. Define Form.
87. What is the default size of number field in MS-Access? Validation Text is a field property which displays an error message Form is one of the MS-Access database objects which provides
The default size of number field in MS-Access is 4 bytes (Long that appears if the data entered is invalid according to the specified graphical interface to view, modify and add data in a table or
Integer) validation rule. multiple linked tables.
88. What is the storage size of text and currency data type? 120. Define relationship.
The storage size of text data type is 255 and currency data type is 8 106. Define validation rule. Relationship is a link between two tables that defines how they are
bytes. related to each other by a common field.
43
121. What terms are used to refer to a row and a column in a 136. Write the types of parameters? Any two data types used in C language are int and char.
table? The types of parameters are actual and formal parameters. 155. Why C is called a middle level language?
- Row is refers to Record or Tuple and Column refers to Field or 137. What is formal parameter? C is called middle level language because it combines elements of
Attribute. Parameters are variables that will receive data (arguments value) sent high level language with some features of assembler
to the procedures (SUB program and FUNCTION). 156. Write a feature of C language.
122. What is modular programming? 138. What is actual parameter? A feature is C language is it is mostly used to prepare system
Modular programming is a technique used to divide program into Actual or Real parameters are arguments which are used to pass real software.
many small, manageable, logical and functional modules or blocks. value or data to the procedure. 157. Write any two limitations of C-Language.
123. Write any two advantages of modular programming. 139. List the types of procedures. Any two limitations of C-Language are:
Different programmers can design different program modules The types of procedure are SUB Procedure and FUNCTION There is no runtime checking. (the errors are not detected after each
independently, which is required in a large and complex program. Procedure. line of code.)
It is easy to design, code and test the program modules 140. What is the function of MOD in Qbasic? It does not provide strict data type checking (for example, an integer
independently. The function of MOD in Qbasic is to find remainder. value can be passed for floating datatype).
124. Which statement is used to call sub-procedure? 141. What is the function of SQR in Q-Basic? 158. Give the name of any two header files used in C language
CALL statement is used to call sub-procedure. The function of SQR in Q-Basic us to calculate the square root of a <stdio.h> and <conio.h>
given number.
125. What are procedure in QBASIC? 159. Name the header/library file that handles mathematical
Procedure is a block of statement that solves a particular problem. 142. Write the function of Kill and Name….AS statement in functions in C Language.
126. What is module? QBasic. - <math.h>
Module is a block of statement that solves a particular problem. The KILL statement deletes a file. The NAME statement changes 160. What will be the value of „y‟ in given C expression,
127. What is looping? the name of a disk file or directory y=64%5?
Looping is the process of repeating the execution of a statement or a 143. Write any two differences between Q-Basic and C- The value of y will be 4.
block of statements guided by a condition and is terminated when the language. 161. What will be the value of x in given c expression x=55 %
given condition is satisfied. Any two differences between Q-Basic and C-language 10?
128. Define Keyword with example. QBASIC C The value value of x will be 5.
Keyword is a set of special words which are already defined for some It is a high level It is a high level language 162. How many keywords are in C language?
tasks.E.g. auto, double, int, long etc language without feature of low with some features of low level There are set of 32 keywords in C language.
129. What is local variable? level language. language. 163. What is an operator in C language?
Variables which are declared inside a module and which cannot be Operator is a symbol that is used to perform mathematical operations.
It is mostly used to design It is mostly used to
accessed by other module are called local variables. 164. Write the name of unary operators used in C-language
application software. prepare system software.
130. What is a global variable? Increment (++) and decrement (--).
A variable in main module which can be accessed from any module 165. Write the name of two selection statement used in C
or procedure of a program is known as a global variable. 150. Define C-programming. language.
C language is a structured programming language that divides
131. Which mode is used to add data items into the already - if and switch statement
existed data file in QBASIC? program into many functions. 166. Write any two looping statements used in C language.
151. Write any two features of C programming language?
APPEND mode is used to add data items into the already existed data for and while loop
file in QBASIC. Any two features of c programming language are: 167. List any two examples of format specifier (Conversion
C is a Structured Programming Language. which break down a
132. Which mode is used to read and display data from an Character) used in C Language.
existing sequential data file? program in several small modules and makes the programmer easier Any two examples of format specifier (Conversion Character) used
to manage and debug the code.
-Input Mode in C Language are %d (int) and %f (float)
133. List the modes of operations for opening a sequential file C is a case-sensitive programming language. It understands the
INPUT, OUTPUT and APPEND Mode. capital alphabets and small alphabets as different values. 2. Write appropriate technical terms for the following: [2×1=2]
152. Which is the structure programming language?
168. Data transmission in one direction only that is to
134. What is the use of EOF() function? C language is the structure programming language. send or receive only. Simplex Mode
153. What is structured programming language
Ans: EOF() function is used to test the end of records with in a file. 169. Law that governs the legal issues of cyberspace.
The programming that follows a top- down approach, on which Cyber Law
developers separate the overall program structure into different sub
135. What is the MKDIR command used for in Q-Basic? 170. Laws made to prevent criminal activities through the
Ans: MKDIR command is used to create a subdirectory which is section, is called structured programming. internet. Cyber Law
154. Write any two data types used in C language.
used to manage files.
44
171. Crimes committed using electronic devices and 197. A type of network in which every computer works as 221. Combination of private and public cloud. – Hybrid
cyber space. Cyber crime both client and server. Peer to Peer Network Cloud
172. The smallest unit to represent information on a 198. The protection of computer systems and sensitive 222. Software require for browsing and surfing content on
quantum computer. Qubit (Quantum bit) information from unauthorized access, theft or the WWW. Web Browser
173. A system of copying data and information reading in damage. Cybersecurity 223. The fake attempt to obtain sensitive information such
computer into another location. Backup 199. ) Paying money in E-Commerce using internet. as username, password by disguising oneself as a trustworthy
174. The process of making copies of data or data files to Online Payment entity. Phishing
use in the event the original data or data files are lost or destroyed. 200. The Internet tool which is used to upload download 224. Network connecting device that boosts the data
Backup data. FTP signals. Repeater
175. A company which provides services of 201. A collective online communications channels 225. A logical collection of Internet-connected devices
Internet. Internet Service Provider (ISP) dedicated to community based input, interaction, content sharing and such as computers, smartphones or internet of things (IoT) devices
176. Network of Networks. Internet collaboration. Social media whose security have been breached and control is given away to a
177. The arrangement of connection patterns of 202. A process of performing a variety of tech-enabled third party. Botnet
computers or nodes and others resources. Network Topology activities via virtual communities and network. 226. A network device which broadcasts the information
178. Arrangements of nodes in a Network. Topology -Social Media packets to all computer connected network. Hub
179. A concept of transferring data from your computer to 204. Hacking done with permission from the 227. An applications that look like they are doing
server Computer. Uploading client. Ethical Hacking something harmless, but secretly have malicious code that does
180. Computer program that protects computer from 205. The process of identifying an individual usually something else. Trojan Horse
computer virus. Antivirus software based on a username and password. Authentication 228. Numbers are only allowed in the secret
181. A program that can disinfect a file from 206. The mode of data communication in which code. Personal Identification Number (PIN)
virus. Antivirus software data/information/signals are transmitted in both side 229. A unique numerical identifier for every device or
182. A malicious program of computer that damages data simultaneously. Full Duplex Mode network that connects to the internet. IP Address
and Software. Malware 207. The network security systems that monitor and 230. The issues related to cybercrime and also help in
183. A malicious program of computer that damages data control the traffic flow (data packets). Firewall making and implementing laws over cybercrime. Cyber Law
and software. Computer virus 208. The process of repeatedly executing some code until 231. The internet service that enables to connect a remote
184. A program that destroys other programs. Computer condition satisfies. Looping or host computer. Telnet
Virus 209. Device used to connect a PC with a telephone 232. The combination of username and password that is
185. Learning through the electronic media. E-learning line. MODEM used to access a resource. credentials
186. Commerce done by mobile. M-Commerce 210. Device to convert analog signal into digital signal 233. Paperless payment through Internet. Online Payment
187. business through internet. E- Commerce and, vice versa. MODEM 234. Any software installed on your PC that collects your
188. The amount of data transmitted per second through 211. Making data and information unreadable by information without your knowledge. Spyware
the communication channel. Bandwidth unauthorized person. Encryption 235. An intelligent device that has ability to determine the
189. The money that is exchanged electrically. Digital 212. it is the process of converting plain text to cipher best possible path for data transmission. Router
currency text. Encryption 236. The kind of harmful computer code or web script
190. A computer which provides the services to the other 213. The technology to encode file or designed to create system vulnerabilities. Malicious Code
computer in a network. Server message. Encryption 237. Combination of information technology and
191. A main computer of a computer network. Server 214. The method by which information is converted into telecommunication technology. ICT
192. A powerful program that controls and coordinates a secret code that hides the information's true meaning. Encryption 238. A collection of internet host systems that make
computer‟s hardware devices and runs software and 215. The conversion of encrypted data into its original form. services available on the Internet using the HTTP (HyperText
applications. Operating System 216. -Decryption Transfer Protocol). WWW
193. The protocol that makes the network communication 217. A device that controls two dissimilar 239. A way to get the investment whole or part of it back
possible. TCP/IP networks. Gateway in case the computer system is damaged. Insurance
194. Digital marks created while using Internet. Digital 218. Physical layout of computers in a network. Network 9 a) Write a program in QBASIC that asks radius of a circle and
Footprint Topology calculate its Total Surface Area and Volume of sphere. Create a user
195. Secret group of characters which helps to protect file 219. The mode of data communication in which data can - defined function to calculate volume of sphere and sub procedure to
from unauthorized person. Password be transferred in both directions at a time. Full Duplex Mode calculate Total Surface Area
196. A secret code that gives the user to access particular 220. A unique numerical identifier for every device or b) Write a program that prompts the user to supply Employee‟s
program and System. - Password network that connects to the internet. IP Address name, Salary and Gender and stores it into FEMALE.DAT if the
gender is “FEMALE”. The user can supply 10 records after each
45
execution of this OR only those records whose age is below 18 and address is
program. Write a C program to find the sum of first 10 natural numbers. Lalitpur. 4
10. Write a program in C language to ask a number and check 9 a) Write a program in QBASIC that allows user to enter radius of a 10. Write a program in C language to input a number then check
whether it is a multiple of 10 or not. 4 circle. Create a user define function to find the area of circle and sub whether the number is divisible by 5 and 7 or
OR procedure to find volume of a cylinder. Hint: not.
Write a program in „C‟ language to display the series 2, 1, 3, 4, 7, [A= 2 v= 2h] 4 OR
11, 18…….up to 10th terms. b) Write a program to create a sequential data file named Write a program in C language to print series1, 8, 27, 64………..up
9 a) Write a program in QBASIC that asks length, breadth and height “Employ.Dat” to store Name, Post, Address and Salary for the to 10th terms. 4
and calculate its Total Surface Area and Curved Surface Area of number of employees. The program should terminate on user‟s 9a) Write a program in QBASIC that asks any three numbers and
cuboid. Create a user - defined function to calculate Total Surface choice. 4 calculate its product and average. Create a user defined function to
Area of Cuboid and sub procedure to calculate Curved Surface Area 10. Write a program in C language to input any two numbers and product and sub-program to calculate
of Cuboid. [CSA=2h(l+b), TSA=2(lb+bh+hl)] 4 find smaller number. 4 average. 4
b) WAP that reads the records from “MARKS.DAT” having fields OR b) A sequential data file “EMP.DAT” contains name, post and salary
name and marks in English, math and computer and display only the Write a program in C language to display the series 1, 1, 2, 3, 5, 8 fields of information about employees. Write a program to display all
pass records and also count the total number of records stored in it. upto 10th terms. information of employees along with tax amount also.(Tax is 15% of
(Pass Mark for all the subject 9. a) Write a program in QBASIC to input length and calculate its salary) 4
is35 area of square using function procedure and perimeter of square 10. WRITE A C PROGRAM to check greatest among 3
using sub procedure. [Hint: Area = L2 Perimeter = numbers. 4
10. Write a C program to input three different and find the greatest 4L] 4 OR
number. 4 b) A sequential data file called “Record.dat” has stored data under Write a program in C language to display the series with their sum;
OR the field headings: Roll No., Name, Gender, English, Nepali, Maths 100, 95, 90, 85…..upto 10th term 4
Write a C program to print the following series 9,7,5,…1. and Computer. Write a program to display all the information of 9a) Write a program in QBASIC that asks any number and display its
9a) Write a program in QBASIC that asks length, breadth of a room those students whose marks in English is more than 40 and less than square and square root. Create a user defined function to display
and calculate its area and perimeter. Create a user defined function to 70. 4 square root and sub-program to display square of a
calculate area and sub program to calculate perimeter.[Hint: 10. Write C program to find average number of any two number. 4
[Area=LxB], numbers 4 b) A data file “Staff.dat” has stored records of few employees with
[p=2(L+B]] OR EmpID, name, address, post and salary. Write a program to display
b) Write a program to create a sequential data file “salary.dat” to Write a program in C-language to display the series 2, 4, 6, 8 up to all the records of the employee whose address is Butwal and salary is
store programmer‟s name, salary and post according to the need of the 10th term. more than
the user. 9 a. Write a program in QBASIC that ask the radius of circle. Write a 40,000.
10. Write a program in C language to input a number and then check program to calculate the area and circumference of a circle. Create a 4
whether the number is positive, negative or zero user defined function to calculate area and sub procedure to calculate 10. WRITE A C PROGRAM to check whether the a person can vote
number. circumference of a or not. 4
circle. OR
OR Write a program in C language to display first 10 odd numbers.
Write a program in C language to display the series with their sum.1, b. Write a program to update the rate by increasing 10% from a a. Write a program in QBASIC that asks length, breadth and height
2, 3, 4 upto 10th terms. sequential data file "Data.dat" that store item name, rate and of room and calculate its area and volume. Create a user defined
9 a) Write a program in QBASIC that asks length, breadth and height quantity. function to calculate area and sub-program to calculate volume. Hint:
of room and calculate its area and volume. Create a user defined 10. Write a program in c language to calculate simple [A=L×B], [V=L×B×H]
function to calculate area and sub-program to calculate volume. interest. 4 b. A sequential data file called “Record.txt” has stored data under the
Hint: [A=L×B], OR field heading Roll No., Name, Gender, English, Nepali, Maths and
[V=L×B×H] Write a program in C language to display first 10 odd numbers. Computer. Write a program to display all the information of those
b) A sequential data file called “Record.txt” has stored data under 9a) Write a program to define a function procedure to display area of students whose gender is “F” and obtained marks in computer is
the field heading Roll No., Name, Gender, English, Nepali, Maths sphere and sub procedure to display volume of sphere where user has more than 90.
and Computer. Write a program to display all the information of to input the required data in the main module. [Hint: Area of sphere: 10. Write a program in C language that asks a number and check
those students whose gender is “M” and obtained marks in computer 4*PI*R^2, Volume- V = 4/3 * π * whether it is odd or even.
is less than 35. 4 r³ 4 OR
10. Write a program in C language that asks a number and check b) A sequential data file “person.txt” contains information such as Write a program in C language to display the series with their sum.1,
whether it is odd or even. 4 name, address and DOB of 20 people. Write a program to display 2, 3, 4 upto 10th terms.
46
9 a) Write a program in QBASIC to calculate its area and perimeter. (i) (104)8 into decimal 1011 + 1101 110 x 11 Output:
Create a user defined function to calculate area and sub program to (208)10 into The simple interest = 10
calculate perimeter of square. Binary
b) Write a program to create a sequential data file “salary.dat” to (BAD)16 into (1111001)2 into 11 x 10 + 11 110 3. [SLC 2064]
store programmer‟s name, salary and post of 7 employees. Binary octal DECLARE FUNCTION AREA (A,B)
10. Write a C program that asks a number and check whether it is (364)8 into (1101010)2 into 1011 x 101 100101 ÷ 101 CLS
negative or positive. decimal octal LET A = 30
Write a program in C language to display first 10 odd numbers. (523)8 into (2074)10 into 110 x 101 111010 LET B = 40
Number System [4 Marks] [SEE Questions Collections] Binary hexadecimal LET D = AREA(A,B)
Number system (CCA)16 (479)10 into octal (1010) x (10011) ÷ 10 PRINT D
i) ii) (CA3)16 into i) 11×11 ii) Divide into decimal (111) END
(223)8 into binary 1110 by 11 FUNCTION AREA(A,B)
(546)8 into (1011100111)2 into 1011 × 101 100101 ¸ 110
decimal PRINT A, B
decimal Hexadecimal
i) (756)8 into ii) (11011x110)- 111100÷1000 AREA=A*B
(217)10 into (39C)16 into 1011 × 11 110111 – END FUNCTION
binary (1011011011)2 into 11101 Binary Decimal 11001
hexadecimal
(FA)16 into (420)10 into octal 111 x 10 1101 ÷ 101 Output:
i) ii)(78)8 into 10101-1011 110*11 Binary
(101)10 into decimal 30 40
1. [SLC 2065 S] 1200
binary
DECLARE FUNCTION Interest (p,t,r)
i) ii) (31A)16 into 1011x101 1010- CLS
(524)10 into Binary 111+101 LET p = 30
Octal LET t = 40 4. [SLC 2068 S] [SLC 2070] [SLC 2073]
i) ii) (110010)2 into 11*11-101 Divide 1010 LET r = 6 DECLARE FUNCTION AREA(L, B)
(AC3)16 into octal by 10 LET d = Interest (p, t, r) LET L = 10
decimal PRINT “The simple interest will be”; d LET B = 5
i) ii) (1101101)2 into 11*11+11 110÷10 END PRINT “The area=”; AREA(L, B)
(7AF)16 into octal FUNCTION Interest (p, t, r) END
binary answer= (p*t*r) /100 FUNCTION AREA(L, B)
i) ii) (173)8 into 111*11 1010-10+11 Interest=answer A = L*B
(108)10 into binary END FUNCTION AREA = A
binary END FUNCTION
i) ii) (1011)2 into 1011+1101 110x11 Output:
(168)10 into decimal The simple interest will be 72 Output:
binary The area= 50
i) ii) (101011)2 into 1011×11 Divide 2. [SLC 2072]
(684)10 into decimal 100101 by DECLARE FUNCTION Interest (p,t,r) 5. [SLC 2071]
octal 110 CLS DECLARE FUNCTION AVGE(A, B, C)
i) (442)8 into ii) (AB)16 into 101 x 10 divide 1101 LET p = 100 X=10
decimal binary by 111 LET t = 2 Y=5
i) ii) (1010111)2 into 1010 × 10 10101 ÷ 11 LET r = 5 Z=15
(BED)16 into octal LET d = Interest (p, t, r) AV= AVGE(X, Y, Z)
binary PRINT "The simple interest =" ; d RPINT “Average of three numbers”; AV
(209)10-(x)2 ii (537)8-(x)2 101 x 111 110111-1011 END END
FUNCTION Interest (p, t, r)
(108)10 into ii) (765)8 into 111×11 Divide 1101
ans= (p*t*r) /100 FUNCTION AVGE(A, B, C)
binary decimal by 11
Interest=ans S=A+B+C
(74)8 to (FAC)16 into 111×11 101–11 END FUNCTION
decimal binary AVGE = S/3
END FUNCTION
47
Output: PRINT NUM; ”is”; M$
Output: -144 144 12 0 END SUB
Average of three numbers 10
9. DECLARE SUB SHOW (S) Output:
6. [SLC 2067 S] CLS -5 is Negative
DECLARE FUNCTION Area (L,B) CALL SHOW (534) 5 is Positive
LET L = 100 END 0 is Zero
LET B = 20
LET ans = Area (L,B) SUB SHOW (N) 12. DECLARE SUB SERIES ( )
PRINT “The area is”; ans A = N MOD 10 CLS
END B = N \ 10 CALL SERIES
C = B MOD 10 END
FUNTION Area (L, B) D = INT (N / 100)
ar = L * B PRINT “Ans=”; A + C + D SUB SERIES ( )
Area = ar END SUB A=1
END FUNCTION B=1
Output: PRINT A; B;
Output: Ans=12 X:
The area is 2000 LET C = A + B
10. DECLARE SUB VOL (L, B, H) PRINT C
CLS LET A = B
7. DECLARE FUNCTION AREA(L, B) LET L1 = 20 LET B = C
CLS LET B1 = 14 IF C <= 8 THEN GOTO X
LET length = 50 LET H1 = 2 END
LET breadth = 60 CALL VOL(L1, B1, H1)
PRINT AREA (length, breadth) END Output:
PRINT AREA (10, 20) SUB VOL (L, B, H) 1 1 2
END LET V = L * B * H 3
PRINT “Volume=”; V 5
FUNCTION AREA (L, B) END SUB 8
AREA = L * B 13
END FUNCTION Output:
Volume=560 13. DECLARE SUB MIN(A, B)
Output: CLS
3000 11. DECLARE SUB TEST(NUM) A=5
200 CLS B = 10
CALL TEST(-5) CALL MIN(A, B)
8. DECLARE SUB PAT (A) CALL TEST(5) END
A= -144 CALL TEST(0) SUB MIN(A, B)
CALL PAT (A) END IF A < B THEN
END SUB TEST(NUM) C=A+5
SELECT CASE NUM PRINT C
SUB PAT(A) CASE IS < 0 ELSE
B=ABS(A) M$ = “Negative” PRINT B ^ 2
C= SQR(B) CASE IS > 0 END IF
D=C MOD 2 M$ = “Positive” END SUB
PRINT A, B, C, D CASE ELSE
END SUB M$ = “Zero” Output:
END SELECT 10
48
ELSE 19. DECLARE SUB Result()
14. DECLARE SUB OUTPOOT(L, B) C = R MOD 6 + 15 CLS
CLS END IF CALL Result
LET L = 15 D=C\5 END
LET B = 10 OUT = D SUB Result
CALL OUTPOOT(L, B) END FUNCTION A=1
CALL OUTPOOT(3, 6) FOR I = 1 TO 5
END Output: PRINT I*A
SUB OUTPOOT(L, B) 3 A=A+(10^I)
IF L < B THEN NEXT I
PRINT L END SUB
ELSE
PRINT B 17. DECLARE FUNCTION ABC(A, B, C) Output:
END IF CLS 1
END SUB X = 10 22
Y = 20 333
Output: Z = 30 4444
10 G = ABC(X, Y, Z) 55555
3 PRINT G
END
15. DECLARE SUB FEBON(P, Q) FUNCTION ABC(A, B, C) 20. DECLARE SUB SHOW ()
CLS IF A>B AND A<C OR A<B AND A>C THEN CLS
R=2:S=1 GG = A CALL SHOW
CALL FEBON(R, S) ELSEIF B>A AND B<C OR B<A AND B>C THEN END
END GG = B SUB SHOW
ELSE X=30
SUB FEBON(P, Q) GG = C Y=10
T=1 END IF FOR C= 1 TO 2
PRINT P; Q; ABC = GG PRINT X; Y;
LAB: END FUNCTION X=X\Y
LET U = P + Q Y=X-Y
PRINT U; Output: NEXT C
P=Q 20 END SUB
Q=U
T=T+1 18. DECLARE FUNCTION amt(q, r) Output:
IF T <=8 THEN GOTO LAB CLS 3 10 3 -7
END SUB READ q, r
Output: DATA 5000, 10 21. DECLARE SUB Show ( )
2 1 3 4 7 11 18 29 47 76 PRINT “Amount=”; amt(q, r) CLS
END CALL Show
16. DECLARE FUNCTION OUT(A, B) FUNCTION amt(q, r) END
CLS IF (q > 1000) THEN dis = 10 SUB Show
D = OUT(17, 7) total = (q* r) – (q* r *dis / 100) C=3
PRINT D amt = total B=2
END END FUNCTION FOR I=2 TO 8 STEP 2
FUNCTION OUT(A, B) PRINT C,
R = A MOD B Output: SWAP B, C
IF R MOD 2 = 0 THEN Amount=45000 B=C+1
C = R MOD 6 + 30 NEXT I
49
END SUB Next ctr
END SUB Output:
Output: 123454321
3 2 3 4 Output: 1234321
2 2 4 6 12321
22. DECLARE SUB SERI ( ) 121
CLS 25. [SLC 2066 S] 1
CALL SERI DECLARE SUB Result ( )
END CALL Result 28. [SLC 2069]
SUB SERI ( ) END DELARE SUB NUMBER()
N=1 CLS
FOR I=1 TO 10 SUB Result CALL NUMBER
PRINT N; For I = 1 to 9 STEP 2 END
N=N+2 Sum=Sum +I^2 SUB NUMBER
NEXT I Next I N=3
END SUB PRINT Sum C=1
END SUB WHILE C<=5
Output: PRINT N
1 3 5 7 9 11 13 15 17 19 Output: N=N*10+3
165 C=C+1
WEND
23. [SLC 2066] 26. [SLC 2070 S] END SUB
DECLARE SUB Series() DECLARE SUB Series ()
CALL Series CALL Series Output:
END END 3
SUB Series SUB Series 33
X=1 X=0 333
Y=1 FOR K = 10 TO 4 STEP -2 3333
FOR Z=1 TO 4 A = K ^2 33333
PRINT X; X=X+A 29. DECLARE SUB SER ( )
Y=Y+1 NEXT K CALL SER
X=X*10+Y PRINT X END
NEXT Z END SUB
END SUB SUB SER
Output: A=1
Output: 216 B=1
1 12 123 1234 FOR I=1 TO 10 STEP 2
27. DECLARE SUB SERIES() PRINT A*B
24. [SLC 2068] [SLC 2069S] CLS A=A*10 + 1
DECLARE SUB Series( ) CALL SERIES B=B+1
CALL Series END NEXT I
END END SUB
SUB Series SUB SERIES( )
A=2 X#=11111 Output:
B=2 FOR I= 1 TO 5 1
For ctr=1 to 2 PRINT X#^2 22
PRINT A; B; X# = (X# - 1) / 10 333
A= A+B NEXT I 4444
B=A+B END SUB 55555
50

You might also like