Top

Functions

21.

Every function must return a value

Answer: B

No, If a function return type is declared as void it cannot return any value.

Enter details here

22.

Can variable i be accessed by functions in another source file?

int i;
    int main()
    {
        printf("%d\n", i);
    }

 

Answer:

Enter details here

23.

If return type for a function is not specified, it defaults to int

Answer: A

True, The default return type for a function is int.

Enter details here

Answer: C

No answer description available for this question.
 

Enter details here

25.

What is the notation for the following functions?

1.  int f(int a, float b)
    {
        /* Some code */
    }

2.  int f(a, b)
    int a; float b;
    {
        /* Some code */
    }

 

Answer: C

KR Notation means Kernighan and Ritche Notation.

Enter details here

26.

functions can return enumeration constants in c?

Answer: A

No answer description available for this question.

Enter details here

27.

What is the output of this code having void return-type function?

void foo()
    {
        return 1;
    }

    void main()
    {
        int x = 0;
        x = foo();
        printf("%d", x);
     }

 

Answer: D

No answer description available for this question.

Enter details here

28.

The output of the code below is

int *m();
    void main()
    {
        int k = m();
        printf("%d", k);
    }
    int *m()
    {
        int a[2] = {5, 8};
        return a;
    }

 

Answer: D

No answer description available for this question.

Enter details here

29.

Maximum number of arguments that a function can take is 12

Answer: B

No, C can accept upto 127 maximum number of arguments in a function.

Enter details here

30.

What is the output of this C code?

static int x;
    void main()
    {
        int x;
        printf("x is %d", x);
    }

 

Answer: B

No answer description available for this question.

Enter details here

Loading…
Tags: Functions Questions and Answers || Functions MCQ Questions and Answers || Functions GK Questions and Answers || Functions GK MCQ Questions || Functions Multiple Choice Questions and Answers || Functions GK || GK on Functions || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming