Topic-1:FUNCTIONS
By: N.Dinesh ( ECE-B)
1.Is it possible to pass command line arguments to C programs? If yes, can you write down the prototype for main
command line arguments?
a) yes
function with
b)no
a) yes
b)no
------------------------------------------------------------------------------------------------------------------------------------------------------------------------7.Will the following functions work?
int f1(int a, int b)
{
return ( f2(20) );
}
int f2(int a)
{
return (a*a);
}
a) yes
b)no
------------------------------------------------------------------------------------------------------------------------------------------------------------------------8.If a function contains two return statements successively, the compiler will generate warnings. Yes/No ?
a) yes
b)no
------------------------------------------------------------------------------------------------------------------------------------------------------------------------9.Which of the following statements are correct about the program?
#include<stdio.h>
int main()
{
printf("%p\n", main());
return 0;
}
a). It prints garbage values infinitely
b).Runs infinitely without printing anything
c). Error: main() cannot be called inside printf()
d). No Error and print nothing
------------------------------------------------------------------------------------------------------------------------------------------------------------------------10.There is a error in the below program. Which statement will you add to remove it?
#include<stdio.h>
int main()
{
int a;
a = f(10, 3.14);
printf("%d\n", a);
return 0;
}
float f(int aa, float bb)
{
return ((float)aa + bb);
}
a). Add prototype: float f(aa, bb)
c). Add prototype: float f(float, int)
b). Print 1, 2, 3, 4, 5
d). Infinite loop
==================================================================================================
==================================================================================================