C Exercise Practice Questions
C Exercise Practice Questions
Exercise
Q1. Identify the error
#include < stio.h>
int main()
{
a=2;
printf (“ The value is %d”, a);
return 0;
}
Exercise
Q1. Identify the error
#include < stio.h>
int main()
{
a=2;
printf (“ The value is %d”, a);
return 0;
}
35
Q5. What is the output of this program?
#include <stdio.h>
int main()
{
int a = 2 + 4 + 3 * 5 / 3 - 5;
printf("%d", a);
return 0;
}
Q6. What is the output of this program?
#include <stdio.h>
int main()
{
int a = 5 * 3 % 6 - 8 + 3;
printf("%d", a);
return 0;
}
36
Q7. What is the output of this program?
#include <stdio.h>
int main()
{
float b = 3 % 0 * 1 - 4 / 2;
printf("%f", b);
return 0;
}
Q8. What is the output of this program?
#include <stdio.h>
int main()
{
float b = 5 % 3 & 4 + 5 * 6;
printf("%f", b);
return 0;
}
37
Q 9. What is the output of this statement?
printf ( "%d" , printf ( “welcome" ) );
38
Q 11. What is the output of the following program?
#include<stdio.h>
int main();
void main()
{
printf(“okay”);
}
39
Q 13. Point out the errors in the following codes:
#include <stdio.h>
int main()
{
printf("Hello\n");
return 0;
}
Q 14. Point out the errors in the following codes:
#include <stdio.h>
int main()
{
printf("Hello")
return 0
}
40
Q 15. Point out the errors in the following codes:
int main()
{
printf(Hello);
return 0;
}
41