adplus-dvertising

Welcome to the Structures and Unions MCQs Page

Dive deep into the fascinating world of Structures and Unions with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Structures and Unions, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Structures and Unions, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Structures and Unions. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Structures and Unions. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Structures and Unions MCQs | Page 26 of 27

Q251.
What is the output of C program with structure arrays?
int main()
{
    struct pens
    {
        int color;
    }p1[2];
    struct pens p2[3];
    p1[0].color=5;
    p1[1].color=9;
    printf("%d ",p1[0].color);
    printf("%d",p1[1].color);
    return 0;
}
Discuss
Answer: (b).5 9
Q252.
What is the output of C program with structure array pointers?
int main()
{
    struct car
    {
        int km;
    }*p1[2];
    struct car c1={1234};
    p1[0]=&c1;
    printf("%d ",p1[0]->km);
    return 0;
}
Discuss
Answer: (c).1234
Q253.
What is the output of c program with structures?
int main()
{
    struct car
    {int color;};
    struct garage
    {
        struct car mycar[10];
    }gar;
    struct car c1={5};
    gar.mycar[0]=c1;
    printf("%d",gar.mycar[0]);
    return 0;
}
Discuss
Answer: (c).5
Q254.
What is the size of the below C structure in TurboC?
int main()
{
    struct books{
        int pages;
        char str[4];
    }b;
    printf("%d",sizeof(b));
    return 0;
}

a.

5

b.

6

c.

7

d.

8

Discuss
Answer: (b).6
Q255.
What is the output of C program with Structure pointer in TurboC?
int main()
{
    struct books{
        int pages;
        char str[4];
    }*ptr;
    printf("%d",sizeof(ptr));
    return 0;
}

a.

2

b.

6

c.

7

d.

8

Discuss
Answer: (b).6
Q256.
In a nested structure definition, with country.state.district statement, memeber state is actually present in the structure? (COUNTY, STATE, DISTRICT structures)
Discuss
Answer: (c).country
Discuss
Answer: (a).Copy of structure variable
Q258.
What is the output of C program with structures?
void show(int,int);
int main()
{
    struct paint{
        int type;
        int color;
    }p;
    p.type=1;
    p.color=5;
    show(p.type,p.color);
    return 0;
}
void show(int a,int b)
{
    printf("%d %d",a,b);
}
Discuss
Answer: (b).1 5
Q259.
What is the output of C program with structures?
int main()
{
    struct paint{
        int type;
        int color;
    }p1, p2;
    p1.type=1;
    p1.color=5;
    if(sizeof(p1)==sizeof(p2))
    {
        printf("SAME");
    }
    else
    {
        printf("DIFFERENT");
    }
    return 0;
}
Discuss
Answer: (a).SAME
Discuss
Answer: (d).All of the above

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!