Sail E0 Webinar

MCQs

Total Questions : 97 | Page 9 of 10 pages
Question 81. What is the output of this C code?

    void main()

    {

        int i = 0;

        do

        {

            printf("Hello");

        } while (i != 0);

    }

  1.    Nothing
  2.    H is printed infinite times
  3.    Hello
  4.    Run time error
 Discuss Question
Answer: Option C. -> Hello


none


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

    void main()

    {

        int i = 0;

        while (++i)

        {

            printf("H");

        }

    }

  1.    H
  2.    H is printed infinite times
  3.    Compile time error
  4.    Varies
 Discuss Question
Answer: Option B. -> H is printed infinite times


none


Question 83. The following code 'for(;;)' represents an infinite loop. It can be terminated by.
  1.    break
  2.    exit(0)
  3.    abort()
  4.    All of the mentioned
 Discuss Question
Answer: Option A. -> break


none


Question 84. The correct syntax for running two variable for loop simultaneously is.
  1.    for (i = 0; i < n; i++)      for (j = 0; j < n; j += 5)
  2.    for (i = 0, j = 0;i < n, j < n; i++, j += 5)
  3.    for (i = 0; i < n;i++){}     for (j = 0; j < n;j += 5){}
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> for (i = 0, j = 0;i < n, j < n; i++, j += 5)


none


Question 85. Which for loop has range of similar indexes of 'i' used in for (i = 0;i < n; i++)?
  1.    for (i = n; i>0; i"“)
  2.    for (i = n; i>=0; i"“)
  3.    for (i = n-1; i>0; i"“)
  4.    for (i = n-1; i>-1; i"“)
 Discuss Question
Answer: Option B. -> for (i = n; i>=0; i"“)


none


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

    int main()

    {

        short i;

        for (i = 1; i >= 0; i++)

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

    }

  1.    The control won't fall into the for loop
  2.    Numbers will be displayed until the signed limit of short and throw a runtime error
  3.    Numbers will be displayed until the signed limit of short and program will successfully terminate
  4.    This program will get into an infinite loop and keep printing numbers with no errors
 Discuss Question
Answer: Option C. -> Numbers will be displayed until the signed limit of short and program will successfully terminate


none


Question 87. Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3) ?
  1.    Variable
  2.    Function
  3.    typedef
  4.    macros
 Discuss Question
Answer: Option D. -> macros


none


Question 88. What is the output of the code given below?

   int main()

    {

       printf("%d ", 1);

        goto l1;

        printf("%d ", 2);

        l1:goto l2;

        printf("%d ", 3);

        l2:printf("%d ", 4);

   }

  1.    1   4
  2.    Compilation error
  3.    1   2   4
  4.    1   3   4
 Discuss Question
Answer: Option A. -> 1   4


none


Question 89. What is the output of code given below?

    int main()

    {

       printf("%d ", 1);

        goto l1;

        printf("%d ", 2);

    }

    void foo()

    {

        l1 : printf("3 ", 3);

    }

  1.    1  2  3
  2.    1  3
  3.    1  3  2
  4.    Compilation error
 Discuss Question
Answer: Option D. -> Compilation error


none


Question 90. What is the output of code given below?

    int main()

    {

        printf("%d ", 1);

        l1:l2:

        printf("%d ", 2);

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

    }

  1.    Compilation error
  2.    1   2   3
  3.    1  2
  4.    1  3
 Discuss Question
Answer: Option B. -> 1   2   3


none


Latest Videos

Latest Test Papers