C- Functions Question and Answer
C- Functions Question and Answer
61. Find the output
void main ( )
{
printf("%u",main));
}
void main ( )
{
printf("%u",main));
}
- Garbage value
- Run time error
- Printing starting address of function main
- Infinite loop
62. Find the output
void main ()
{
show (5);
}
show (int x)
{
static int i=1;
while (i++<5)
{
show (++x);
printf("%d",x);
}
void main ()
{
show (5);
}
show (int x)
{
static int i=1;
while (i++<5)
{
show (++x);
printf("%d",x);
}
- 6 7 8 9
- 9 8 7 6
- 6 6 6 6
- None of these
63. Find the output
void main ()
{
int pascal show (int);
show (5);
}
pascal show (int x, int y)
{
printf ("%d %d", x,y);
}
void main ()
{
int pascal show (int);
show (5);
}
pascal show (int x, int y)
{
printf ("%d %d", x,y);
}
- 0 5
- 5 0
- 0 0
- Compilation error
64. A functions return type may not be
- Double constant
- An array
- A pointer
- A pointer to another pointer
65. Find the output
void main ()
{
int x=10;
x=callme (x);
printf("%d",x);
}
callme (int x)
{
int i=5;
x=x/2-3;
return x,i;
}
void main ()
{
int x=10;
x=callme (x);
printf("%d",x);
}
callme (int x)
{
int i=5;
x=x/2-3;
return x,i;
}
- 3
- 5
- Can't return more than one value
- Function should have a return type
66. Find the output
void main ( )
{
int i =5;
printf ("i=%d", i);
show ( );
printf ("i=%d",i);
}
show ( )
{
int i;
i=1;
return i;
}
void main ( )
{
int i =5;
printf ("i=%d", i);
show ( );
printf ("i=%d",i);
}
show ( )
{
int i;
i=1;
return i;
}
- i=5 i=5
- i=5 i=1
- Function should have a return type
- Multiple declarations of i
67. Find out the false statement
- A program by default sends integer type parameters.
- A function can be a part of an expression.
- Size of a function can be measured using sozeof () operator.
- A stack frame is created in memoy for each function call.
68. Find the output
int x=5;
{
int *p;
int *find( );
p=find ( );
printf("%d", *p);
}
int *find ( )
{
int x=10;
return &x;
}
int x=5;
{
int *p;
int *find( );
p=find ( );
printf("%d", *p);
}
int *find ( )
{
int x=10;
return &x;
}
- 10
- 5
- Garbage
- None of these
69. Find the output
int main (int x)
{
if (k<10)
printf("%d ",main (k+1));
return k;
}
int main (int x)
{
if (k<10)
printf("%d ",main (k+1));
return k;
}
- 2 3 4 5 6 7 8 9 10
- 10 9 8 7 6 5 4 3 2
- Compilation error
- None of thesde
70. Find the output
void main ( )
{
int i=1;
while (i++<5)
printf("%d", call (i));
}
call (int i)
{
return --i;
}
void main ( )
{
int i=1;
while (i++<5)
printf("%d", call (i));
}
call (int i)
{
return --i;
}
- 1 2 3 4
- 0 1 2 3
- Function should return a value
- 0 0 0 0