C Programming — Pointers
C language from basics to advanced placement prep
100 Questions 10 Topics Take Test
Advertisement
Showing 91–100 of 100 questions in Pointers
Q.91 Medium Pointers
What will be printed?
int arr[] = {1, 2, 3};
int *p = arr;
printf("%d", *(p+2));
A 1
B 2
C 3
D Garbage value
Correct Answer:  C. 3
EXPLANATION

p+2 points to the third element of the array. *(p+2) dereferences it to get 3.

Take Test
Q.92 Hard Pointers
What is the difference between *p++ and (*p)++?
A No difference
B *p++ increments pointer, (*p)++ increments value
C (*p)++ increments pointer, *p++ increments value
D Syntax error
Correct Answer:  B. *p++ increments pointer, (*p)++ increments value
EXPLANATION

Due to operator precedence, *p++ is equivalent to *(p++), incrementing the pointer. (*p)++ explicitly increments the value.

Take Test
Q.93 Easy Pointers
Identify the output:
char *str = "Hello";
printf("%c", *str);
A H
B Hello
C e
D Address
Correct Answer:  A. H
EXPLANATION

*str dereferences the pointer to get the first character of the string, which is 'H'.

Take Test
Q.94 Medium Pointers
What is the output?
int x = 10, y = 20;
int *p = &x;
int *q = &y;
p = q;
printf("%d", *p);
A 10
B 20
C Address of y
D Garbage value
Correct Answer:  B. 20
EXPLANATION

After p = q, pointer p now points to y. So *p gives the value of y, which is 20.

Take Test
Q.95 Easy Pointers
Which of the following is NOT a valid pointer declaration?
A int *p;
B float *q;
C void *r;
D int &s;
Correct Answer:  D. int &s;
EXPLANATION

& is a reference operator used in C++, not in C. In C, pointers are declared using *.

Take Test
Advertisement
Q.96 Medium Pointers
What happens when you increment a pointer?
int arr[5] = {1,2,3,4,5};
int *p = arr;
p++;
A p points to the next byte in memory
B p points to the next element of the array
C p's value increases by 1
D Compilation error
Correct Answer:  B. p points to the next element of the array
EXPLANATION

When a pointer is incremented, it moves to the next element based on the data type size (pointer arithmetic).

Take Test
Q.97 Medium Pointers
What is the output?
int a = 5;
int *p = &a;
int **q = &p;
printf("%d", **q);
A 5
B Address of a
C Address of p
D Compilation error
Correct Answer:  A. 5
EXPLANATION

q is a pointer to pointer p. **q dereferences q to get p, then dereferences p to get the value 5.

Take Test
Q.98 Easy Pointers
What is a NULL pointer?
A Pointer pointing to address 0
B Uninitialized pointer
C Pointer with no name
D Invalid pointer
Correct Answer:  A. Pointer pointing to address 0
EXPLANATION

A NULL pointer is a pointer that points to memory address 0, indicating it doesn't point to any valid memory location.

Take Test
Q.99 Easy Pointers
What will be the size of a pointer variable on a 64-bit system?
A 2 bytes
B 4 bytes
C 8 bytes
D 16 bytes
Correct Answer:  C. 8 bytes
EXPLANATION

On a 64-bit system, a pointer is 8 bytes (64 bits) regardless of the data type it points to.

Take Test
Q.100 Easy Pointers
Which operator is used to get the address of a variable in C?
A *
B &
C ->
D .
Correct Answer:  B. &
EXPLANATION

The & operator (address-of operator) returns the memory address of a variable.

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips