Solution Of Saturday Mock test 

                                            

1.

WhatsApp Group Join Now
Telegram Group Join Now

2.

CLS

INPUT s$

s$ = s$ + ” “

t$ = “”

x$ = “”

FOR i = 1 TO LEN(s$)

       c$ = MID$(s$, i, 1)

       IF c$ <> ” ” THEN

                 t$ = t$ + c$

                 x$ = c$ + x$

       ELSE

                 IF t$ = x$ THEN

                              PRINT t$

                    END IF

                 t$ = “”

                 x$ = “”

       END IF

NEXT i

END

3.

4.

CLS

INPUT “enter the value of n and x”, n, x

s = 0: t = 0: c = 1

FOR i = 1 TO n

       f = 1

       FOR j = 1 TO 2 ^ i

                 f = f * j

       NEXT j

       t = (x ^ i) / f * c

       s = s + t

       c = c * -1

NEXT i

PRINT s

END

5.

class test

{

public static void main(String args[])

{

double u=5.0,a=3.5,t=5;

double v=u+(a*t);

double s=(u*t)+0.5*a*t*t;

System.out.println(“final velocity”+v);

System.out.println(“Dsiplacement”+s);

}

}

6.

class test2

{

public static void main(int a,int b,int c)

{

double avg=(a+b+c)/3.0;

if(avg<=40)

System.out.println(“Grade D”);

else if (avg>40 && avg<=60)

System.out.println(“Grade c”);

else if (avg>60 && avg<=80)

System.out.println(“Grade B”);

else

System.out.println(“Grade A”);

}

}

7.

CLS

INPUT “enter the value of n”, n

t = n: c = 1

WHILE t > 0

       c = c * 10

       t = t \ 10

WEND

a = (n * n) MOD c

IF a = n THEN

       PRINT n, “is automorphic no”

ELSE

       PRINT n, “is not automorphic no”

END IF

END

8. Output finding:

Iteration (P)M CalculationK Values (Inner Loop)Prints (P + K)Final K Value After Inner LoopPrint After Inner Loop (P + K)
1 (P = 4)M = 9K = 2, 4, 6, 84 + 2 = 6, 4 + 4 = 8, 4 + 6 = 10, 4 + 8 = 12K = 104 + 10 = 14
2 (P = 3)M = 6K = 2, 4, 63 + 2 = 5, 3 + 4 = 7, 3 + 6 = 9K = 83 + 8 = 11
3 (P = 2)M = 3K = 22 + 2 = 4K = 42 + 4 = 6
4 (P = 1)M = 0(No inner loop execution)(No prints for inner loop)K = 21 + 2 = 3

 9. Output findings:-

a)PRINT INT(-5.2)-> -6

b)PRINT CINT(-23.5)-> -24

c)PRINT 3 MOD 5 -> 3

d)System.out.print(‘M’+’a’+”AB”)->174AB

Leave a Comment