C Pointer Basics MCQs: 12 Solved Questions on Declaration, Initialization and Dereferencing

Test the pointer rules that learners most often reverse. These 12 explained MCQs move from address binding to double pointers, byte access and object lifetime.

KnowledgeGate Team

Exam prep & CS education

Updated 31 Jul 20268 min read

Pointers store addresses, and yet & and * get reversed, a dereference lands on the wrong type, and arithmetic that C never defined slips through. Two habits catch most of it: name the type on both sides of every assignment, and never dereference a pointer whose target you cannot point to. Attempt all 12 before reading the answers, then use the map below to place whatever you missed. All 12 are previous-year paper questions, and each one links to its solved page in the pointer basics PYQ set.

1. Pointer basics: the address and value map behind every question

Source form

Meaning

Resulting type

Common trap

int *p = &x

Bind p to x

p is int *

Assigning x instead of &x

*p

Reach the object through p

int

Treating it as an address

int **pp = &p

Bind pp to pointer p

pp is int **

Forgetting one dereference level

int (*f)(int *)

Pointer to a function

f is int (*)(int *)

Reading it as int *f(int *)

struct node *s[10]

Array of 10 pointers

Elements are struct node *

Reading it as one pointer to an array

p + k

Move by k array elements

int *

Thinking it moves by k bytes

(char *)&a

Byte view of the object

char *

Expecting the whole value

Uninitialised or freed pointer

No valid target is established

Unsafe to dereference

Reading or writing through it

Take a concrete layout. score = 24 sits at 0x1000, p at 0x2000 holds 0x1000, and pp at 0x3000 holds 0x2000. Real addresses differ on every run, but the shape of the chain does not.

So p == 0x1000, *p == 24, pp == 0x2000, *pp == 0x1000, and **pp == 24. Writing **pp = 31 changes score itself to 31, because **pp names the int and not either pointer. Count the stars against the declaration: pp is declared int **, so it takes two dereferences to reach an int.

Memory map: score at 0x1000, pointer p at 0x2000, and double pointer pp at 0x3000 after **pp sets score to 31.

2. Declaration and initialisation: Questions 1-2

Question 1, DSSSB 2018

Consider the following declarations in C:

int C, *PTR;

Which of the following statements is TRUE?

  • A. PTR = C;

  • B. *PTR = &C;

  • C. PTR = &C;

  • D. C = &PTR;

Answer: C. The variable C is an int, while both PTR and &C are int *, so only PTR = &C puts matching types on the two sides. A assigns an integer to a pointer, B and D assign addresses to integer targets, and B also dereferences PTR before anything is bound to it.

Question 2, UGC NET 2019

Which of the following are legal statements in C programming language?

(a)    int *P=&44;
(b)    int *P=&r;
(c)    int P=&a;
(d)    int P=a;

Choose the correct option:

  • A. (a) and (b)

  • B. (b) and (c)

  • C. (b) and (d)

  • D. (a) and (d)

Answer: C, assuming r and a are int. Literal 44 has no address; &r supplies int *; int P = &a mixes types; int P = a copies the value.

3. Dereferencing in input and function calls: Questions 3-4

Question 3, GATE 2014

Consider the following program in C language:

#include <stdio.h>
main()
{
   int i;
   int *pi = &i;
   scanf("%d", pi);
   printf("%d\n", i+5);
}

Which one of the following statements is TRUE?

  • A. Compilation fails.

  • B. Execution results in a run-time error.

  • C. On execution, the value printed is 5 more than the address of variable i.

  • D. On execution, the value printed is 5 more than the integer value entered.

Answer: D. With input 10: pi = &i; scanf writes 10 to i; i + 5 = 10 + 5 = 15; output is 15. scanf receives an address, then printf reads i.

Question 4, GATE 2016

Consider the following C program.

void f(int, short);

void main()
{
    int i = 100;
    short s = 12;
    short *p = &s;
    ____________;  // call to f()
}

Which one of the following expressions, when placed in the blank above, will NOT result in a type checking error?

  • A. f(s,*s)

  • B. i = f(i,s)

  • C. f(i,*s)

  • D. f(i,*p)

Answer: D. Parameters are (int, short): *s in A and C is invalid because s is not a pointer, while B assigns a void result. D works because i is int and *p is short.

4. Double pointers and complex declarators: Questions 5-7

Question 5, ISRO 2015

Consider the following declaration:

int a, *b = &a, **c = &b;

The following program fragment:

a = 4;
**c = 5;
  • A. does not change the value of a

  • B. assigns address of c to a

  • C. assigns the value of b to a

  • D. assigns 5 to a

Answer: D. In c -> b -> a, c holds &b, *c is b, and **c is a. Starting at a = 4, **c = 5 ends at a = 5; no address enters a.

Question 6, ISRO 2017

What does the following C statement declare?

int (*f) (int *);
  • A. A function that takes an integer pointer as argument and returns an integer

  • B. A function that takes an integer as argument and returns an integer pointer

  • C. A pointer to a function that takes an integer pointer as argument and returns an integer

  • D. A function that takes an integer pointer as argument and returns a function pointer

Answer: C. Read outward: (*f) says pointer, (int *) gives the parameter, and leading int gives the return type. Without parentheses, int *f(int *) is a function returning int *.

