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

Q71.
What is the output of this C code?
struct student
    {
        char *c;
        struct student *point;
    };
    void main()
    {
        struct student s;
        struct student m;
        s.c = m.c = "hi";
        m.point = &s;
        (m.point)->c = "hey";
        printf("%s\t%s\t", s.c, m.c);
    }
Discuss
Answer: (a).hey hi
Q72.
What is the output of this C code?
#include <stdio.h>
    struct student
    {
        char *c;
        struct student *point;
    };
    void main()
    {
        struct student s;
        struct student m;
        m.point = s;
        (m.point)->c = "hey";
        printf("%s", s.c);
    }
Discuss
Answer: (b).Compile time error
Q73.
What is the output of this C code?
#include <stdio.h>
    struct student
    {
        char *c;
        struct student point;
    };
    void main()
    {
        struct student s;
        s.c = "hello";
        printf("%s", s.c);
    }
Discuss
Answer: (d).Compile time error
Q74.
What is the output of this C code?
#include <stdio.h>
    struct student
    {
        char *c;
        struct student *point;
    };
    void main()
    {
        struct student s;
        printf("%d", sizeof(s));
    }

a.

5

b.

9

c.

8

d.

16

Discuss
Answer: (c).8
Q75.
What is the output of this C code?
#include <stdio.h>
    struct student
    {
        char *c;
        struct student *point;
    };
    void main()
    {
        struct student s;
        struct student *m = &s;
        printf("%d", sizeof(student));
    }
Discuss
Answer: (a).Compile time error
Q76.
What is the output of this C code?
#include <stdio.h>
    struct p
    {
        int x;
        char y;
        struct p *ptr;
    };
    int main()
    {
        struct p p = {1, 2, &p};
        printf("%d\n", p.ptr->x);
        return 0;
    }
Discuss
Answer: (c).1
Q77.
What is the output of this C code?
#include <stdio.h>
    typedef struct p *q;
    struct p
    {
        int x;
        char y;
        q ptr;
    };
    typedef struct p *q;
    int main()
    {
        struct p p = {1, 2, &p};
        printf("%d\n", p.ptr->x);
        return 0;
    }
Discuss
Answer: (a).Compile time error
Discuss
Answer: (b).Comparing the address of nodes by address of every other node
Q79.
What is the output of this C code?
#include <stdio.h>
    typedef struct p *q;
    int main()
    {
        struct p
        {
            int x;
            char y;
            q ptr;
        };
        struct p p = {1, 2, &p};
        printf("%d\n", p.ptr->x);
        return 0;
    }
Discuss
Answer: (a).Compile time error
Q80.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        typedef struct p *q;
        struct p
        {
            int x;
            char y;
            q ptr;
        };
        struct p p = {1, 2, &p};
        printf("%d\n", p.ptr->x);
        return 0;
    }
Discuss
Answer: (b).1

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!