Welcome to Your Quiz: Aptitude Test C Programming For Loops

Name Email
1. What will be the output of the following C code?
#include <stdio.h>
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++);
printf("%lf", k);
}
2. Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)?
3. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k;
for (k = -3; k < -5; k++)
printf("Hello");
}
4. How many times the below loop will be executed?
#include <stdio.h>
int main()
{
int x, y;
for(x=5; x>=1; x--)
{
for(y=1; y<=x; y++)
printf("%d\n",y);
}
}
5. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 0;
for (k < 3; k++)
printf("Hello");
}
6. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
for (i++; i == 1; i = 2)
printf("In for loop ");
printf("After loop\n");
}
7. What will be the output of the following C code?
#include <stdio.h>
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++)
printf("Hello");
}
8. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
for (foo(); i == 1; i = 2)
printf("In for loop\n");
printf("After loop\n");
}
int foo()
{
return 1;
}
9. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 0;
for (k)
printf("Hello");
}
10. What will be the output of the following C code?
#include <stdio.h>
int main()
{
short i;
for (i = 1; i >= 0; i++)
printf("%d\n", i);
}
11. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
for ( ;  ;  ; )
printf("In for loop\n");
printf("After loop\n");
}
12. Which for loop has range of similar indexes of ‘i’ used in for (i = 0;i < n; i++)?
13. What will be the output of the following C code?
#include <stdio.h>
int main()
{
for (int i = 0;i < 1; i++)
printf("In for loop\n");
}
14. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int *p = NULL;
for (foo(); p; p = 0)
printf("In for loop\n");
printf("After loop\n");
}
15. The C code ‘for(;;)’ represents an infinite loop. It can be terminated by ___________

Thank You for Submitting your response for Quiz

Aptitude Test C Programming For Loops

Please click on View Result Button to see the Result.



(Visited 203 times, 1 visits today)