Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Saturday, November 26, 2022

SEE Output Questions with Dry Run

SEE Output Questions with Dry Run


 1.  New Specification Grid 2077

DECLARE SUB show (a)

CLS

n = 87

CALL show(n)

END

 

SUB show (a)

DO

b = a MOD 6 + 3

IF b MOD 4 = 0 THEN GOTO avn

PRINT b;

avn:

a = a - 10

LOOP WHILE a >= 50

END SUB

 

Dry Run Table

Variable n

Variable a

B= A MOD 6+3

Condition

Is B MOD 4=0

Result

Loop

Is a>=50?

87

87

B=87 MOD 6+3

B=3+3=6

Is 6 MOD 4=0?

False

6

Is 77>=50?

Yes

87

77

B=77 MOD 6+3

B=5+3=8

Is 8 MOD 4=0?

True

-

Is 67>=50?

Yes

87

67

B=67 MOD 6+3

B= 1+3=4

Is 4 MOD 4=0?

True

-

Is 57>=50?

Yes

87

57

B=57 MOD 6+3

B=3+3=6

Is 6 MOD 4=0?

True

6

Is 47>=50?

No

Exit from loop

 

Final output:

6  6

 

2.  SEE 2078

DECLARE SUB abca)

CLS

a=2

CALL abc(a)

END

 

SUB abdc(a)

            FOR j= 1 TO 5

                        PRINT a;

                        a=a+3

            NEXT j

END SUB

 Output:



3.  SEE Grade Promotion Exam 2078

DECLARE SUB result(c$)

c$="COMPUTER"

CALL result(c$)

END

SUB result(c$)

FOR c=1 TO LEN(c$) STEP 2

m$=MID$(c$,c,1)

n$=n$+m$

NEXT c

PRINT n$

END SUB

 

Dry Run:

Variable

C$

Check Loop

Variable m$

Variable n$

Output

COMPUTER

1 to 8?

Yes

C

C

 

COMPUTER

3 to 8?

Yes

M

C+M=CM

 

COMPUTER

5 to 8?

Yes

U

CM+U=CMU

 

COMPUTER

7 to 8?

Yes

E

CMU+E

 

COMPUTER

9 to 8? No

Exit from loop

 

 

CMUE

 

Final Output:

CMUE

 

4.  Pabson SEE Pre-board Examination 2078

DECLARE SUB display(a)

CLS

A=3

CALL display(a)

END

SUB display(a)

FOR x= 1 TO 6

PRINT a;

IF a MOD 2 =0 THEN

A=a/2

ELSE

A=(a*3)+1

ENDIF

NEXT x

END SUB

 

Dry Run

Variable A

Loop check

Display x

Condition check

A=3

For  x= 1 to 6? Yes

3

Is 3 MOD 2= 0? No

A=(3*3)+1=10

For x= 2 to 6? Yes

10

Is 10 MOD 2 =0? Yes

A=10/2=5

For x= 3 to 6? Yes

5

Is 5 MOD 2 =0? No

A=(5*3)+1=16

For x= 4 to 6? Yes

16

Is 16 MOD 2 =0? Yes

A=16/2=8

For x= 5 to 6? yes

8

Is 8 MOD 2=0? Yes

A=8/2=4

For x=6 to 6? Yes

4

Is 4 MOD 2= 0? Yes

A=4/2=2

For x= 7 to 6? NO

Exit from loop

 

 

 

Final Output:

3  10  5  16  8  4

 

5) SEE 2075 (State 2)

DECLARE FUNCTION SQD(N)

CLS

S = 0

FOR L = 1 TO 3

READ NUM

S = S + SQD(NUM)

NEXT L

PRINT "Sum"; S

DATA 2,4,6

END

FUNCTION SQD (N)

SQD = N ^ 2

END FUNCTION

 

Loop 1 to 3

Variable num

Expression SQD

Variable s

1 to 3 ? Yes

2

4

S=0+4=4

2 to 3 ? Yes

4

16

S=4+16=20

3 to 3 ? Yes

6

36

S=20+36=56

 

Final Output:

Sum 56

 

6) SEE 2075

DECLARE SUB series()

CALL series

END

 

SUB series

X = 1

FOR K = 1 TO 4

PRINT X;

X = X + K

NEXT K

END SUB

 

Dry Run:

Variable x

Loop

Output

1

K= 1 to 4 ? Yes

1

X=x+1=2

K=2 to 4? Yes

2

X=2+2=4

K=3 to 4 ? Yes

4

X=4+3=7

K= 4 to 4? Yes

7

X=7+4=11

K= 5 to 4? No

Exit from loop

 

Final Output:

1 2 4 7

 

7) SEE 2074

DECLARE SUB Display (T$)

CLS

T$ = "COMPUTER"

CALL Display (T$)

END

           

SUB Display (T$)

FOR C = 1 to LEN (T$) STEP 2

D$ = MID$(T$, C, 1)

PRINT D$;

NEXT C

END SUB

 

Dry Run

Variable t$

Loop

C= 1 to LEN(t$)

Variable d$

Output

COMPUTER

C= 1 to 8 ? Yes

C

C

COMPUTER

C=3 to 8 ? Yes

M

M

COMPUTER

C= 5 to 8 ? Yes

U

U

COMPUTER

C= 7 to 8 ? Yes

E

E

COMPUTER

C=9 to 8? No

Exit from loop

 Final output:

CMUE

 

 

8) SLC 2068

DECLARE SUB series( )

CALL aerie

END

           

SUB series

A=2

B=2

FOR ctr= 1 to 2

PRINT a;b;

A=a+b

B=a+b

NEXT ctr

END SUB

 

Dry Run:

Variable a

Variable b

Loop

Output

2

2

Ctr= 1 to 2 ? Yes

2 2

2+2=4

4+2=6

Ctr=2 to 2 ? Yes

4 6

4+6=10

10+6=16

Ctr=3 to 2? No

Exit from loop

 Final Output:

2 2 4 6

 

9) SLC 2067

DECLARE SUB result (n$)

n$ = "SCIENCE"

CALL result(n$)

END

SUB result (n$)

b = LEN(n$)

count = 1

WHILE count <= b

x$ = x$ + MID$(n$, count, 1)

count = count + 2

WEND

PRINT x$

END SUB

Dry Run:

Variable n$

Variable b

Variable count

Loop

Is count <=b?

Variable x$

SCIENCE

7

1

Is 1<=7? Yes

S

SCIENCE

7

3

Is 3<=7? Yes

S+I=SI

SCIENCE

7

5

Is 5<=7? Yes

SI+N=SIN

SCIENCE

7

7

Is 7<=7? Yes

SIN+E=SINE

SCIENCE

7

9

Is 9<=7? Yes

Exit from loop

 

 Final Output

SINE

 

10) SLC 2063

DECLARE FUNCTION find( )

CLS

PRINT FIND

END

FUNCTION FIND

 

FOR n= 1 to 9 STEP 2

LET s=s+n

NEXT n

FIND=s

END FUNCTION

 Dry Run:

Variable s

Loop

N= 1 to 9 step 2

0+1=1

1 to 9 ?Yes

1+3=4

3 to 9 ? yes

4+5=9

5 to 9 ? Yes

9+7=16

7 to 9 ? Yes

16+9=25

9 to 9 ? Yes

25+9=35

11 to 9 ? No, Exit from loop

 

Final Output:

35

 

 11)

DECLARE FUNCTION RESULT (N)

N = 4

PRINT RESULT (N)

END

 

FUNCTION RESULT (N)

FOR I = 1 TO N

T = I + 2

D = D + T

NEXT I

RESULT = D

END FUNCTION

 

Dry Run

Variable n

Loop

I= 1 to n

Variable t

Variable d

4

I= 1 to 4

Yes

T=1+2=3

D=0+3=3

4

I= 2 to 4

Yes

T=2+2=4

D=3+4=7

4

I= 3 to 4

Yes

T=3+2=5

D=7+5=12

4

I= 4 to 4

Yes

T=4+2=6

D=12+6=18

4

I=4 to 5

No

Exit from loop

 Final Output:

18

 

12)

DECLARE SUB PATTERN()

CALL PATTERN

END

SUB PATTERN

A=2

FOR I = 1 TO 5

PRINT A;

A=A+2

NEXT I

END SUB


Dry Run:

A

FOR I= 1 to 5

Print A;

A=A+2

2

1

2

A=2+2=4

4

2

4

A=4+2=6

6

3

6

A=6+2=8

8

4

8

A=8+2=10

10

5

10

A=10+2=12

 

Final Output is
2  4  6  8 10

 

13)       Specification Grid 2065

DECLARE SUB RESULT()

CALL RESULT

END

SUB RESULT()

N=5

C=1

WHILE C<=5

PRINT n

N N=N*10+5

C=C+1

WEND

END SUB

 

Dry Run

N

C

C<=5?

PRINT N

N=N*10+5

C=C+1

5

1

1<=5? YES

5

N=5*10+5
=55

C=1+1=2

55

2

2<=5? YES

55

N=55*10+5
=555

C=2+1=3

555

3

3<=5? YES

555

N=555*10+5
=5555

C=3+1=4

5555

4

4<=5? YES

5555

N=5555*10+5=55555

C=4+1=5

55555

5

5<=5? YES

55555

N=55555*10+5
=555555

C=5+1=6

 

Final Output is: 

5

55

 555

5555

55555

 

14)

DECLARE SUB show (a)

CLS

n = 87

CALL show(n)

END

 

SUB show (a)

DO

b = a MOD 6 + 3

IF b MOD 4 = 0 THEN GOTO aa

PRINT b;

aa:

a = a - 10

LOOP WHILE a >= 50

END SUB

 

Dry Run Table

Variable n

Variable a

B= A MOD 6+3

Condition

Is B MOD 4=0

Result

Loop

Is a>=50?

87

87

B=87 MOD 6+3

B=3+3=6

Is 6 MOD 4=0?

False

6

Is 77>=50?

Yes

87

77

B=77 MOD 6+3

B=5+3=8

Is 8 MOD 4=0?

True

-

Is 67>=50?

Yes

87

67

B=67 MOD 6+3

B= 1+3=4

Is 4 MOD 4=0?

True

-

Is 57>=50?

Yes

87

57

B=57 MOD 6+3

B=3+3=6

Is 6 MOD 4=0?

True

6

Is 47>=50?

No

Exit from loop

 

Final output:

6  6

 

15) SEE 2074(Upgrade)

DECLARE SUB REMINDER (R)

CLS

FOR I = 1 TO 4

READ X

CALL REMINDER (X)

NEXT I

DATA 56, 28, 8, 48

END

SUB REMINDER (R)

R1 = R MOD 4

R2 = R MOD 3

IF R1 = 0 AND R2<> 0 THEN

PRINT R

END IF

END SUB

 

Dry Run:

 

Loop

I= 1 to 4

Variable x

Variable r1

Variable r2

Condition

Output

1 to 4 ? Yes

56

0

2

Is r1=0 and r2<>0? Yes

56

2 to 4 ? Yes

28

0

1

Is r1=0 and r2<>0? Yes

28

3 to 4 ? Yes

8

0

2

Is r1=0 and r2<>0? Yes

8

4 to 4 ? Yes

48

0

0

Is r1=0 and r2<>0? No

 

5 to 4? No

Exit from loop

 

 

 

 

 

 Final output

56

28

8

 

16)

DECLARE SUB num ()

CLS

CALL num

END

 SUB num

n = 2

a = 5

c = 1

WHILE c <= 9

PRINT n

n = n * 3 + a

a = a - 1

c = c + 2

WEND

END SUB

 

Dry Run:

Variable n

Vaiable a

Variable c

Condition check

output

2

5

1

Is 1<=9? Yes

2

n=2*3+5=11

a=5-1=4

c=1+2=3

Is 3<=9? Yes

11

n=11*3+4=37

a=4-1=3

C=3+2=5

Is 5<=9? Yes

37

N=37*3+3=114

A=3-1=2

C=5+2=7

Is 7<=9? Yes

114

N=114*3+2=344

A=2-1=1

C=7+2=9

Is 9 <=9? Yes

344

N=344*3+1=1033

A=1-1=0

C=9+2=11

Is 11<=9? No

Exit from loop

 

 

Final Output:

2

11

37

114

344

 

17.

DECLARE FUNCTION fact (n)

CLS

n = 5

PRINT fact(n)

END

 

FUNCTION fact (n)

f = 1

FOR i = 1 TO n

f = f * i

NEXT i

fact = f

END FUNCTION

 

Dry Run:

Variable n

Variable f

Variable i

Loop check

Output

5

1

1

For i= 1 to 5 ? Yes

 

 

1

2

For I = 2 o 5? Yes

 

 

2

3

For I = 3 to 5? Yes

 

 

6

4

For i= 4 to 5? Yes

 

 

24

5

FOR I=5 to 5? yes

 

 

120

6

For i= 6 to 5? No

Exit from loop.

120

 

Final Output:

120

 

18)

DECLARE SUB show(abc$)

CLS

abc$ = "ZHTUOMENXSA"

CALL show(abc$)

END SUB

 

SUB show(abc$)

Y = 48

FOR I = 1 TO 5

N = Y MOD 7

PRINT MID$(abc$,n,1);

Y = Y - 1

NEXT I

END SUB

 

Dry Run:

Y

I

N=Y MOD 7

Print MID$(abc$,N,1);

Y=Y-1

48

1

6

M

47

47

2

5

O

46

46

3

4

U

45

45

4

3

T

44

44

5

2

H

43

 

Final Output

MOUTH

 

19)

DECLARE SUB ABC()

CALL ABC

END

SUB ABC

 N = 10

C = 1

D = 5

WHILE C<=5

PRINT N

N = N + D

C = C + 1

D = D + 5

WEND

END SUB

 

Dry Run

N

C

WHILE N<=5?

Print N

N=N+D

C=C+1

D=D+5

10

1

YES

10

10+5=15

2

5+5=10

15

2

YES

15

15+10=25

3

10+5=15

25

3

YES

25

25+15=40

4

15+5=20

40

4

YES

40

40+20=60

5

20+5=25

60

5

YES

60

60+25=85

6

-

 

Final Output

10

15

25

40

60

 

20)

DECLARE FUNCTION SUM (a)

CLS

a = 9

 PRINT SUM (a)

END

 

 FUNCTION SUM (a)

FOR K = 1 TO a

IF K MOD 2 = O THEN

S = S + K

END IF

NEXT K

 SUM = S

END FUNCTION


Dry Run:

FOR I= 1 to a(9)

K MOD 2 = 0

S=S+K

1

No

-

2

Yes

S=0+2=2

3

No

-

4

Yes

S=2+4=6

5

No

-

6

Yes

S=6+6=12

7

No

-

8

Yes

S=12+8=20

9

No

-

 

Final Output is : 

20

 

21. SEE 2075 (2019) Province-2

DECLARE FUNCTION SQD(N)

CLS

S = 0

FOR L = 1 TO 3

READ NUM

S = S +SQD (NUM)

NEXT L

PRINT " Sum" ; S

DATA 2,4,6

END

FUNCTION SQD (N)

SQD = N^2

END FUNCTION

Answer:
Dry Run:

L

N

SQD=N^2

S=S+SQD(NUM)

1

N=2

SQD=2*2=4

S=0+4=4

2

N=4

SQD=4*4=16

S=4+16=20

3

N=6

SQD=6*6=36

S=20+36=56

Final Output is : 

Sum 56

 

22. SEE 2075 (2019)

DECLARE SUB series ( )

CLS

CALL series

END

SUB series

X = 1

FOR K = 1 TO 4

PRINT X;

X = X + K

NEXT K

END SUB

Answer:
Dry Run:

X

K

Print X;

X=X+K

1

1

1

X=1+1=2

2

2

2

X=2+2=4

4

3

4

X=4+3=7

7

4

7

X=7+4=11

Final Output is : 

1 2 4 7


23.

DECLARE SUB OUTPUT1 (A)

CLS

N=135

CALL OUTPUT1(N)

END

SUB OUTPUT1(A)

 DO WHILE A<>0

R= A MOD 10

T=T+R

A=A\10

LOOP

PRINT T

END SUB


Dry Run:
N=135
A=135

A<>0?

R= N MOD 10

T=T+R

A=A\10

PRINT T

135<>0? YES

R= 135 MOD 10=5

T=0+5=5

A=135\10=13

-

13<>0? YES

R=13 MOD 10=3

T=5+3=8

A=13\10=1

-

1<>0? YES

R= 1 MOD 10=1

T=8+1=9

A=0

-

0<>0? NO

-

-

-

9

Final Output is
9


24.  SEE 2079 (2023)

DECLARE SUB series(a)
CLS
a=20
CALL series(a)
END

SUB series(a)
FOR k= 1 TO 5
PRINT a;
a=a+10
NEXT k
END SUB


Dry Run:




25.  SEE Grade Promotion Exam 2023

DECLARE SUB result(c$)

c$="COMPUTER"
CALL result(c$)
END


SUB result(c$)
FOR c= 1 TO LEN(c$) STEP 2
m$=MID$(c$,c,1)
n$=n$+m$
NEXT c
PRINT n$
END SUB

Dry Run:

Final Output:
CMUE





 

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages