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

Q91.
What is the output of this C code?
#include <stdio.h>
    struct p
    {
        char *name;
        struct p *next;
    };
    struct p *ptrary[10];
    int main()
    {
        struct p p;
        p.name = "xyz";
        p.next = NULL;
        ptrary[0] = &p;
        printf("%s\n", ptrary[0]->name);
        return 0;
    }
Discuss
Answer: (d).xyz
Q92.
What is the output of this C code?
#include <stdio.h>
    struct p
    {
        char *name;
        struct p *next;
    };
    struct p *ptrary[10];
    int main()
    {
        struct p p, q;
        p.name = "xyz";
        p.next = NULL;
        ptrary[0] = &p;
        strcpy(q.name, p.name);
        ptrary[1] = &q;
        printf("%s\n", ptrary[1]->name);
        return 0;
    }
Discuss
Answer: (b).Segmentation fault/code crash
Q93.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        struct p
        {
            char *name;
            struct p *next;
        };
        struct p p, q;
        p.name = "xyz";
        p.next = NULL;
        ptrary[0] = &p;
        strcpy(q.name, p.name);
        ptrary[1] = &q;
        printf("%s\n", ptrary[1]->name);
        return 0;
    }
Discuss
Answer: (c).Undefined behaviour
Q94.
Which function is responsible searching in the table?
(For #define IN 1, the name IN and replacement text 1 are stored in a “table”)
Discuss
Answer: (b).lookup(s);
Q95.
Which algorithm is used for searching in the table?
Discuss
Answer: (c).Hash search
Q96.
Which function is responsible for recording the name “s” and the replacement text “t” in a table?
Discuss
Answer: (a).install(s, t);
Discuss
Answer: (a).Install function uses lookup
Discuss
Answer: (b).It modifies the name with new definition
Discuss
Answer: (a).When there is no memory for adding new name
Q100.
What is the output of this C code?
#include <stdio.h>
    struct student
    {
        char a[];
    };
    void main()
    {
        struct student s;
        printf("%d", sizeof(struct student));
    }
Discuss
Answer: (a).Compile time error

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!