Page 362 - computer science (868) class 11
P. 362
8 {
9 System.out.println(n.charAt(p)+".");
10 witty(n, p-1);
11 System.out.print(n.charAt(p));
12 }
13 }
14 }
The output of the preceding program is as follows:
E.
C.
N.
E.
I.
C.
S.
SCIENCE
Dry run/working of the preceding program is as follows:
-1 -1<0 true base case blank line " "
0 0<0 false witty("SCIENCE", 0) S. E
System.out.print("S ")
1 1<0 false witty("SCIENCE", 1) C. C
System.out.print("C")
2 2<0 false witty("SCIENCE", 2) I. N
System.out.print("I")
3 3<0 false witty("SCIENCE", 3) E. E
System.out.print("E")
4 4<0 false witty("SCIENCE", 4) N. I
System.out.print("N")
5 5<0 false witty("SCIENCE", 5) C. C
System.out.print("C")
6 6<0 false witty("SCIENCE", 6) E. S
System.out.print("E")
p p<0 Push in stack Output pushing Poping
Program 2 The following function check() is a part of some class. What will the function check() return
when value is (i) n = 25 (ii) n = 10. Show the dry run/working. [ISC 2020]
1 int check(int n)
2 {
3 if(n<=1)
360360 Touchpad Computer Science-XI