Question 7, GATE 2000

The following C declarations:

struct node {
    int i;
    float j;
};

struct node *s[10];

define s to be:

  • A. An array, each element of which is a pointer to a structure of type node

  • B. A structure of 2 fields, each field being a pointer to an array of 10 elements

  • C. A structure of 3 fields: an integer, a float, and an array of 10 elements

  • D. An array, each element of which is a structure of type node.

Answer: A. s[10] is an array of 10 whose elements are struct node *. In struct node (*s)[10], s instead points to an array of 10 structures.

Question 8, UGC NET 2025

Only legal pointer operations:

(A) pointer + number  -> pointer
(B) pointer - number  -> number
(C) pointer + pointer -> pointer
(D) pointer - pointer -> pointer
(E) pointer - pointer -> number

Choose the most appropriate answer from the options given below:

  • A. A, B, C Only

  • B. A, B, D Only

  • C. A, B Only

  • D. A, E Only

Answer: D. Only (A) and (E) hold. Pointer plus integer gives a pointer, and subtracting two pointers into the same array gives a ptrdiff_t count of elements between them. (B) fails because pointer minus integer is still a pointer, (C) because two pointers cannot be added at all, and (D) because a pointer difference is a number rather than a pointer. Both operands must stay inside one array, or one element past its end.

Question 9, UGC NET 2023

What is the output of the following C program?

#include <stdio.h>
int main(void){
    static float a[] = {13.24, 1.5, 4.5, 5.4, 3.5};
    float *j;
    float *k;
    j = a;
    k = a + 4;
    j = j * 2;
    k = k / 2;
    printf("%f %f", *j, *k);
    return 0;
}
  • A. 13.25, 4.5

  • B. 1.5, 3.5

  • C. 13.24, 1.5, 4.5, 5.4, 3.5

  • D. Illegal use of pointer in main function

Answer: D. j = a points at a[0], and k = a + 4 at a[4]. C defines neither pointer multiplication nor division, so j * 2 and k / 2 are both invalid, so the program never compiles and nothing is printed.

6. Byte-level dereferencing and endianness: Question 10

Question 10, ISRO 2016

What will be the output of the following program? Assume it runs on a little-endian processor.

#include <stdio.h>

int main() {
    short a = 320;
    char *ptr;
    ptr = (char *) &a;
    printf("%d", *ptr);
    return 0;
}
  • A. 1

  • B. 320

  • C. 64

  • D. Compilation error

Answer: C. 320 is 0x0140. Little-endian storage puts the low byte 0x40 at the lower address and 0x01 next, so a char * aimed at &a reads 0x40 and printf shows 64. 0x40 is below 0x80, so the answer stays 64 whether char is signed or unsigned.

Little-endian layout of short a = 320 (0x0140): byte 0x40 sits at 0x1000, read through a char pointer as 64.

7. Lost, dangling and uninitialised pointers: Questions 11-12

Question 11, GATE 2000

The most appropriate matching for the following pairs is:

X: m = malloc(5); m = NULL;   -> 1: using dangling pointers
Y: free(n); n->value = 5;     -> 2: using uninitialized pointers
Z: char *p; *p = 'a';         -> 3: lost memory
  • A. X-1, Y-3, Z-2

  • B. X-2, Y-1, Z-3

  • C. X-3, Y-2, Z-1

  • D. X-3, Y-1, Z-2

Answer: D. X loses its allocation's address; Y uses n after free(n); Z dereferences uninitialised p. Keep ownership until free, set freed pointers to NULL when useful, and assign a target before dereferencing.

Question 12, GATE 2001

Consider the following three C functions:

[P1]
int *g(void){
    int x = 10;
    return &x;
}

[P2]
int *g(void){
    int *px;
    *px = 10;
    return px;
}

[P3]
int *g(void){
    int *px;
    px = (int *) malloc(sizeof(int));
    *px = 10;
    return px;
}

Which of the above three functions are likely to cause problems with pointers?

  • A. Only P3

  • B. Only P1 and P3

  • C. Only P1 and P2

  • D. P1, P2 and P3

Answer: C, assuming P3 allocates successfully. P1 returns local x after its lifetime; P2 writes through uninitialised px; P3 allocates before writing and transfers ownership. Production code checks malloc; the caller frees the block.

8. Score the set and choose the next practice step

Answer key: 1-C, 2-C, 3-D, 4-D, 5-D, 6-C, 7-A, 8-D, 9-D, 10-C, 11-D, 12-C.

Review misses by group: 1-4 address and value; 5-7 declarators; 8-9 arithmetic; 10 byte order; 11-12 lifetime.

Give it 20 minutes: re-solve every miss with the options hidden, write the type of each side, redraw the score/p/pp chain, and convert 320 = 0x0140 by hand. Drilling real paper questions rather than invented ones is why PYQs beat buying another question bank.

The short version

Bind with &, count dereferences against the declared type, keep arithmetic to pointer plus integer and pointer minus pointer, and never read through a pointer whose object has already ended. The C Language course walks these in order, and the shorter C Programming one-shot course is enough for a revision pass. After that, try Data Structures MCQs.