Questions on Pointers in C

By Anjnee Bhatnagar|Updated : July 18th, 2022

Questions on Pointers in C are provided here for candidates who are actively preparing for the GATE CSE exam 2023. Questions on Pointers in C can provide a quick overview of the types of questions to be expected in the exam on this topic.

Pointers will be better understood by using objective-based MCQ questions and answers. Five specially picked questions are mentioned here ranging from basic to high-level questions on pointers in C for the GATE exam pattern. Attempt and get the detailed solution to questions on Pointers in C mentioned in this article. 

Table of Content

Question 1 on Pointers in C 

Can you combine the following two statements into one?

char *p;

p= (char*) malloc (100);

  1. char p = *malloc(100);
  2. char *p = (char) malloc(100);
  3. char *p = (char*)malloc(100);
  4. char *p = (char *)(malloc*)(100);

Answer: C. char *p = (char*)malloc(100);


Yes, the given two statements can be combined as follows: char *p = (char*)malloc(100);. It is following the syntax to allocate memory to a character pointer variable p.

Question 2 on Pointers in C 

A pointer is?

  1. A keyword used to create variables
  2. A variable that stores the address of an instruction
  3. A variable that stores the address of another variable
  4. All of the above

Answer: C. A variable that stores the address of another variable


A pointer variable is defined as a variable that is used to store the address of another variable. A pointer variable is denoted by the * operator also called as dereference operator.

Question 3 on Pointers in C 

The operator used to get the value at the address stored in a pointer variable is?

  1. *
  2. &
  3. &&
  4. ||

Answer: A. *


To obtain the value stored at the address in a pointer variable the * operator is used. “&” is denoted as the address operator in C. While “&&” and “||” are logical AND and logical OR operators in C.

Question 4 on Pointers in C 

Consider the following code:

int a[10], *x, *y;

x = &a[5];

y = &a[7];

Which of the following statement is incorrect concerning pointers?

  1. y – x
  2. y – 3
  3. x + y
  4. x + 1

Answer: C. x+y


Here, we check the options one by one.

Option A:
y here denotes the address of the 8th element of the array whereas x denotes the address of the 6th element of the array. So, the y - x operation can be easily calculated and it will produce the output 2.

Option B:
We can subtract 3 from the pointer y as then it would point to the 5th element of the array.

Option C:
We can’t perform the addition of x and y pointer, as adding these two pointers points to some garbage value.

Option D:
We can add 1 to the pointer x as then it would point to the 7th element of the array.

Hence, option C is the correct answer.

Question 5 on Pointers in C 

Which of the following represents the below terminology?
“ x is a pointer to array which is containing 5 integer pointers.”

  1. int *x [5]
  2. int (*x) [5]
  3. int *(*x) [5]
  4. int x [5]

Answer: C. int *(*x) [5]


The correct representation of x is a pointer to an array which is containing 5 integer pointers: int *(*x) [5].

☛ Related Questions:


write a comment

Follow us for latest updates