Find Output Of Program

Question 1 :

What will be the output of the program?

#include
int main()
{
    enum color{red, green, blue};
    typedef enum color mycolor;
    mycolor m = red;
    printf("%d", m);
    return 0;
}


A). 1
B). 0
C). 2
D). red
Answer : Option B

Question 2 :

What will be the output of the program?

#include
int main()
{
    typedef int arr[5];
    arr iarr = {1, 2, 3, 4, 5};
    int i;
    for(i=0; i < 4; i++)
        printf("%d,", iarr[i]);
    return 0;
}


A). 1, 2, 3, 4
B). 1, 2, 3, 4, 5
C). No output
D). Error: Cannot use typedef with an array
Answer : Option A

Question 3 :

What will be the output of the program?

#include
int main()
{
    typedef int LONG;
    LONG a=4;
    LONG b=68;
    float c=0;
    c=b;
    b+=a;
    printf("%d,", b);
    printf("%f\n", c);
    return 0;
}


A). 72, 68.000000
B). 72.000000, 68
C). 68.000000, 72.000000
D). 68, 72.000000
Answer : Option A

Question 4 :

What will be the output of the program?

#include
int main()
{
    typedef float f;
    static f *fptr;
    float fval = 90;
    fptr = &fval;
    printf("%f\n", *fptr);
    return 0;
}


A). 9
B). 0
C). 90.000000
D). 90
Answer : Option C

Question 5 :

What will be the output of the program?

#include
typedef struct error {int warning, err, exception;} ERROR;
int main()
{
    ERROR e;
    e.err=1;
    printf("%d\n", e.err);
    return 0;
}


A). 0
B). 1
C). 2
D). Error
Answer : Option B