C Programming — Pointers
C language from basics to advanced placement prep
100 Questions 10 Topics Take Test
Advertisement
Showing 81–90 of 100 questions in Pointers
Q.81 Easy Pointers
What is the size of a pointer variable on a 32-bit system?
A 2 bytes
B 4 bytes
C 8 bytes
D Depends on the data type
Correct Answer:  B. 4 bytes
EXPLANATION

On a 32-bit system, all pointers are 4 bytes (32 bits) regardless of the data type they point to.

Take Test
Q.82 Easy Pointers
A pointer variable stores the _____ of another variable.
A value
B memory address
C data type
D size
Correct Answer:  B. memory address
EXPLANATION

Pointers store memory addresses of variables. The address-of operator (&) retrieves this address.

Take Test
Q.83 Hard Pointers
What is the output?
int x = 50;
int *p = &x;
int *q = p;
q = NULL;
printf("%d", *p);
A 50
B NULL
C Garbage value
D Segmentation fault
Correct Answer:  A. 50
EXPLANATION

Setting q to NULL doesn't affect p. p still points to x, so *p is 50.

Take Test
Q.84 Hard Pointers
Which statement is true about void pointers?
A Cannot be dereferenced without casting
B Can only point to void type
C Are always NULL
D Cannot be incremented
Correct Answer:  A. Cannot be dereferenced without casting
EXPLANATION

void pointers are generic pointers that must be cast to appropriate type before dereferencing.

Take Test
Q.85 Medium Pointers
What will be the output?
int arr[] = {10, 20, 30};
int *p = arr;
printf("%d %d", arr[1], *(p+1));
A 20 20
B 20 10
C 10 20
D 30 20
Correct Answer:  A. 20 20
EXPLANATION

arr[1] and *(p+1) both access the second element of the array, which is 20.

Take Test
Q.86 Hard Pointers
What does the following code do?
int *p = (int*)malloc(sizeof(int));
*p = 5;
free(p);
p = NULL;
A Allocates, assigns, deallocates and nullifies pointer
B Creates a memory leak
C Causes segmentation fault
D Compilation error
Correct Answer:  A. Allocates, assigns, deallocates and nullifies pointer
EXPLANATION

This is proper memory management: allocate, use, free, and nullify to prevent dangling pointer.

Take Test
Q.87 Medium Pointers
What is a dangling pointer?
A Pointer pointing to freed memory
B NULL pointer
C Uninitialized pointer
D Pointer declared outside main()
Correct Answer:  A. Pointer pointing to freed memory
EXPLANATION

A dangling pointer is a pointer that points to memory that has been freed or deallocated.

Take Test
Q.88 Medium Pointers
Which of the following correctly allocates memory for 10 integers?
A int *p = malloc(10);
B int *p = malloc(10 * sizeof(int));
C int *p = malloc(sizeof(int));
D int *p = alloc(10);
Correct Answer:  B. int *p = malloc(10 * sizeof(int));
EXPLANATION

malloc requires the size in bytes. For 10 integers, we need 10 * sizeof(int) bytes.

Take Test
Q.89 Medium Pointers
What is the output?
int *p = NULL;
if(p) printf("Not NULL");
else printf("NULL");
A Not NULL
B NULL
C Segmentation fault
D Compilation error
Correct Answer:  B. NULL
EXPLANATION

NULL pointer evaluates to false in a conditional, so the else block executes.

Take Test
Q.90 Medium Pointers
What is a wild pointer?
A Pointer pointing to NULL
B Uninitialized pointer with garbage address
C Pointer in a wildlife program
D Pointer declared inside a loop
Correct Answer:  B. Uninitialized pointer with garbage address
EXPLANATION

A wild pointer is an uninitialized pointer that contains an arbitrary/garbage memory address.

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