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

Q81.
What is the output of this C code?
#include <stdio.h>
    typedef struct p *q;
    struct p
    {
        int x;
        char y;
        q ptr;
    };
    int main()
    {
        struct p p = {1, 2, &p};
        printf("%d\n", p.ptr->ptr->x);
        return 0;
    }
Discuss
Answer: (d).1
Q82.
The number of distinct nodes the following struct declaration can point to is
struct node
    {
        struct node *left;
        struct node *centre;
        struct node *right;
    };
Discuss
Answer: (d).All of the mentioned
Discuss
Answer: (d).None of the mentioned
Q84.
Which of the following techinique is faster for travelling in binary trees?
Discuss
Answer: (b).Recursion
Q85.
For the following declaration of structure, which of the following will stop the loop at the last node of a linked list?

struct node
{
struct node *next;
};
a) while (p != NULL)
    {
        p = p->next;
    }
b) while (p->next != NULL)
    {
        p = p->next;
    }
c) while (1)
    {
        p = p->next;
        if (p == NULL)
            break;
    }
d) All of the mentioned

a.

a

b.

b

c.

c

d.

d

Discuss
Answer: (b).b
Q86.
What is the output of this C code?
#include <stdio.h>
    struct student
    {
        char a[5];
    };
    void main()
    {
        struct student s[] = {"hi", "hey"};
        printf("%c", s[0].a[1]);
    }

a.

h

b.

i

c.

e

d.

y

Discuss
Answer: (b).i
Q87.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        char *a[3] = {"hello", "this"};
        printf("%s", a[1]);
    }
Discuss
Answer: (c).this
Q88.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        int lookup[100] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        printf("%d", lookup[3]);
    }
Discuss
Answer: (d).3
Q89.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        char *a[3][3] = {{"hey", "hi", "hello"}, {"his", "her", "hell"}
        , {"hellos", "hi's", "hmm"}};
        printf("%s", a[1][1]);
    }
Discuss
Answer: (a).her
Q90.
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", p->name);
        return 0;
    }
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!