This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Break and Continue – 2”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int i = 0;
if (i == 0)
{
printf("Hello");
continue;
}
}
a) Hello is printed infinite times
b) Hello
c) Varies
d) Compile time error
View Answer
Explanation: None.
2. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int i = 0;
if (i == 0)
{
printf("Hello");
break;
}
}
a) Hello is printed infinite times
b) Hello
c) Varies
d) Compile time error
View Answer
Explanation: None.
3. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
do
{
i++;
if (i == 2)
continue;
printf("In while loop ");
} while (i < 2);
printf("%d\n", i);
}
a) In while loop 2
b) In while loop in while loop 3
c) In while loop 3
d) Infinite loop
View Answer
Explanation: None.
4. What will be the output of the following C code?
#include <stdio.h>
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");
}
a)
1 2 after loop
b)
1 after loop
c)
1 2 1 2 after loop
d)
1 1 2 after loop
Explanation: None.
5. What will be the output of the following C code?
#include <stdio.h>
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");
}
a)
In while loop After loop
b) After loop
c)
In while loop In while loop After loop
d) In while loop
View Answer
Explanation: None.
6. What will be the output of the following C code?
#include <stdio.h>
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");
}
a) a after loop
b) a a after loop
c) after loop
d) error
View Answer
Explanation: None.
7. What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf("before continue ");
continue;
printf("after continue\n");
}
a) Before continue after continue
b) Before continue
c) After continue
d) Compile time error
View Answer
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Get Free Certificate of Merit in C Programming
- Participate in C Programming Certification Contest
- Become a Top Ranker in C Programming
- Take C Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Buy Computer Science Books
- Apply for C Internship
- Buy C Books
- Watch Advanced C Programming Videos
- Practice BCA MCQs