loader image

Pointers in C – MCQ

Here are the most important Multiple choice questions on Pointers in C programming.

  1. If p is a pointer to an integer and c is a pointer to a character then sizeof(p) will be
    1. same as that of sizeof(c)
    2. greater than that of sizeof(c)
    3. less than that of sizeof(c)
    4. None of the above

Answer: A


  1. Prior to using a pointer variable,
    1. it should be declared
    2. it should be initialized
    3. it should be both declared and initialized
    4. None of the above

Answer: C

Using a pointer variable, without initializing it, will be disastrous, as it will have a garbage value.


  1. Pointers are of ___________ data type
    1. integer
    2. character
    3. unsigned integer
    4. None of the above

Answer: D

Pointers are actually addresses. Though the address will be an integer, it is not of integer data type.


  1. Which of the following operators can be applied to the pointer variable(s}?
    1. Division
    2. Multiplication
    3. Increment
    4. None of the above

Answer: C


  1. A pointer variable can be
    1. passed to a function as an argument
    2. changed within a function
    3. returned by a function
    4. All of the above

Answer: D


  1. The declaration int (*p)[5] means
    1. p is a one-dimensional array of size 5, of pointers to integers
    2. p is a pointer to a 5 element integer array
    3. the same as int *p[5] ;
    4. None of the above

Answer: B


  1. What will be the output of the following code.
    1. prints 9
    2. prints garbage value
    3. prints 3 * address of b
    4. results in an error
#include <stdio.h>
int main() {
    int a=3, *b = &a;
    printf("%d",a*b);
}

Answer: D

Since ‘a’ is an integer and ‘b’ is a pointer, they can’t be multiplied.


Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments