C Language - Functions

You Are Here :: Home > C Language > Functions - General Questions

 
49.

There is a mistake in the following code, add a statement in it to remove it.

main()
{
int a;
a=f(10,3.14)
printf("%d",a);
}
f(int aa,float bb)
{
return((float)aa+bb);
}

A. Add the function prototype in main()
float f(int);
B. Add the function prototype in main()
float f(float);
C. Add the function prototype in main()
int f(int,float);
D. Add the function prototype in main()
float f(int,float);




50.

What error would the following function give on compilation?

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

A. Missing parentheses in return statement B. The function should be defined as int f(int a, int b)
C. Redeclaration of a D. None of the above




51.

Point out the error in the following code.

main()
{
int a=10;
void f();
a=f();
printf("\n %d",a);
}
void f()
{
printf("\n Hi");
}

A. trying to collect the value returned by f() in variable a. B. trying to collect the value returned by void() in variable a.
C. trying to collect the value returned by f() in variable f. D. trying to collect the value returned by f() in variable a.




52.

Point out the error, if any in the following program.

main()
{
int b;
b=f(20);
printf("%d",b);
}
int f(int a)
{
a>20 ? return(10) : return(20);
}

A. return(a ? 10 : 20) B. return(20 ? 10 : 20)
C. return(a>20 ? 10 : 20) D. return(a>20 , 10 : 20)




53.

What will be the output of the following program.

main()
{
C()
{
c()
{
printf(" shalu\n");
}
printf("shalini\n");
}
printf("hi!");
}

A. shalu B. shalini
C. hi! D. Error message




54.

main()

{
int z=4;
printf("%d",printf("%d%d",z,z);
}

A. 4 4 4 B. 4 4 3
C. 2 4 4 D. 2 2 2




« previous

1

2

3

4

5

6

8

9

...

next »

 
 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on