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()
{
int k = 0;
for (k)
printf("Hello");
}

(Visited 206 times, 1 visits today)
2.

Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)?

(Visited 206 times, 1 visits today)
3.

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");
}

(Visited 206 times, 1 visits today)
4.

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");
}

(Visited 206 times, 1 visits today)
5.

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);
}
}

(Visited 206 times, 1 visits today)
6.

Which for loop has range of similar indexes of ‘i’ used in for (i = 0;i < n; i++)?

(Visited 206 times, 1 visits today)
7.

What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 0;
for (k < 3; k++)
printf("Hello");
}

(Visited 206 times, 1 visits today)
8.

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");
}

(Visited 206 times, 1 visits today)
9.

The C code ‘for(;;)’ represents an infinite loop. It can be terminated by ___________

(Visited 206 times, 1 visits today)
10.

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");
}

(Visited 206 times, 1 visits today)
11.

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");
}

(Visited 206 times, 1 visits today)
12.

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);
}

(Visited 206 times, 1 visits today)
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");
}

(Visited 206 times, 1 visits today)
14.

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);
}

(Visited 206 times, 1 visits today)
15.

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;
}

(Visited 206 times, 1 visits today)

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 206 times, 1 visits today)
Show Buttons
Hide Buttons