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

Explore more Topics under C Programming

Q161.
What is the output of this C code?
#include <stdio.h>
    int mul(int a, int b, int c)
    {
        return a * b * c;
    }
    void main()
    {
        int (function_pointer)(int, int, int);
        function_pointer = mul;
        printf("The product of three numbers is:%d",
        function_pointer(2, 3, 4));
    }
Discuss
Answer: (b).Compile time error
Q162.
What is the output of this C code?
#include <stdio.h>
    void f(int (*x)(int));
    int myfoo(int);
    int (*fooptr)(int);
    int ((*foo(int)))(int);
    int main()
    {
        fooptr = foo(0);
        fooptr(10);
    }
    int ((*foo(int i)))(int)
    {
        return myfoo;
    }
    int myfoo(int i)
    {
        printf("%d\n", i + 1);
    }
Discuss
Answer: (b).11
Q163.
What is the output of this C code?
#include <stdio.h>
    int mul(int a, int b, int c)
    {
        return a * b * c;
    }
    void main()
    {
        int *function_pointer;
        function_pointer = mul;
        printf("The product of three numbers is:%d",
        function_pointer(2, 3, 4));
    }
Discuss
Answer: (b).Compile time error
Q164.
What is the output of this C code?
#include <stdio.h>
    int sub(int a, int b, int c)
    {
        return a - b - c;
    }
    void main()
    {
        int (*function_pointer)(int, int, int);
        function_pointer = &sub;
        printf("The difference of three numbers is:%d",
        (*function_pointer)(2, 3, 4));
    }
Discuss
Answer: (c).The difference of three numbers is:-5
Discuss
Answer: (d).To call a function defined at run-time
Q166.
What is the output of this C code?
#include <stdio.h>
    void f(int);
    void (*foo)() = f;
    int main(int argc, char *argv[])
    {
        foo(10);
        return 0;
    }
    void f(int i)
    {
        printf("%d\n", i);
    }
Discuss
Answer: (b).10
Q167.
What is the output of this C code?
#include <stdio.h>
    void f(int);
    void (*foo)(void) = f;
    int main(int argc, char *argv[])
    {
        foo(10);
        return 0;
    }
    void f(int i)
    {
        printf("%d\n", i);
    }
Discuss
Answer: (a).Compile time error
Q168.
What is the output of this C code?
#include <stdio.h>
    void f(int);
    void (*foo)(float) = f;
    int main()
    {
        foo(10);
    }
    void f(int i)
    {
        printf("%d\n", i);
    }
Discuss
Answer: (d).Undefined behaviour
Q169.
What is the output of this C code?
#include <stdio.h>
    void f(int (*x)(int));
    int myfoo(int i);
    int (*foo)(int) = myfoo;
    int main()
    {
        f(foo(10));
    }
    void f(int (*i)(int))
    {
        i(11);
    }
    int myfoo(int i)
    {
        printf("%d\n", i);
        return i;
    }
Discuss
Answer: (d).10 Segmentation fault
Q170.
What is the output of this C code?
#include <stdio.h>
    void f(int (*x)(int));
    int myfoo(int);
    int (*foo)() = myfoo;
    int main()
    {
        f(foo);
    }
    void f(int(*i)(int ))
    {
        i(11);
    }
    int myfoo(int i)
    {
        printf("%d\n", i);
        return i;
    }
Discuss
Answer: (b).11

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!