C Language MCQ - English
What will be the output of the program?
#include<stdio.h>
int
Home | Discussion Forum
int
What will be the output of the program?#include<stdio.h>
int fun(int, int);
typedef int (*pf) (int, int);
int proc(pf, int, int);
int main()
{
printf("%d\n", proc(fun, 6, 6));
return 0;
}
int fun(int a, int b)
{
return (a==b);
}
int proc(pf p, int a, int b)
{
return ((*p)(a, b));
}
Answer : B
View More Related Question
1) What will be the output of the program?#include<stdio.h>
int fun(int);
int main()
{
float k=3;
fun(k=fun(fun(k)));
printf("%f\n", k);
return 0;
}
int fun(int i)
{
i++;
return i;
}
2) Point out the error in the program#include<stdio.h>
int f(int a)
{
a > 20? return(10): return(20);
}
int main()
{
int f(int);
int b;
b = f(20);
printf("%d\n", b);
return 0;
}
View Answer
3) If int is 2 bytes wide.What will be the output of the program?#include <stdio.h>
void fun(char**);
int main()
{
char *argv[] = {"ab", "cd", "ef", "gh"};
fun(argv);
return 0;
}
void fun(char **p)
{
char *t;
t = (p+= sizeof(int))[-1];
printf("%s\n", t);
}
4) What will be the output of the program?#include<stdio.h>
int main()
{
int i=1;
if(!i)
printf("Study2Online,");
else
{
i=0;
printf("C-Program");
main();
}
return 0;
}
View Answer
5) Point out the error in the program#include<stdio.h>
int main()
{
int a=10;
void f();
a = f();
printf("%d\n", a);
return 0;
}
void f()
{
printf("Hi");
}