What will be the output of the program?
#include<stdio.h>
int

Home | Discussion Forum

What will be the output of the program?

#include<stdio.h>
int i;
int fun1(int);
int fun2(int);

int main()
{
extern int j;
int i=3;
fun1(i);
printf("%d,", i);
fun2(i);
printf("%d", i);
return 0;
}
int fun1(int j)
{
printf("%d,", ++j);
return 0;
}
int fun2(int i)
{
printf("%d,", ++i);
return 0;
}
int j=1;

View More Related Question

1) What will be the output of the program?

#include<stdio.h>
int addmult(int ii, int jj)
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf("%d, %d\n", k, l);
return 0;
}

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

3) What will be the output of the program?

#include<stdio.h>
int sumdig(int);
int main()
{
int a, b;
a = sumdig(123);
b = sumdig(123);
printf("%d, %d\n", a, b);
return 0;
}
int sumdig(int n)
{
int s, d;
if(n!=0)
{
d = n%10;
n = n/10;
s = d+sumdig(n);
}
else
return 0;
return s;
}

4) Point out the error in the program

   f(int a, int b)
{
int a;
a = 20;
return a;
}

5) How many times the program will print "Study 2 Online" ?

  #include<stdio.h>
int main()
{
printf("Study 2 Online");
main();
return 0;
}

UP Gk Online Test

taiyari24hour.com