[A]



[A] What will be the output of the following programs:

(1) #include

float check (int) ;

int main( )

{

int I = 45 ;

float c ;

c = check (I) ;

printf (“c = %f\n”, c) ;

return 0 ;

}

float check (int ch)

{

return (ch >= 45 ? 3.14: 6.28 ) ;

}

(2) #include

float areacircle (float ) ;

int main( )

{

float area ;

float radius = 2.0 ;

area = areacircle (radius ) ;

printf ( “area = %f\n”,area ) ;

return 0 ;

}

float areacircle ( float r )

{

float a ;

a = 3.14 * r *r ;

printf (“a = %f\n”, a) ;

return (a) ;

}

(3) #include

int message ( ) ;

int main( )

{

int c = 0 ;

printf (“c before call = %d\n” , c ) ;

c = message( )

printf (“c after call = %d\n”, c) ;

return 0 ;

}

int message( )

{

printf(“Live and let live \n” ) ;

}

(4) #include

int main( )

{

C( )

{

c( )

{

printf (“C is a C….\n ) ;

}

printf (“.. is a c…\n” ) ;

}

printf(“..is a sea afterall\n”) ;

return 0 ;

}

( 5) #include

int add (int) ;

int main( )

{

int I = 3, k, l ;

k = add (++I ) ;

l = add (i++) ;

printf(“I = %d k = %d l = %d\n”, I,k, l ) ;

return 0 ;

}

int add (int ii )

{

++ii ;

return (ii) ;

}

(6) #include

int function (int, int) ;

int main( )

{

int I = 135, a = 135, k = ;

k = function (!++I, !a++ ) ;

printf (“I = %d a = %d k = %d\n”, I, a, k ) ;

return 0 ;

int function (int j, intb )

{

int c;

c = j + b ;

return (c) ;

}

7) #include

int fun 1( int ) ;

int main( )

{

int k = 35, z ;

k = fun 1 (k = func1 ( k = func1 (k) ) ) ;

printf (“k = %d\n”,k ) ;

return 0 ;

}

int func1 (int k)

{

k++ ;

return ( k ) ;

}

(8) #include

int func (int) ;

int main( )

{

int k = 35, z ;

z = func (k) ;

printf(“z = %d\n”, z) ;

return 0 ;

}

int fun (int m)

{

++m ;

return ( m = fun 1 (++m) ) ;

}

int func 1 (int m )

{

m++ ;

return (m) ;

}

9) #include

int main( )

{

void message ( ) ;

int c;

printf (“c before call = %d\n”,c ) ;

c = message( ) ;

printf (“c after call = %d\n”,c ) ;

return 0 ;

}

void message( )

{

print (“Only he will survive who is C-fit\n” ) ;

}

( 10) #include

intpackman ( int, int ) ;

int main( )

{

int p = 23, f = 24 ;

packman (p,f ) ;

printf (“p = %d f = %d\n”, p, f) ;

return 0 ;

}

int packman (int q, int h)

{

q = q + q ;

h = h + h ;

return ( q ) ;

return ( q ) ;

}

(11) #include

int add (int) ;

int main( )

{

int I = 3, j ;

j = add (++i++) ;

printf (“I = %d\n”, I,j ) ;

return 0 ;

}

int add (int ii )

{

ii++ ;

printf (“ii = %d\n”, ii ) ;

}

(12) #include

int addsub (int, int );

int main( )

{

int I = 10, j = 20, k ;

k = addsub (I, j) ;

printf (“k = %d\n”,k ) ;

}

int addsub (int c, int d)

{

int x, y ;

x = c-d ;

y = c+d ;

return ( x,y) ;

}

(13) #include

void display (int ) ;

void show (int, int) ;

int main( )

{

int I = 10, j = 20, k ;

display (i) ;

show (I, j) ;

return 0 ;

}

void display (int c, int d)

{

printf (“%d %d\n”, c,d ) ;

}

void show (int c )

{

printf(“%d\n”,c ) ;

}

(14) #include

void printit(char,char) ;

int main( )

{

char a = 65, ch = ‘c’ ;

printit (char, char ) ;

int main( )

{

char a = 65, ch = ‘C’ ;

printit (a, ch) ;

return 0 ;

}

void printit (a,ch)

{

printf (“a = %d ch = %c\n”, a, ch ) ;

}

15) #include

void pri (int, int) ;

void printit ( float, int ) ;

int main( )

{

float a = 3.14 ;

int I = 99 ;

pri( I,a) ;

printift (a, i) ;

return 0 ;

}

void prin( int I, int a )

{

printf(“I = %d a = %f\n”, I,a ) ;

printf (“a = %f I = %d\n”, a, I ) ;

}

void printit (float a,int )

{

printf (“a = %f = %d\n”, a, I ) ;

printf (“I = %d a = %f\n”, I,a ) ;

}

16) #include

int check (int) ;

int main( )

{

int k = 35, z ;

z = chek (k) ;

printf (“z = %d\n”, z ) ;

return 0 ;

}

int check (int m)

{

int m ;

if (m > 40 )

return (!m++ ) ;

else

return (! ++m ) ;

}

(17) #include

int main( )

{

int k = 35, *z, *y ;

z = &k ; /* suppose address of k is 1008*/

y = z ;

*z++ = *y++ ;

k++ ;

printf (“k = %d z = %d y = %d\n”, k,z,y ) ;

return 0 ;

}

(18) #include

int main( )

{

inta = 100, *b, **c, ***d;

b = &a ;

c = & b ;

d = &c ;

printf(“%d %d %d %d\n”, a *b, **c, ***d ) ;

return 0 ;

}

(19) #include

int main( )

{

int z = 4 ;

printf (“%d\n”, printf (“%d %d\n”, z,z ) ) ;

return 0 ;

}

(20) #include = 45 ? p : q) ;

}

(23) #include

Int main( )

{

float *jamboree (float * ) ;

float p = 23.5, *q ;

q = &p ;

printf (“q before call = %d\n”, q) ;

q = jamboree (&p) ;

printf ( “q after call = %d\n”, q) ;

return 0 ;

}

float *jamboree (float * r)

{

r = r+1 ;

return (r) ;

}

(24) #include

int main( )

{

int I ;

printf (“In the year of lord\n”) ;

for(I = 1 ;I ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download