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

Q111.
For the following expression to work, which option should be selected.
string p = “HELLO”;
Discuss
Answer: (b).typedef char *string;
Q112.
Which of the given option is the correct method for initialization?
typedef char *string;
Discuss
Answer: (b).string p = “Hello”;
Discuss
Answer: (b).typedef defined substitutes can be redefined again. (Eg: typedef char a; typedef int a;)
Discuss
Answer: (a).type PFI, for pointer to function (of two char * arguments) returning int
Discuss
Answer: (c).Does not create a new type, It merely adds a new name for some existing type
Q116.
What is the output of this C code?
#include <stdio.h>
    typedef struct student
    {
        char *a;
    }stu;
    void main()
    {
        stu s;
        s.a = "hi";
        printf("%s", s.a);
    }s
Discuss
Answer: (a).Compile time error
Discuss
Answer: (c).Biggest member in the union
Q118.
Comment on the following union declaration?

union temp s = {1,2.5,’A’}; //REF LINE
Which member of the union will be active after REF LINE?
#include <stdio.h>
    union temp
    {
        int a;
        float b;
        char c;
    };
Discuss
Answer: (a).a
Q119.
What would be the size of the following union declaration?
(Assuming size of double = 8, size of int = 4, size of char = 1)
#include <stdio.h>
    union uTemp
    {
        double a;
        int b[10];
        char c;
    }u;
Discuss
Answer: (c).40
Q120.
What type of data is holded by variable u int this C code? The variable u here
#include <stdio.h>
    union u_tag
    {
        int ival;
        float fval;
        char *sval;
    } u;
Discuss
Answer: (a).Will be large enough to hold the largest of the three types;

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!