11. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
12. Which of the following is NOT possible with any 2 operators in C?
13. What will be the final value of c in the following C code snippet? (Initial values: a = 1, b = 2, c = 1)
c += (-c) ? a : b;
c += (-c) ? a : b;
14. Arithmetic operations such as addition, subtraction, multiplication and division are allowed on enumerated constants.
15. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 5.3 % 2;
printf("Value of x is %d", x);
}
#include <stdio.h>
void main()
{
int x = 5.3 % 2;
printf("Value of x is %d", x);
}
16. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int const k = 5;
k++;
printf("k is %d", k);
}
#include <stdio.h>
void main()
{
int const k = 5;
k++;
printf("k is %d", k);
}
17. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = x && y = 1;
printf("%d\n", z);
}
#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = x && y = 1;
printf("%d\n", z);
}
18. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int b = 5 - 4 + 2 * 5;
printf("%d", b);
}
#include <stdio.h>
void main()
{
int b = 5 - 4 + 2 * 5;
printf("%d", b);
}
19. What will be the output of the following C code?
#include<stdio.h>
enum Shyam
{
a,b,c=5
};
enum Shyam s;
main()
{
c++;
printf("%d",c);
}
#include<stdio.h>
enum Shyam
{
a,b,c=5
};
enum Shyam s;
main()
{
c++;
printf("%d",c);
}
20. What will be the output of the following C code?
#include <stdio.h>
int main()
{
const int i = 10;
int *ptr = &i;
*ptr = 20;
printf("%d\n", i);
return 0;
}
#include <stdio.h>
int main()
{
const int i = 10;
int *ptr = &i;
*ptr = 20;
printf("%d\n", i);
return 0;
}
Read More Section(C Fundamentals)
Each Section contains maximum 100 MCQs question on C Fundamentals. To get more questions visit other sections.