Sail E0 Webinar

MCQs

Total Questions : 97 | Page 6 of 10 pages
Question 51. Comment on the output of this C code?

    int main()

    {

        int a = 1;

       switch (a)

        {

       case a:

            printf("Case A ");

        default:

            printf("Default");

        }

    }

  1.    Output: Case A
  2.    Output: Default
  3.    Output: Case A Default
  4.    Compile time error
 Discuss Question
Answer: Option D. -> Compile time error


none


Question 52. Comment on the output of this C code?

   switch (ch)

    {

    case 'a':

    case 'A':

        printf("true");

    }

  1.    if (ch == 'a' && ch == 'A') printf(true");
  2.    if (ch == 'a')     if (ch == 'a') printf(true");
  3.    if (ch == 'a' || ch == 'A') printf(true");
  4.    Both a and b
 Discuss Question
Answer: Option D. -> Both a and b


none


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

    int main()

    {

       int i = 0;

        do {

            i++;

            printf("In while loop\n");

        } while (i < 3);

    }

  1.    In while loop In while loop In while loop
  2.    In while loop In while loop
  3.    Depends on the compiler
  4.    Compile time error
 Discuss Question
Answer: Option A. -> In while loop In while loop In while loop


none


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

    int main()

    {

       while ()

            printf("In while loop ");

        printf("After loop\n");

    }

  1.    In while loop after loop
  2.    After loop
  3.    Compile time error
  4.    Infinite loop
 Discuss Question
Answer: Option C. -> Compile time error


none


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

    int main()

    {

       do

           printf("In while loop ");

       while (0);

           printf("After loop\n");

   }

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


none


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

    void main()

    {

        int i = 0, j = 0;

        for (i = 0;i < 5; i++)

        {

            for (j = 0;j < 4; j++)

            {

                if (i > 1)

                    break;

            }

            printf("Hi \n");

        }

    }

  1.    Hi is printed 5 times
  2.    Hi is printed 9 times
  3.    Hi is printed 7 times
  4.    Hi is printed 4 times
 Discuss Question
Answer: Option A. -> Hi is printed 5 times


none


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

    void main()

    {

        int i = 0;

        int j = 0;

        for (i = 0;i < 5; i++)

        {

            for (j = 0;j < 4; j++)

            {

                if (i > 1)

                    continue;

                    printf("Hi \n");

            }

        }

    }

  1.    Hi is printed 9 times
  2.    Hi is printed 8 times
  3.    Hi is printed 7 times
  4.    Hi is printed 6 times
 Discuss Question
Answer: Option B. -> Hi is printed 8 times


none


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

    void main()

    {

        int i = 0;

        for (i = 0;i < 5; i++)

            if (i < 4)

            {

                printf("Hello");

                break;

            }

    }

  1.    Hello is printed 5 times
  2.    Hello is printed 4 times
  3.    Hello
  4.    Hello is printed 3 times
 Discuss Question
Answer: Option C. -> Hello


none


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

    void main()

    {

        int i = 0;

        if (i == 0)

        {

            printf("Hello");

            break;

        }

    }

  1.    Hello is printed infinite times
  2.    Hello
  3.    varies
  4.    compile time error
 Discuss Question
Answer: Option D. -> compile time error


none


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

    void main()

    {

        int i = 0;

        if (i == 0)

        {

            printf("Hello");

            continue;

        }

    }

  1.    Hello is printed infinite times
  2.    Hello
  3.    varies
  4.    Compile time error
 Discuss Question
Answer: Option D. -> Compile time error


none


Latest Videos

Latest Test Papers