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

Explore more Topics under C Programming

Q131.
What is the output of this C code?
(Assuming size of char = 1, int = 4, double = 8)
 #include <stdio.h>
    union utemp
    {
        int a;
        double b;
        char c;
    }u;
    int main()
    {
        u.c = 'A';
        u.a = 1;
        printf("%d", sizeof(u));
    }

a.

1

b.

4

c.

8

d.

13

Discuss
Answer: (c).8
Q132.
What is the correct syntax to initialize bit-fields in an structure?
a) struct temp
    {
        unsigned int a : 1;
    }s;

b) struct temp
    {
        unsigned int a = 1;
    }s;

c) struct temp
    {
        unsigned float a : 1;
    }s;

d) None of the mentioned

a.

a

b.

b

c.

c

d.

d

Discuss
Answer: (a).a
Q133.
Which of the following data types are accepted while declaring bit-fields?
Discuss
Answer: (a).char
Q134.
Which of the following reduces the size of a structure?
Discuss
Answer: (b).bit-fields
Q135.
For what minimum value of x in a 32-bit Linux OS would make the size of s equal to 8 bytes?
struct temp
    {
        int a : 13;
        int b : 8;
        int c : x;
    }s;
Discuss
Answer: (c).12
Q136.
Calculate the % of memory saved when bit-fields are used for the following structure.
(Assuming size of int = 4, calculate the % using the memory that would be occupied without bit-fields)
struct temp
    {
        int a : 1;
        int b : 2;
        int c : 4;
        int d : 4;
    }s;
Discuss
Answer: (d).75%
Q137.
In the declaration of bit-fields, The constant-expression specifies
struct-declarator:
    declarator
    type-specifier declarator opt : constant-expression
Discuss
Answer: (a).The width of the field in bits
Q138.
In the declaration of bit-fields, The constant-expression must be
struct-declarator:
    declarator
    type-specifier declarator opt : constant-expression
Discuss
Answer: (d).Non-negative integer value
Discuss
Answer: (b).Pointers to bit fields
Q140.
Bit fields can only be declared as part of a structure.
Discuss
Answer: (b).true

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!