Top

Functions

81.

What is the output of this C code?

void main()
    {
        m();
        m();
    }
    void m()
    {
        static int x = 5;
        x++;
        printf("%d", x);
    }

 

Answer: A

No answer description available for this question.

Enter details here

82.

What is the output of this C code?

int foo();
    int main()
    {
        int i = foo();
    }
    foo()
    {
        printf("2 ");
        return 2;
    }

 

Answer: A

No answer description available for this question.

Enter details here

83.

What is the output of this C code?

void main()
    {
        static int x = 3;
        x++;
        if (x <= 5)
        {
            printf("hi");
            main();
        }
    }

 

Answer: D

No answer description available for this question.

Enter details here

Answer: D

No answer description available for this question.

Enter details here

85.

The keyword used to transfer control from a function back to the calling function is

Answer: D

No answer description available for this question.
 

Enter details here

86.

What will be the output?

int main()
    {
        printf("%d", d++);
    }
    int d = 10;

 

Answer: D

No answer description available for this question.

Enter details here

87.

The keyword used to transfer control from a function back to the calling function is

Answer: D

The keyword return is used to transfer control from a function back to the calling function.

Example:

#include
int add(int, int); /* Function prototype */

int main()
{
    int a = 4, b = 3, c;
    c = add(a, b);
    printf("c = %d\n", c);
    return 0;
}
int add(int a, int b)
{
/* returns the value and control back to main() function */
   return (a+b);
}

Output: c = 7

Enter details here

88.

What is the output of this C code?

int x = 5;
    void main()
    {
        int x = 3;
        printf("%d", x);
        {
            int x = 4;
        }
        printf("%d", x);
    }

 

Answer: A

No answer description available for this question.

Enter details here

89.

What will happen after compiling and running following code?

main()
{
  printf("%p", main);
}

 

Answer: C

Function names are just addresses (just like array names are addresses).
main() is also a function. So the address of function main will be printed. %p in printf specifies that the argument is an address. They will be printed as hexadecimal numbers.

Enter details here

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