Sail E0 Webinar

MCQs

Total Questions : 97 | Page 7 of 10 pages
Question 61.

What is the output of this C code?

    int main()

    {

        int i = 0, j = 0;

       while (i < 5, j < 10)

        {

            i++;

            j++;

       }

        printf("%d, %d\n", i, j);

    }

  1.    5, 5
  2.    5, 10
  3.    10, 10
  4.    Syntax error
 Discuss Question
Answer: Option C. -> 10, 10


none


Question 62. Which loop is most suitable to first perform the operation and then test the condition?
  1.    for loop
  2.    while loop
  3.    do-while loop
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> do-while loop


none


Question 63. What is the output of this C code?

    int main()

    {

        int i = 0;

        do

        {

            i++;

            if (i == 2)

                continue;

                printf("In while loop ");

        } while (i < 2);

        printf("%d\n", i);

    }

  1.    In while loop 2
  2.    In while loop In while loop 3
  3.    In while loop 3
  4.    Infinite loop
 Discuss Question
Answer: Option A. -> In while loop 2


none


Question 64. What is the output of this C code?

    int main()

    {

        int i = 0, j = 0;

        for (i; i < 2; i++){

            for (j = 0; j < 3; j++){

                printf("1\n");

                break;

            }

            printf("2\n");

        }

        printf("after loop\n");

    }

  1.    1     2     after loop
  2.    1     after loop
  3.    1     2     1     2     after loop
  4.    1     1     2     after loop
 Discuss Question
Answer: Option C. -> 1     2     1     2     after loop


none


Question 65. What is the output of this C code?

    int main()

    {

        printf("before continue ");

        continue;

        printf("after continue\n");

    }

  1.    Before continue after continue
  2.    Before continue
  3.    after continue
  4.    Compile time error
 Discuss Question
Answer: Option D. -> Compile time error


none


Question 66. What is the output of this C code?

    int main()

    {

        int i = 0;

        while (i < 2)

        {

            if (i == 1)

                break;

                i++;

                if (i == 1)

                    continue;

                    printf("In while loop\n");

        }

        printf("After loop\n");

    }

  1.    In while loop     After loop
  2.    After loop
  3.    In while loop     In while loop     After loop
  4.    In while loop
 Discuss Question
Answer: Option B. -> After loop


none


Question 67. What is the output of this C code?

    int main()

    {

        int i = 0;

        char c = 'a';

        while (i < 2){

            i++;

            switch (c) {

           case 'a':

                printf("%c ", c);

                break;

                break;

            }

        }

        printf("after loop\n");

    }

  1.    a after loop
  2.    a a after loop
  3.    after loop
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> a a after loop


none


Question 68. What is the output of this C code?

   void main()

   {

       int k = 0;

        for (k)

            printf("Hello");

    }

  1.    Compile time error
  2.    hello
  3.    varies
  4.    nothing
 Discuss Question
Answer: Option A. -> Compile time error


none


Question 69. What is the output of this C code?

    void main()

    {

        int k;

        for (k = -3; k < -5; k++)

            printf("Hello");

    }

  1.    Hello
  2.    Infinite hello
  3.    Run time error
  4.    Nothing
 Discuss Question
Answer: Option D. -> Nothing


none


Question 70. What is the output of this C code?

   void main()

    {

        double k = 0;

        for (k = 0.0; k < 3.0; k++);

            printf("%lf", k);

   }

  1.    2.000000
  2.    4.000000
  3.    3.000000
  4.    Run time error
 Discuss Question
Answer: Option C. -> 3.000000


none


Latest Videos

Latest Test Papers