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

Q11.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        struct student
        {
            int no;
            char name[20];
        };
        struct student s;
        no = 8;
        printf("%d", no);
    }
Discuss
Answer: (b).Compile time error
Q12.
Number of bytes in memory taken by the below structure is
#include <stdio.h>
    struct test
    {
        int k;
        char c;
    };
Discuss
Answer: (a).Multiple of integer size
Q13.
What is the output of this C code?
#include <stdio.h>
    struct
    {
        int k;
        char c;
    };
    int main()
    {
        struct p;
        p.k = 10;
        printf("%d\n", p.k);
    }
Discuss
Answer: (a).Compile time error
Q14.
What is the output of this C code?
#include <stdio.h>
    struct
    {
        int k;
        char c;
    } p;
    int p = 10;
    int main()
    {
        p.k = 10;
        printf("%d %d\n", p.k, p);
    }
Discuss
Answer: (a).Compile time error
Q15.
What is the output of this C code?
#include <stdio.h>
    struct p
    {
        int k;
        char c;
    };
    int p = 10;
    int main()
    {
        struct p x;
        x.k = 10;
        printf("%d %d\n", x.k, p);
    }
Discuss
Answer: (b).10 10
Q16.
What is the output of this C code?
#include <stdio.h>
    struct p
    {
        int k;
        char c;
        float f;
    };
    int p = 10;
    int main()
    {
        struct p x = {1, 97};
        printf("%f %d\n", x.f, p);
    }
Discuss
Answer: (b).0.000000 10
Q17.
What is the output of this C code(according to C99 standard)?
#include <stdio.h>
    struct p
    {
        int k;
        char c;
        float f;
    };
    int main()
    {
        struct p x = {.c = 97, .f = 3, .k = 1};
        printf("%f\n", x.f);
    }
Discuss
Answer: (a).3.000000
Q18.
What is the output of this C code(according to C99 standard)?
#include <stdio.h>
    struct p
    {
        int k;
        char c;
        float f;
    };
    int main()
    {
        struct p x = {.c = 97, .k = 1, 3};
        printf("%f \n", x.f);
    }
Discuss
Answer: (b).0.000000
Q19.
What is the output of this C code(according to C99 standard)?
#include <stdio.h>
    struct p
    {
        int k;
        char c;
        float f;
    };
    int main()
    {
        struct p x = {.c = 97};
        printf("%f\n", x.f);
    }
Discuss
Answer: (a).0.000000
Q20.
What is the output of this C code?
#include <stdio.h>
    struct student
    {
        char *name;
    };
    struct student s;
    struct student fun(void)
    {
        s.name = "newton";
        printf("%s\n", s.name);
        s.name = "alan";
        return s;
    }
    void main()
    {
        struct student m = fun();
        printf("%s\n", m.name);
        m.name = "turing";
        printf("%s\n", s.name);
    }
Discuss
Answer: (a).newton alan alan
Page 2 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!