Find Output Of Program

Question 11 :

What will be the output of the program ?

#include < stdio.h >

int main()
{
    enum days {MON=-1, TUE, WED=6, THU, FRI, SAT};
    printf("%d, %d, %d, %d, %d, %d\n", ++MON, TUE, WED, THU, FRI, SAT);
    return 0;
}


A). -1, 0, 1, 2, 3, 4
B). Error
C). 0, 1, 6, 3, 4, 5
D). 0, 0, 6, 7, 8, 9
Answer : Option B

Explanation :

Because ++ or -- cannot be done on enum value.


Question 12 :

What will be the output of the program ?

#include < stdio.h >

    struct course
    {
        int courseno;
        char coursename[25];
    };
int main()
{
    struct course c[] = { {102, "Java"}, 
                          {103, "PHP"}, 
                          {104, "DotNet"}     };

    printf("%d ", c[1].courseno);
    printf("%s\n", (*(c+2)).coursename);
    return 0;
}


A). 103 DotNet
B). 102 Java
C). 103 PHP
D). 104 DotNet
Answer : Option A

Question 13 :

What will be the output of the program given below in 16-bit platform ?

#include < stdio.h >

int main()
{
    enum value{VAL1=0, VAL2, VAL3, VAL4, VAL5} var;
    printf("%d\n", sizeof(var));
    return 0;
}


A). 1
B). 2
C). 4
D). 10
Answer : Option B