Sail E0 Webinar

MCQs

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

    int main()

    {

        printf("%d ", 1);

        goto l1;

        printf("%d ", 2);

        l1:goto l2;

        printf("%d ", 3);

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

   }

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


none


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

    int main()

    {

        printf("%d ", 1);

        l1:l2:

        printf("%d ", 2);

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

    }

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


none


Question 23. goto can be used to jump from main to within a function?
  1.    true
  2.    false
  3.    depends
  4.    Varies
 Discuss Question
Answer: Option B. -> false


none


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

    int main()

    {

        int i = 0, j = 0;

        while (i < 2)

        {

            l1: i++;

            while (j < 3)

            {

                printf("loop\n");

                goto l1;

            }

        }

   }

  1.    loop loop
  2.    Compile time error
  3.    loop loop loop loop
  4.    Infinite loop
 Discuss Question
Answer: Option D. -> Infinite loop


none


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

    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.    Compile time error
 Discuss Question
Answer: Option D. -> Compile time error


none


Question 26. Which keyword can be used for coming out of recursion?
  1.    break
  2.    return
  3.    exit
  4.    Both (a) and (b)
 Discuss Question
Answer: Option B. -> return


none


Question 27. Which keyword is used to come out of a loop only for that iteration?
  1.    break
  2.    continue
  3.    return
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> continue


none


Question 28. What is the output of this C code?
int
main()
{   int a = 0, i = 0, b;   for (i = 0;i < 5; i++)  {     a++;     continue;   }
}
  1.    2
  2.    3
  3.    4
  4.    5
 Discuss Question
Answer: Option D. -> 5


none


Question 29. The keyword 'break' cannot be simply used within:
  1.    do-while
  2.    if-else
  3.    for
  4.    while
 Discuss Question
Answer: Option B. -> if-else


none


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

    int main()

    {

        int a = 0, i = 0, b;

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

        {

            a++;

            if (i == 3)

                break;

        }

    }

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


none


Latest Videos

Latest Test Papers