1. What is the format identifier for "static a = 20.5;"?
2. What will be the output of the following C code?
#include <stdio.h>
#define COLD
int main()
{
#ifdef COLD
printf("COLD\t");
#undef COLD
#endif
#ifdef COLD
printf("HOT\t");
#endif
}
#include <stdio.h>
#define COLD
int main()
{
#ifdef COLD
printf("COLD\t");
#undef COLD
#endif
#ifdef COLD
printf("HOT\t");
#endif
}
3. What will be the output of the following C code?
#include <stdio.h>
int *m()
{
int *p = 5;
return p;
}
void main()
{
int *k = m();
printf("%d", k);
}
#include <stdio.h>
int *m()
{
int *p = 5;
return p;
}
void main()
{
int *k = m();
printf("%d", k);
}
4. Which directory the compiler first looks for the file when using #include?
5. What will be the output of the following C code?
#include <stdio.h>
#define foo(x, y) x / y + x
int main()
{
int i = -6, j = 3;
printf("%d\n",foo(i + j, 3));
return 0;
}
#include <stdio.h>
#define foo(x, y) x / y + x
int main()
{
int i = -6, j = 3;
printf("%d\n",foo(i + j, 3));
return 0;
}
6. What will be the output of the following C code?
#include <stdio.h>
int m()
{
printf("hello");
}
void main()
{
int k = m();
printf("%d", k);
}
#include <stdio.h>
int m()
{
printf("hello");
}
void main()
{
int k = m();
printf("%d", k);
}
7. What will be the output of the following C code?
#include <stdio.h>
int main()
{
register auto int i = 10;
i = 11;
printf("%d\n", i);
}
#include <stdio.h>
int main()
{
register auto int i = 10;
i = 11;
printf("%d\n", i);
}
8. What will be the output of the following C code?
#include <stdio.h>
void main()
{
m();
}
void m()
{
printf("hi");
m();
}
#include <stdio.h>
void main()
{
m();
}
void m()
{
printf("hi");
m();
}
9. What will be the output of the following C code?
#include <stdio.h>
void foo();
int main()
{
void foo(int);
foo(1);
return 0;
}
void foo(int i)
{
printf("2 ");
}
#include <stdio.h>
void foo();
int main()
{
void foo(int);
foo(1);
return 0;
}
void foo(int i)
{
printf("2 ");
}
10. Which of the following is an external variable in the following C code?
#include <stdio.h>
int func (int a)
{
int b;
return b;
}
int main()
{
int c;
func (c);
}
int d;
#include <stdio.h>
int func (int a)
{
int b;
return b;
}
int main()
{
int c;
func (c);
}
int d;
Read More Section(Function)
Each Section contains maximum 100 MCQs question on Function. To get more questions visit other sections.