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

Explore more Topics under C Programming

Q71.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char *str = "hello world";
        char strary[] = "hello world";
        printf("%d %d\n", sizeof(str), sizeof(strary));
        return 0;
    }
Discuss
Answer: (c).4 12
Q72.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char *str = "hello world";
        char strary[] = "hello world";
        printf("%d %d\n", strlen(str), strlen(strary));
        return 0;
    }
Discuss
Answer: (a).11 11
Q73.
What is the output of this C code?
#include <stdio.h>
    void f(char *k)
    {
        k++;
        k[2] = 'm';
        printf("%c\n", *k);
    }
    void main()
    {
        char s[] = "hello";
        f(s);
    }

a.

l

b.

e

c.

h

d.

o

Discuss
Answer: (b).e
Q74.
What is the output of this C code?
#include <stdio.h>
    void fun(char *k)
    {
        printf("%s", k);
    }
    void main()
    {
        char s[] = "hello";
        fun(s);
    }
Discuss
Answer: (a).hello
Q75.
Comment on the output of this C code?
#include <stdio.h>
    int main()
    {
        char *str = "This" //Line 1
        char *ptr = "Program\n"; //Line 2
        str = ptr; //Line 3
        printf("%s, %s\n", str, ptr); //Line 4
    }
Discuss
Answer: (b).Memory holding β€œthis” loses its reference at line 3
Q76.
What type initialization is needed for the segment β€œptr[3] = β€˜3’;” to work?
Discuss
Answer: (b).char ptr[] = β€œHello!”;
Q77.
The syntax for constant pointer to address (i.e., fixed pointer address) is:
Discuss
Answer: (b).<type> * const <name>
Q78.
Comment on the output of this C code?
#include <stdio.h>
    int add(int a, int b)
    {
        return a + b;
    }
    int main()
    {
        int (*fn_ptr)(int, int);
        fn_ptr = add;
        printf("The sum of two numbers is: %d", (int)fn_ptr(2, 3));
    }
Discuss
Answer: (d).No Run time error, output is 5
Q79.
The correct way to declare and assign a function pointer is done by:

(Assuming the function to be assigned is β€œint multi(int, int);”)
Discuss
Answer: (a).int (*fn_ptr)(int, int) = multi;
Q80.
Calling a function f with a an array variable a[3] where a is an array, is equivalent to
Discuss
Answer: (d).all of the mentioned

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!