MCQ

Time 30 minute

 

Answer the question 1and 2 using following flow chart.

 

 

1.      What is the output of the above flow chart?

1)     5 8

2)     8 5

3)     40 8

4)     8 40

5)     40 5

2.      What is the pseudo-code that matches the flow chart above?

1)              

Begin

   A=5

  B=A+3

  A=B x 5

  Print B,A

End.

 

2)              

Begin

   A=5

  B=A+3

  A=B x 5

  Print A,B

End.

 

      

3)              

Begin

   A=5

  A=B+3

  A=B x 5

  Print A,B

End.

 

4)              

Begin

   A=5

  A=B+3

  A=B x 5

  Print B,A

End.

 

5)              

Begin

   A=5

   A=B x 5

   B=A+3

   Print B,A

End.

 

 


Consider the flow chart below

3.      If 20 is given as input, what is the output?

1)     Ans

2)     6

3)     10

4)     10.0

5)     20        

4.       What is the pseudo-code that the flow chart above represents?

1)              

Begin

   Enter number

   if number>20 then

       Ans=(number x 3)/10

  Else

      Ans=(number x 5)/10

  End if

  Print Ans

End.

2)                

Begin

   Enter number

   if number>20 then

       Ans=(number x 5)/10

  Else

      Ans=(number x 3)/10

  End if

  Print ‘Ans’

End.

 

3)              

Begin

   Enter number

   if number<20 then

       Ans=(number x 5)/10

  Else

      Ans=(number x 3)/10

  End if

  Print Ans

End.

4)              

Begin

   Enter number

   if number>20 then

       Ans=(number x 5)/10

  Else

      Ans=(number x 3)/10

  End if

  Print Ans

End.

5)              

Begin

   Enter number

   if number>20 then

       Ans=(number x 3)/10

  Else

      Ans=(number x 5)/10

     Print Ans

  End if

End.

 

 

5.        If -5 is given as input to the following pseudo code, what is the output?

Begin

    Enter X

    If X=0 then

         Y=0

    Else if X>0 then

                  Y=X+1

            Else

                  Y=X-1

            End if

    Endif

Print Y

End.


1)     0

2)     -4

3)     4

4)     -5

5)     -6   

 

consider the flow chart below.

 

6.   If 19 is given as input to the above flow chart, what is the output?

1)      blue

2)      red

3)      green

4)      This is not a correct color option

5)     Please type in a number

7.       7  What is the pseudo-code that matches the flow chart above?

1)              

Begin

   Input positive number as A

   If A<10 then

      Display “blue”

  Else if A<20 then

             Display “red”

          Else if A<30 then

                   Display “green”

                  Else

                        Display “this is not a      

                         correct color option”

                  endif

            endif

endif

end.

 

2)              

Begin

   Input positive number as A

   If A>10 then

      Display “blue”

  Else if A>20 then

             Display “red”

          Else if A>30 then

                   Display “green”

                  Else

                        Display “this is not a      

                         correct color option”

                  endif

            endif

endif

end.

 

3)              

Begin

   Input positive number as A

   If A<10 then

      Display “blue”

  if A<20 then

             Display “red”

   if A<30 then

                   Display “green”

   Else

             Display “this is not a correct    

               color option”

    endif

end.

 

4)              

Begin

   Input positive number as A

   If A<10 then

      Display “red”

  Else if A<20 then

             Display “blue”

          Else if A<30 then

                   Display “green”

                  Else

                        Display “this is not a      

                         correct color option”

                  endif

            endif

endif

end.

 

5)              

Begin

   Input positive number as A

   If A<=10 then

      Display “blue”

  Else if A<=20 then

             Display “red”

          Else if A<=30 then

                   Display “green”

                  Else

                        Display “this is not a      

                         correct color option”

                  endif

            endif

endif

end.

 

 

8.      What is the output of the following flow chart?

 

 


  1)     7

2)         2)     9

3)         3)     21

4)         4)     1 3 5 7 9

5)         5)     3 9 15 21

 

9.  9.        What is the pseudo-code that matches the flow chart above?

1)              

Begin

   N=1

   While N>8 do

         S=N*2+N

         N=N+2

  End while

  Display S

End.

2)              

Begin

   N=1

   While N<8 do

         S=N*2+N

         N=N+2

  End while

  Display S

End.

3)              

Begin

   N=1

   While N>8 do

         S=N*2+N

         N=N+2

  End while

  Display “S”

End.

4)              

Begin

   N=1

   While N>8 do

         S=N*2+N

         N=N+2

  End while

  Display “S”

End.

5)              

Begin

   N=1

   While N<8 do

         S=N*2+N

         N=N+2

        Display S

   End while

End.

 

10.   consider the following flow chart.

 

 

What is the pseudo-code that matches the flow chart above?

A.                

Begin

   Sum=0

   C=10

   While C<=20 do

       Sum=Sum+C

       C=C+1

  End while

Display Sum

End.

 

                

B.              

Begin

   Sum=0

   For C =10 to 20 do

       Sum=Sum+C

    Next C

Display Sum

End.

 

C.               

Begin

   Sum=0

   For C =10 to 20 do

       Sum=Sum+C

       C=C+1

    Next C

Display Sum

End.

 


1)     A only

2)     B only

3)     C only

4)     A and B only

5)     A and  C only