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 127easy
What are the elements present in the array of the following C code?
int array[5] = {5};Question 128easy
What will be the output of the following C code?
#include <stdio.h>
struct student
{
int no;
char name[20];
};
void main()
{
student s;
s.no = 8;
printf("hello");
}Question 129easy
What will be the output of the following C code?
#include <stdio.h>
void foo(float *);
int main()
{
int i = 10, *p = &i
foo(&i);
}
void foo(float *p)
{
printf("%f\n", *p);
}Advertisement
Question 130easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"};
int i = 0, j = 0;
a[0] = "hey";
for (i = 0;i < 10; i++)
printf("%s\n", a[i]);
}Question 131easy
What is the correct syntax to send a 3-dimensional array as a parameter? (Assuming declaration int a[5][4][3];)
Question 132easy
What will be the output of the following C code?
#include <stdio.h>
void f(int a[][])
{
a[0][1] = 3;
int i = 0, j = 0;
for (i = 0;i < 2; i++)
for (j = 0;j < 3; j++)
printf("%d", a[i][j]);
}
void main()
{
int a[2][3] = {0};
f(a);
}Advertisement
Question 133easy
Which of following logical operation can be applied to pointers?(Assuming initialization int *a = 2; int *b = 3;)
Question 134easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 5;
int *p = &k
int **m = &p
printf("%d%d%d\n", k, *p, **m);
}Question 135easy
What are the different ways to initialize an array with all elements as zero?