250+ TOP MCQs on Break and Continue and Answers

’s MCQs on C helps anyone preparing for placement in Microsoft and other companies. Anyone looking for Microsoft placement papers should practice these questions continuously for 2-3 months, thereby ensuring a top position in placements.

Here is a listing of basic C questions on “Break and Continue” along with answers, explanations and/or solutions:

1. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int i = 0;
  5.         if (i == 0)
  6.         {
  7.             printf("Hello");
  8.             continue;
  9.         }
  10.     }

a) Hello is printed infinite times
b) Hello
c) Varies
d) Compile time error
Answer: d
Clarification: None.

2. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int i = 0;
  5.         if (i == 0)
  6.         {
  7.             printf("Hello");
  8.             break;
  9.         }
  10.     }

a) Hello is printed infinite times
b) Hello
c) Varies
d) Compile time error
Answer: d
Clarification: None.

3. What will be the output of the following C code?

  1.      #include 
  2.     int main()
  3.     {
  4.         int i = 0;
  5.         do
  6.         {
  7.             i++;
  8.             if (i == 2)
  9.                 continue;
  10.                 printf("In while loop ");
  11.         } while (i < 2);
  12.         printf("%dn", i);
  13.     }

a) In while loop 2
b) In while loop in while loop 3
c) In while loop 3
d) Infinite loop
Answer: a
Clarification: None.

4. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 0, j = 0;
  5.         for (i; i < 2; i++){
  6.             for (j = 0; j < 3; j++)
  7.             {
  8.                 printf("1n");
  9.                 break;
  10.             }
  11.             printf("2n");
  12.         }
  13.         printf("after loopn");
  14.     }

a)

b)

c)

d)

View Answer

Answer: c
Clarification: None.

 
 

5. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 0;
  5.         while (i < 2)
  6.         {
  7.             if (i == 1)
  8.                 break;
  9.                 i++;
  10.                 if (i == 1)
  11.                     continue;
  12.                     printf("In while loopn");
  13.         }
  14.         printf("After loopn");
  15.     }

a)

   In while loop
   After loop

b) After loop
c)

   In while loop
   In while loop
   After loop

d) In while loop
Answer: b
Clarification: None.

6. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 0;
  5.         char c = 'a';
  6.         while (i < 2)
  7.         {
  8.             i++;
  9.             switch (c) 
  10.             {
  11.                case 'a':
  12.                    printf("%c ", c);
  13.                    break;
  14.                    break;
  15.             }
  16.         }
  17.         printf("after loopn");
  18.     }

a) a after loop
b) a a after loop
c) after loop
d) error
Answer: b
Clarification: None.

7. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         printf("before continue ");
  5.         continue;
  6.         printf("after continuen");
  7.     }

a) Before continue after continue
b) Before continue
c) After continue
d) Compile time error
Answer: d
Clarification: None.

Leave a Reply

Your email address will not be published. Required fields are marked *