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 7 of 53

Explore more Topics under C Programming

Q61.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        void *p;
        int a[4] = {1, 2, 3, 4};
        p = &a[3];
        int *ptr = &a[2];
        int n = (int*)p - ptr;
        printf("%d\n", n);
    }
Discuss
Answer: (a).1
Q62.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int a[4] = {1, 2, 3, 4};
        int b[4] = {1, 2, 3, 4};
        int n = &b[3] - &a[2];
        printf("%d\n", n);
    }
Discuss
Answer: (a).-3
Q63.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int a[4] = {1, 2, 3, 4};
        int *p = &a[1];
        int *ptr = &a[2];
        ptr = ptr * 1;
        printf("%d\n", *ptr);
    }
Discuss
Answer: (c).Compile time error
Q64.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int a[4] = {1, 2, 3, 4};
        int *ptr  =  &a[2];
        float n = 1;
        ptr = ptr + n;
        printf("%d\n", *ptr);
    }
Discuss
Answer: (c).Compile time error
Q65.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int a[4] = {1, 2, 3, 4};
        void *p = &a[1];
        void *ptr = &a[2];
        int n = 1;
        n = ptr - p;
        printf("%d\n", n);
    }
Discuss
Answer: (b).4
Q66.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char *str = "hello, world\n";
        char *strc = "good morning\n";
        strcpy(strc, str);
        printf("%s\n", strc);
        return 0;
    }
Discuss
Answer: (b).Crash/segmentation fault
Q67.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char *str = "hello world";
        char strc[] = "good morning india\n";
        strcpy(strc, str);
        printf("%s\n", strc);
        return 0;
    }
Discuss
Answer: (a).hello world
Q68.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char *str = "hello, world!!\n";
        char strc[] = "good morning\n";
        strcpy(strc, str);
        printf("%s\n", strc);
        return 0;
    }
Discuss
Answer: (c).Undefined behaviour
Q69.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char *str = "hello, world\n";
        str[5] = '.';
        printf("%s\n", str);
        return 0;
    }
Discuss
Answer: (d).Segmentation fault
Q70.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char str[] = "hello, world";
        str[5] = '.';
        printf("%s\n", str);
        return 0;
    }
Discuss
Answer: (a).hello. world

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!