adplus-dvertising

Welcome to the Pointers and Arrays in C MCQs Page

Dive deep into the fascinating world of Pointers and Arrays in C with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Pointers and Arrays in C, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Pointers and Arrays in C, 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 Pointers and Arrays in C. 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 Pointers and Arrays in C. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Pointers and Arrays in C MCQs | Page 12 of 53

Q111.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        char *a[10] = {"hi", "hello", "how"};
        int i = 0;
        for (i = 0;i < 10; i++)
        printf("%s", *(a[i]));
    }
Discuss
Answer: (a).segmentation fault
Q112.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        char *a[10] = {"hi", "hello", "how"};
        int i = 0, j = 0;
        a[0] = "hey";
        for (i = 0;i < 10; i++)
        printf("%s\n", a[i]);
    }
Discuss
Answer: (c).hey hello how Segmentation fault
Q113.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        char *a[10] = {"hi", "hello", "how"};
        printf("%d\n", sizeof(a));
    }
Discuss
Answer: (d).40
Q114.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        char *a[10] = {"hi", "hello", "how"};
        printf("%d\n", sizeof(a[1]));
    }

a.

6

b.

4

c.

5

d.

3

Discuss
Answer: (b).4
Q115.
What is the output of this C code?
#include <stdio.h>
    void main()
    {
        char *a[10] = {"hi", "hello", "how"};
        int i = 0;
        for (i = 0;i < 10; i++)
        printf("%s", a[i]);
    }
Discuss
Answer: (d).hi hello how followed by 7 nulls
Q116.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char *p[1] = {"hello"};
        printf("%s", (p)[0]);
        return 0;
    }
Discuss
Answer: (c).hello
Q117.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char **p = {"hello", "hi", "bye"};
        printf("%s", (p)[0]);
        return 0;
    }
Discuss
Answer: (b).Undefined behaviour
Q118.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int i = 0, j = 1;
        int *a[] = {&i, &j};
        printf("%d", (*a)[0]);
        return 0;
    }
Discuss
Answer: (c).0
Q119.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int i = 0, j = 1;
        int *a[] = {&i, &j};
        printf("%d", *a[0]);
        return 0;
    }
Discuss
Answer: (c).0
Q120.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int i = 0, j = 1;
        int *a[] = {&i, &j};
        printf("%d", (*a)[1]);
        return 0;
    }
Discuss
Answer: (d).Some garbage value

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!