Practice high-yield Programming & Software Development MCQs on Pointer — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'free' function in C when used with pointers?
Correct Answer: Option B — Deallocate memory
Detailed Academic Explanation:
The 'free' function in C is used to deallocate memory that was previously allocated using functions like malloc , calloc , or realloc . When memory is allocated dynamically , it resides in the heap, and it is the programmer's responsibility to release that memory when it is no longer needed. Using 'free' helps prevent memory leaks by returning the allocated memory back to the system. Option A is incorrect because allocating memory is done using malloc , calloc , or realloc . Option C is incorrect because 'free' does not create new pointers. Option D is incorrect because 'free' does not modify the value of the pointer; it only releases the memory the pointer points to. Therefore, the correct answer is Option B: Deallocate memory .
In the given C program code snippet: void main() { char far *farther, *farthest; printf("%d..%d", sizeof(farther), sizeof(farthest)); } The sizeof operator is used to determine the size, in bytes, of a variable or data type. 1. ** farther ** and ** farthest ** are both pointers of type **char***. In C, the size of a pointer is typically **4 bytes** on a 32-bit system or **8 bytes** on a 64-bit system. Assuming a standard 32-bit architecture, the size of both pointers would be **4 bytes**. 2. Therefore, the output of the printf function will be: - sizeof(farther) = 4 - sizeof(farthest) = 4 The printf statement prints these two sizes, resulting in the output **"4..4"**. Hence, the correct answer is **Option C: 4..4**.
In first sizeof, str1 is a character pointer so it gives you the size of the pointer variable. In second sizeof the name str2 indicates the name of the array whose size is 5 (including the 'null' termination character). The third sizeof is similar to the second one.
💡Key Conceptual Anchor:Pointer
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the best answer. Prior to using a pointer variable
Correct Answer: Option C — It should be both declared and initialized.
Detailed Academic Explanation:
Using a pointer variable, without initializing it, will be disastrous, as it will have a garbage value.
💡Key Conceptual Anchor:Pointer
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Comment on the following pointer declaration? int * ptr, p;
Correct Answer: Option A — ptr is a pointer to integer, p is not.
Detailed Academic Explanation:
int *ptr, p; ptr is declared as a pointer to an integer because of the `*` symbol next to it. This means that `ptr` can hold the address of an integer variable. p is declared as a regular integer variable, not a pointer. The absence of the `*` symbol means that `p` will hold an integer value directly, not an address. Key Points: - ptr : Pointer to integer, can store addresses of integer variables. - p : Regular integer variable, cannot store addresses.
💡Key Conceptual Anchor:Pointer
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output? main() { char *p; p = "Hello"; printf("%cn",*&*p); }
Correct Answer: Option B — H
Detailed Academic Explanation:
* is a dereference operator & is a reference operator. They can be applied any number of times provided it is meaningful. Here p points to the first character in the string " Hello ". * p dereferences it and so its value is H . Again & references it to an address and * dereferences it to the value H .
char * p = NULL is same as char * q = 0. In both declarations p and q are initialized to null.
💡Key Conceptual Anchor:Pointer
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following program? #include<stdio.h> void main() { int i = 10; void *p = &i; printf("%d\n", (int)*p); }
Correct Answer: Option A — Compiler time error
Detailed Academic Explanation:
p is pointer of type void.
💡Key Conceptual Anchor:Pointer
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Comment on the following? const int * ptr;
Correct Answer: Option A — We cannot change the value pointed by ptr.
Detailed Academic Explanation:
int * : pointer to int int const * : pointer to const int int * const : const pointer to int int const * const : const pointer to const int Now the first const can be on either side of the type so: const int * == int const * const int * const == int const * const So the above declaration is pointer to const int. Which means, we cannot change the value pointed by ptr .
Address of variable a is assigned to the integer pointer ptr . Due to the statement; *ptr += 1; value at address pointing by ptr incremented by 1. As the value at address is changed so variable a also get the updated value.
💡Key Conceptual Anchor:Pointer
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A function 'p' that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as
Correct Answer: Option A — int(*p(char *))[]
Detailed Academic Explanation:
OPTION 'A' AS CORRECT... THERE ARE SEVERAL DIFFERENT USES OF POINTERS IN C...THEY ARE (1) int *p ; // p is a pointer to an integer quantity (2) int *p[10] ; // p is a 10-element array of pointers to integer quantities (3) int (*p)[10] ; // p is a pointer to a 10-element integer array (4) int *p(void); // p is a function that returns a pointer to an integer quantity (5) int p(char *a); // p is a function that accepts an argument which is a pointer to a character returns an integer quantity (6) int *p(char *a); // p is a function that accepts an argument which is a pointer to a character returns a pointer to an integer quantity. (7) int (*p)(char *a); // p is pointer to a function that accepts an argument which is a pointer to a character returns an integer quantity. (8) int (*p(char *a))[10]; // p is a function that accepts an argument which is a pointer to a character returns a pointer to a 10-element integer array. (9) int p(char (*a)[]); // p is a function that accepts an argument which is a pointer to a character array returns an integer quantity. (10) int p(char *a[]); // p is a function that accepts an argument which is a array of pointers to characters returns an integer quantity (11) int *p(char a[]); // p is a function that accepts an argument which is a character array returns a pointer to an integer quantity (12) int *p(char (*a)[]); // p is a function that accepts an argument which is a pointer to a character array returns a pointer to an integer quantity (13) int *p(char *a[]); // p is a function that accepts an argument which is an array of pointers to characters // returns a pointer to an integer quantity (14) int (*p)(char (*a)[]); // p is pointer to a function that accepts an argument which is a pointer to a character array returns an integer quantity (15) int *(*p)(char (*a)[]); // p is pointer to a function that accepts an argument which is a pointer to a character array returns a pointer to an integer quantity (16) int *(*p)(char *a[]); // p is pointer to a function that accepts an argument which is a array of pointers to characters returns a pointer to an integer quantity (17) int (*p[10])(void); // p is 10-element array of pointers to functions; each function returns an integer quantity (18) int (*p[10])(char a); // p is 10-element array of pointers to functions; each function accepts an argument which is a character and returns an integer quantity (19) int *(*p[10])(char a); // p is 10-element array of pointers to functions; each function accepts an argument which is a character and returns a pointer to an integer quantity (20) int *(*p[10])(char *a); // p is 10-element array of pointers to functions; each function accepts an argument which is a pointer to a character and returns a pointer to an integer
💡Key Conceptual Anchor:Pointer
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be printed after compiling and running the following code? main() { char *p; printf("%d %d",sizeof(*p), sizeof(p)); }
Correct Answer: Option B — 1 2
Detailed Academic Explanation:
The sizeof () operator gives the number of bytes taken by its operand. p is a character pointer, which needs one byte for storing its value (a character). Hence sizeof (* p ) gives a value of 1. Since it needs two bytes to store the address of the character pointer sizeof ( p ) gives 2.
💡Key Conceptual Anchor:Pointer
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Find the output of the following program. void main() { int array[10]; int *i = &array[2], *j = &array[5]; int diff = j-i; printf("%d", diff); }
Correct Answer: Option A — 3
Detailed Academic Explanation:
When subtracting pointers you get the number of elements between those addresses, not the number of bytes.
💡Key Conceptual Anchor:Pointer
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Find the output of the following program. void main() { printf("%d, %d", sizeof(int *), sizeof(int **)); }
Correct Answer: Option C — 2, 2
Detailed Academic Explanation:
Every pointer regardless of its type whereas single pointer or pointer to pointer, needs only 2 bytes. Size of pointer and int is 2 bytes in Turbo C compiler on windows 32 bit machine . So size of pointer is compiler specific. But generally most of the compilers are implemented to support 4 byte pointer variable in 32 bit and 8 byte pointer variable in 64 bit machine.
💡Key Conceptual Anchor:Pointer
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Find the output of the following program. void main() { int i=10; /* assume address of i is 0x1234ABCD */ int *ip=&i; int **ipp=&&i; printf("%x,%x,%x", &i, ip, *ipp); }
Correct Answer: Option D — Syntax error
Detailed Academic Explanation:
&& is logical AND operator and this operator requires two operands.
💡Key Conceptual Anchor:Pointer
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following statements are true after execution of the program. void main() { int a[10], i, *p; a[0] = 1; a[1] = 2; p = a; (*p)++; }
Correct Answer: Option B — a[0] = 2
Detailed Academic Explanation:
After the execution of the program, the value of the first element of the array 'a' will be modified. Let's break down the code step by step: a[0] = 1; : Sets the first element of the array 'a' to 1. a[1] = 2; : Sets the second element of the array 'a' to 2. p = a; : Assigns the address of the first element of the array 'a' to the pointer 'p'. (*p)++; : Increments the value at the memory location pointed to by 'p'. Since 'p' points to the first element of 'a', it increments the value of 'a[0]' . After the execution of the program, the value of a[0] will be 2. Therefore, the correct statement is Option B: a[0] = 2 .
💡Key Conceptual Anchor:Pointer
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is a pointer primarily used for?
Correct Answer: Option C — Variable declaration
Detailed Academic Explanation:
Variable declaration is the correct answer to “In C, what is a pointer primarily used for”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression sizeof(int*) in C, assuming an int pointer on a typical system?
Correct Answer: Option A — 4
Detailed Academic Explanation:
4 is the correct answer to “What is the result of the expression sizeof(int*) in C, assuming an int pointer on a typical system”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, how do you declare a pointer variable that can store the address of an integer?
Correct Answer: Option A — int *ptr
Detailed Academic Explanation:
int *ptr is the correct answer to “In C, how do you declare a pointer variable that can store the address of an integer”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the '->' operator in C when used with pointers?
Correct Answer: Option C — Member access operator
Detailed Academic Explanation:
Member access operator is the correct answer to “What is the purpose of the '->' operator in C when used with pointers”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is the value of a pointer variable if it hasn't been assigned any address?
Correct Answer: Option C — Undefined
Detailed Academic Explanation:
Undefined is the correct answer to “In C, what is the value of a pointer variable if it hasn't been assigned any address”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression *ptr in C, where ptr is a pointer to an int?
Correct Answer: Option B — Value pointed to by ptr
Detailed Academic Explanation:
Value pointed to by ptr is the correct answer to “What is the result of the expression *ptr in C, where ptr is a pointer to an int”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is the purpose of the 'void' pointer type (void*)?
Correct Answer: Option A — To store any data type's address
Detailed Academic Explanation:
To store any data type's address is the correct answer to “In C, what is the purpose of the 'void' pointer type (void*)”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How do you declare a pointer to a function that takes two integers and returns an integer in C?
Correct Answer: Option A — int (*ptr)(int, int)
Detailed Academic Explanation:
int (*ptr)(int, int) is the correct answer to “How do you declare a pointer to a function that takes two integers and returns an integer in C”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression ptr++ in C, where ptr is a pointer?
Correct Answer: Option C — Move ptr to the next memory location
Detailed Academic Explanation:
Move ptr to the next memory location is the correct answer to “What is the result of the expression ptr++ in C, where ptr is a pointer”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is the purpose of the 'const' keyword when used with a pointer declaration?
Correct Answer: Option B — To make the pointer point to a constant value
Detailed Academic Explanation:
To make the pointer point to a constant value is the correct answer to “In C, what is the purpose of the 'const' keyword when used with a pointer declaration”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression &variable in C, where variable is a variable of type int?
Correct Answer: Option A — Address of variable
Detailed Academic Explanation:
Address of variable is the correct answer to “What is the result of the expression &variable in C, where variable is a variable of type int”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is a double pointer (int**)?
Correct Answer: Option C — A pointer to a pointer
Detailed Academic Explanation:
A pointer to a pointer is the correct answer to “In C, what is a double pointer (int**)”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression ptr = NULL in C, where ptr is a pointer?
Correct Answer: Option A — Initialize ptr to 0
Detailed Academic Explanation:
Initialize ptr to 0 is the correct answer to “What is the result of the expression ptr = NULL in C, where ptr is a pointer”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is the purpose of the 'malloc' function?
Correct Answer: Option B — Allocate memory on the heap
Detailed Academic Explanation:
Allocate memory on the heap is the correct answer to “In C, what is the purpose of the 'malloc' function”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression *NULL in C?
Correct Answer: Option A — Error
Detailed Academic Explanation:
Error is the correct answer to “What is the result of the expression *NULL in C”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is the purpose of the 'memcpy' function?
Correct Answer: Option B — Copy the contents of one memory location to another
Detailed Academic Explanation:
Copy the contents of one memory location to another is the correct answer to “In C, what is the purpose of the 'memcpy' function”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression sizeof(char*) in C, assuming a char pointer on a typical system?
Correct Answer: Option A — 4
Detailed Academic Explanation:
4 is the correct answer to “What is the result of the expression sizeof(char*) in C, assuming a char pointer on a typical system”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, how do you declare an array of pointers to integers?
Correct Answer: Option A — int* arr[]
Detailed Academic Explanation:
int* arr[] is the correct answer to “In C, how do you declare an array of pointers to integers”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is a pointer to a constant value (const int*)?
Correct Answer: Option D — A pointer to a constant value
Detailed Academic Explanation:
A pointer to a constant value is the correct answer to “In C, what is a pointer to a constant value (const int*)”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is a function pointer?
Correct Answer: Option A — A pointer that points to a function
Detailed Academic Explanation:
A pointer that points to a function is the correct answer to “In C, what is a function pointer”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression &array[0] in C, where array is an integer array?
Correct Answer: Option A — Address of the first element in the array
Detailed Academic Explanation:
Address of the first element in the array is the correct answer to “What is the result of the expression &array[0] in C, where array is an integer array”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is a null pointer (NULL or 0)?
Correct Answer: Option A — A pointer that points to the address 0
Detailed Academic Explanation:
A pointer that points to the address 0 is the correct answer to “In C, what is a null pointer (NULL or 0)”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression ptr += 2 in C, where ptr is a pointer?
Correct Answer: Option C — Move ptr two memory locations forward
Detailed Academic Explanation:
Move ptr two memory locations forward is the correct answer to “What is the result of the expression ptr += 2 in C, where ptr is a pointer”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is the purpose of the 'calloc' function?
Correct Answer: Option D — Allocate memory for an array of variables
Detailed Academic Explanation:
Allocate memory for an array of variables is the correct answer to “In C, what is the purpose of the 'calloc' function”. This question is standard in competitive examination syllabi for Pointer.
💡Key Conceptual Anchor:Pointer
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.