C- Functions Question and Answer
C- Functions Question and Answer
71. Find the output
void main ()
{
char *p="hai";
char q[ ]="bye";
pass (p,q);
printf("%s %s", p,q);
}
pass (char *p, char q[ ] )
{
p='H';
q='B";
}
void main ()
{
char *p="hai";
char q[ ]="bye";
pass (p,q);
printf("%s %s", p,q);
}
pass (char *p, char q[ ] )
{
p='H';
q='B";
}
- Hai Bye
- hai bye
- None portable pointer conversion
- None of these
72. Find the output
void main ( )
{
int t;
int pascal mu1 ( );
t=mu1 (3,4,5,6);
printf("%d", t);
}
int pascal mu1 (int x, int y, int z)
{
return (y*z);
}
void main ( )
{
int t;
int pascal mu1 ( );
t=mu1 (3,4,5,6);
printf("%d", t);
}
int pascal mu1 (int x, int y, int z)
{
return (y*z);
}
- 30
- 12
- 20
- Compilation error
73. Find the output
void main ( )
{
int t;
int pascal mu1 ( );
t=mu1 (3,4,5,6);
printf("%d", t);
}
int pascal mu1 (int x, int y, int z)
{
return (y*z);
}
void main ( )
{
int t;
int pascal mu1 ( );
t=mu1 (3,4,5,6);
printf("%d", t);
}
int pascal mu1 (int x, int y, int z)
{
return (y*z);
}
- 30
- 12
- 20
- Compilation error
74. When a function called to itself directly or indirectly, that is called
- Function recursion
- Self referenctial function
- Library function
- None of those
75. Find the output
void main ()
{
int p;
p=sub (x( ), y ( ), z( ));
printf ("%d", p);
}
int sub(int a, int b, int c, int d)
return (a-b-c);
}
int x ( ) {return 15;}
int y ( ) {return 5;}
int z () (return 2;}
void main ()
{
int p;
p=sub (x( ), y ( ), z( ));
printf ("%d", p);
}
int sub(int a, int b, int c, int d)
return (a-b-c);
}
int x ( ) {return 15;}
int y ( ) {return 5;}
int z () (return 2;}
- Garbage value
- 8
- Compilation error
- 15
76. Find the output
void main ( )
{
int i;
float f=3. 14;
float compute ( float );
i=compute ( f );
printf ("%d",i);
}
float compute (float x)
{
if (x==3.14)
return ( 0);
else
return (1);
}
void main ( )
{
int i;
float f=3. 14;
float compute ( float );
i=compute ( f );
printf ("%d",i);
}
float compute (float x)
{
if (x==3.14)
return ( 0);
else
return (1);
}
- Suffering
- Garbage
- 0
- 1
77. Recursion
- Execution is faster.
- Additional storage space is not required.
- A queue is needed to process the recursion.
- Helps in writing compact code.
79. Find the output
void main ( )
{
int i = 100;
float f=5.413;
print (i, f);
}
printf( "%d %f", i, f);
}
void main ( )
{
int i = 100;
float f=5.413;
print (i, f);
}
printf( "%d %f", i, f);
}
- 100 5.413
- 100 5.000
- 100 0.000
- Compilation error
80. Find the output
void main ( )
{
int x=10, y;
y=choose (x);
printf("%d",y);
}
choose (y)
{
int y;
if (y>=5)
return (y);
else
return (0);
}
void main ( )
{
int x=10, y;
y=choose (x);
printf("%d",y);
}
choose (y)
{
int y;
if (y>=5)
return (y);
else
return (0);
}
- 10
- 0
- Can't determine
- Compilation error