Loops
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 0;
while (++k)
{
printf("Interview Mania");
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
"Interview Mania" infinite times
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 1;
do
{
printf("Interview Mania");
} while (k != 1);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
"Interview Mania" one time
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *S = "";
do
{
printf("Krishana");
} while (S);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
"Krishana" infinite times
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 0;
while (k < 3)
{
k++;
printf("Hello\n");
while (k < 5)
{
k++;
printf("Interview Mania\n");
}
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Hello is printed 1 times, Interview Mania 4 times
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 0, k = 0, q = 1;
for (k = 0; k < 10; k++)
{
p++;
q++;
continue;
}
printf("%d, %d", p, q);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
10, 11