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 25 of 27

Q241.
What is the output of C program with structures?
int main()
{
    struct ship
    {
        char color[10];
    }boat1, boat2;
    strcpy(boat1.color,"RED");
    printf("%s ",boat1.color);
    boat2 = boat1;
    strcpy(boat2.color,"YELLOW");
    printf("%s",boat1.color);
    return 0;
}
Discuss
Answer: (a).RED RED
Q242.
What is the output of C program with structures?
int main()
{
    struct tree
    {
        int h;
    }
    struct tree tree1;
    tree1.h=10;
    printf("Height=%d",tree1.h);
    return 0;
}
Discuss
Answer: (b).Height=10
Discuss
Answer: (c).structure elements are stored in contiguous memory locations
Q244.
A C Structure or User defined data type is also called
Discuss
Answer: (d).All of the above
Discuss
Answer: (d).All of the above
Q246.
What is the output of C program with structures?
int main()
{
    struct tree
    {
        int h;
        int w;
    };
    struct tree tree1={10};
    printf("%d ",tree1.w);
    printf("%d",tree1.h);
    return 0;
}
Discuss
Answer: (c).0 10
Q247.
What is the output of C program with structures?
int main()
{
    struct tree
    {
        int h;
        int rate;
    };
    struct tree tree1={0};
    printf("%d ",tree1.rate);
    printf("%d",tree1.h);
    return 0;
}
Discuss
Answer: (a).0 0
Q248.
What is the output of C program?
int main()
{
    struct laptop
    {
        int cost;
        char brand[10];
    };
    struct laptop L1={5000,"ACER"};
    struct laptop L2={6000,"IBM"};
    printf("Name=%s",L1.brand);
    return 0;
}
Discuss
Answer: (a).ACER
Q249.
What is the output of C program with structures pointers?
int main()
{
    struct forest
    {
        int trees;
        int animals;
    }F1,*F2;
    F1.trees=1000;
    F1.animals=20;
    F2=&F1;
    printf("%d ",F2.animals);
    return 0;
}
Discuss
Answer: (c).Compiler error
Q250.
What is the output of following C program?
int main()
{
    struct bus
    {
        int seats;
    }F1, *F2;
    F1.seats=20;
    F2=&F1;
    F2->seats=15;
    printf("%d ",F1.seats);
    return 0;
}
Discuss
Answer: (a).15

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!