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 235easy
What will be the output of the following C code?
#include <stdio.h>
void fun(char *k)
{
printf("%s", k);
}
void main()
{
char s[] = "hello";
fun(s);
}Question 236easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0, j = 1;
int *a[] = {&i, &j};
printf("%d", *a[0]);
return 0;
}Question 237easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int *ptr, a = 10;
ptr = &a
*ptr += 1;
printf("%d,%d/n", *ptr, a);
}Advertisement
Question 238easy
What will be the output of the following C code?
#include <stdio.h>
int *f();
int main()
{
int *p = f();
printf("%d\n", *p);
}
int *f()
{
int *j = (int*)malloc(sizeof(int));
*j = 10;
return j;
}Question 239easy
Comment on the following two operations.
int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 1
int b[][] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 2Question 240easy
Which of the following is a correct syntax to pass a Function Pointer as an argument?
Advertisement
Question 241easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *s = "hello";
char *p = s;
printf("%c\t%c", *(p + 1), s[1]);
}Question 242easy
Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0;)?
Question 243easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
double *ptr = (double *)100;
ptr = ptr + 2;
printf("%u", ptr);
}