Pointer MCQs
Practice free Pointer multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 253 questions — no login required.
Question 118easy
Which of the following declaration are illegal?
Question 119easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
printf("%d\n", *ary);
}Question 120easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c
int **sptr = &ptr1 //-Ref
*sptr = ptr2;
}Advertisement
Question 121easy
One of the uses for function pointers in C is . . . . . . . .
Question 122easy
Comment on the following pointer declaration.
int *ptr, p;Question 123easy
What will be the output of the following C code?
#include <stdio.h>
void f(int);
void (*foo)() = f;
int main(int argc, char *argv[])
{
foo(10);
return 0;
}
void f(int i)
{
printf("%d\n", i);
}Advertisement
Question 124easy
What will be the output of the following C code?
#include <stdio.h>
void foo(int*);
int main()
{
int i = 10, *p = &i
foo(p++);
}
void foo(int *p)
{
printf("%d\n", *p);
}Question 125easy
What will be the output of the following C code?
#include <stdio.h>
void (*(f)())(int, float);
typedef void (*(*x)())(int, float);
void foo(int i, float f);
int main()
{
x p = f;
p();
}
void (*(f)())(int, float)
{
return foo;
}
void foo(int i, float f)
{
printf("%d %f\n", i, f);
}Question 126easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
struct student
{
int no;
char name[20];
};
struct student s;
s.no = 8;
printf("%d", s.no);
}