PRACTICE • LEARN • GROW
Module 7: Pointers - Final Quiz MCQs
Solve topic-wise placement questions and improve your skills.
Module 7: Pointers - Final Quiz Progress
0 of 11 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Which operator is used to obtain the virtual memory address of a variable in C?
A.
* (indirection)
B.
& (address-of)
C.
-> (arrow)
D.
% (modulus)
Explanation & Key
Correct Answer:
2
What is the output of the following pointer arithmetic?
#include <stdio.h>
int main() {
int arr[5] = {10, 20, 30, 40, 50};
int *p = arr;
p = p + 2;
printf("%d", *p);
return 0;
}
A.
12
B.
30
C.
20
D.
Undefined behavior
Explanation & Key
Correct Answer:
3
What is the output of the following code testing *p++ precedence?
#include <stdio.h>
int main() {
int a[] = {10, 20, 30};
int *p = a;
printf("%d ", *p++);
printf("%d", *p);
return 0;
}
A.
10 20
B.
11 11
C.
10 10
D.
11 20
Explanation & Key
Correct Answer:
4
What is the output of the following double-pointer manipulation?
#include <stdio.h>
int main() {
int x = 50;
int *p = &x;
int **pp = &p;
**pp = 99;
printf("%d", x);
return 0;
}
A.
50
B.
99
C.
Address of x
D.
Address of p
Explanation & Key
Correct Answer:
5
What is the key difference between
const int *p and int * const p?
A.
In
const int *p the pointer is constant; in int * const p the integer data is constant
B.
In
const int *p the integer data is read-only (*p cannot be modified); in int * const p the pointer itself is constant (p cannot be reassigned)
C.
Both are identical in standard C
D.
Neither allows reading values
Explanation & Key
Correct Answer:
6
What occurs at runtime if a program attempts to dereference a
NULL pointer?
A.
Evaluates to 0
B.
Segmentation Fault / OS hardware access violation
C.
Allocates 4 bytes of memory automatically
D.
Throws a compiler warning only
Explanation & Key
Correct Answer:
7
What is a
void* pointer and what is its primary restriction?
A.
A pointer that points to nothing and cannot hold addresses
B.
A generic pointer that can hold any data address but cannot be directly dereferenced or used in pointer arithmetic without explicit typecasting
C.
A pointer that automatically frees memory
D.
A pointer restricted to function addresses only
Explanation & Key
Correct Answer:
8
What is the output of subtracting two pointers pointing to the same array?
#include <stdio.h>
int main() {
int arr[5] = {10, 20, 30, 40, 50};
int *p1 = &arr[1];
int *p2 = &arr[4];
printf("%td", p2 - p1);
return 0;
}
A.
12 (bytes)
B.
3 (elements)
C.
4 (elements)
D.
Undefined behavior
Explanation & Key
Correct Answer:
9
What is the output of the parenthesized increment (*p)++?
#include <stdio.h>
int main() {
int arr[] = {10, 20};
int *p = arr;
(*p)++;
printf("%d %d", arr[0], *p);
return 0;
}
A.
11 11
B.
10 20
C.
11 20
D.
10 11
Explanation & Key
Correct Answer:
10
What is a "wild pointer" in C?
A.
A pointer initialized to NULL
B.
An uninitialized pointer containing an arbitrary, garbage memory address
C.
A pointer to a function
D.
A pointer pointing to dynamically allocated heap memory
Explanation & Key
Correct Answer:
11
What character is printed by the following array of string pointers?
#include <stdio.h>
int main() {
char *names[] = {"Codex", "Monarch", "ReadyToGo"};
printf("%c", *(*(names + 1) + 2));
return 0;
}
A.
n
B.
o
C.
d
D.
M
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong