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

Q21.
What is the output of this C code?
#include <stdio.h>
    struct student
    {
        char *name;
    };
    void main()
    {
        struct student s, m;
        s.name = "st";
        m = s;
        printf("%s%s", s.name, m.name);
    }
Discuss
Answer: (d).st st
Q22.
Which of the following return-type cannot be used for a function in C?
Discuss
Answer: (d).none of the mentioned
Q23.
What’s the output of the following code?
#include <stdio.h>
    struct temp
    {
        int a;
    } s;
    void func(struct temp)
    {
        s.a = 10;
        printf("%d\t", s.a); s
    }
    main()
    {
        func(s);
        printf("%d\t", s.a);
    }
Discuss
Answer: (c).10 0
Q24.
Which of the following is not possible under any scenario?
Discuss
Answer: (d).None of the mentioned
Discuss
Answer: (a).Typecasting of structure
Q26.
Presence of code like “s.t.b = 10” indicate
Discuss
Answer: (b).structure
Q27.
The output of the code below is
#include <stdio.h>
    struct student
    {
        char *name;
    };
    struct student fun(void)
    {
        struct student s;
        s.name = "alan";
        return s;
    }
    void main()
    {
        struct student m = fun();
        s.name = "turing";
        printf("%s", m.name);
    }
Discuss
Answer: (c).Compile time error
Q28.
What is the output of this C code?
#include <stdio.h>
    struct point
    {
        int x;
        int y;
    };
    int main()
    {
        struct point p = {1};
        struct point p1 = {1};
        if(p == p1)
            printf("equal\n");
        else
            printf("not equal\n");
    }
Discuss
Answer: (a).Compile time error
Q29.
What is the output of this C code?
#include <stdio.h>
    struct point
    {
        int x;
        int y;
    };
    struct notpoint
    {
        int x;
        int y;
    };
    struct point foo();
    int main()
    {
        struct point p = {1};
        struct notpoint p1 = {2, 3};
        p1 = foo();
        printf("%d\n", p1.x);
    }
    struct point foo()
    {
        struct point temp = {1, 2};
        return temp;
    }
Discuss
Answer: (a).Compile time error
Q30.
What is the output of this C code?
#include <stdio.h>
    struct point
    {
        int x;
        int y;
    };
    struct notpoint
    {
        int x;
        int y;
    };
    int main()
    {
        struct point p = {1};
        struct notpoint p1 = p;
        printf("%d\n", p1.x);
    }
Discuss
Answer: (a).Compile time error
Page 3 of 27

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!