Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C PROGRAM QUESTIONS : PART 12

The output of the code below is
    void main()
    {
        int k = m();
        printf("%d", k);
    }

    void m()
    {

        printf("hello");
    }

hello 5 
Error 
 Nothing
Junk value
SHOW ANSWER

The output of the code below is
    int *m()
    {
        int *p = 5;
        return p;
    }
    void main()
    {
        int *k = m();
        printf("%d", k);
    }

 Junk value 
 0 
5
SHOW ANSWER

The output of the code below is
    int *m();
    void main()
    {
        int *k = m();
        printf("hello ");
        printf("%d", k[0]);
    }
    int *m()
    {
        int a[2] = {5, 8};
        return a;
    }

hello 5 8 
hello 5 
 hello followed by garbage value 
Compilation error
SHOW ANSWER

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;
    }

Nothing 
 Varies
SHOW ANSWER

The output of the code below is
    void m(int k)
    {
        printf("hi");
    }
    void m(double k)
    {
        printf("hello");
    }
    void main()
    {
        m(3);
    }

hi 
hello 
Compile time error 
Nothing
SHOW ANSWER

What is the default return type if it is not specified in function definition?

void 
 int 
 double
short int
SHOW ANSWER

What is the output of this C code?
    int foo();
    int main()
    {
        int i = foo();
    }
    foo()
    {
        printf("2 ");
        return 2;
    }

Compile time error 
Depends on the compiler 
Depends on the standard
SHOW ANSWER

What is the output of this C code?
    double foo();
    int main()
    {
        foo();
        return 0;
    }
    foo()
    {
        printf("2 ");
        return 2;
    }

Compile time error 
 Depends on the compiler 
 Depends on the standard
SHOW ANSWER

functions can return structure in c?

true 
false 
Depends on the compiler
Depends on the standard
SHOW ANSWER

functions can return enumeration constants in c?

true 
false 
 depends on the compiler 
 depends on the standard
SHOW ANSWER

What is the output of code given below?
    enum m{JAN, FEB, MAR};
    enum m foo();
    int main()
    {
        enum m i = foo();
        printf("%d\n", i);
    }
    int  foo()
    {
        return JAN;
    }

Compile time error 
Depends on the compiler 
Depends on the standard
SHOW ANSWER

What is the output of this C code?
    void main()
    {
        m();
        printf("%d", x);
    }
    int x;
    void m()
    {
        x = 4;
    }

Compile time error
Undefined
SHOW ANSWER

What is the output of this C code?
    int x;
    void main()
    {
        printf("%d", x);
    }

Junk value 
Run time error
 Undefined
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in