Loops
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int k = 0, L = 0;
while (k < 10, L < 15)
{
k++;
L++;
}
printf("%d, %d\n", k, L);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
15, 15
- Which loop is most suitable to first perform the operation and then test the condition?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
do-while loop
- Which keyword can be used for coming out of recursion?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
return
- 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
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 0, k = 0, q;
for (k = 0; k < 10; k++)
{
p++;
if (k == 9)
break;
}
printf("%d",p);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
10