3QUEZ

Question 1

What will be the output of the pseudocode?


Integer x, y, z

Set x=10,y=12,z=12

z=(x+y)/4

if(z IS EQUAL TO 12)

Print successful

Else

Print unsuccessful

successful

unsuccessful

Error

None of the above

Ans:- unsuccessful

Question2

What will be the output of following pseudocode?


Integer a,b,count,count1

Set a=1, b=1

while(a<=5)

b=1

while(b<=5)

b=b+1

count1 = count1 + 1

end while

a= a + 1

count = count +1

End while

Print count, count1

count=5 count1=25

count=45 count1=25

count=50 count1=5

count=50 count1=25

Ans:- count=5 count1=25

Question 3

what will be the output


#include<stdio.h>

int main()

{

    int number = 10, expo = 2,temp = 1;

    while (expo is not equals to  0)

    {

        temp = temp * number;

        --expo;

     }

    printf("%d, %d",number, temp);

    return 0;

}


10,100

100,10

Error

None of the above

Ans:- 10,100

Question 4

What will be the output of following pseudo code?


Integer i,j,sum,n

Set sum=0,n=7

Repeat for i=1to n

sum=sum +(i*i)

End loop

Print sum

100

120

140

160

Ans:- 140

Question 5

What will be the output of the following:


Integer a,b,c

Set a=10,b=20

for(c=a;c<=b;c=c+2)

a=a+c

b=b-a+c

if(a>10)

Print a

else

Print b

End if

End for

10

20

30

40

Ans:- 20

Question 6

What will be the output of the following c code?


#include <stdio.h>

int main()

{

  int a = 45;

  int i=sizeof(a);

  printf("%d",i);

}


 

1

6

2

4

Ans:- 4

Question 7

what will be output of following c code?


#include<stdio.h>

int f(int n)

{

  static int a =0;

  if(n<=0)

  {

    return 1;

  }

  if(n>3)

  {

     a=n;

     return f(n-2) +2;

   }

   return f(n-1) + a;

}

int main()

{

  printf("Result: %d",f(5));

  return 0;

}


 

19

9

2

18

Ans:-18

Question 8

What will be the output of the following pseudo-code for input 7?


Read the value of N.


Set m=1,T=0


If m >N


    Go to line No. 9


Else


    T= T+m


    m=m+1


    Go to line no.3


Display the value of T


Stop

28

32

56

76

Ans:- 28

Question 9

what will be the output of the following algorithm for Num=10?


Start

Declare variable I,J and Num

Enter value of Num

Repeat for I=1 to Num

Declare static variable sap and set sap =0

sap=sap+I

J=sap

End loop

Print J

55

85

75

65

Ans:- 55

Question 10

Consider the following pseudocode.


a=1;

b=1;

while(a<=500)

Begin

a=2^a;

b=b+1;

End


What is the value of b at the end of the pseudocode?

4

5

6

7

Ans:- 5