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 154easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *s = "hello";
char *n = "cjn";
char *p = s + n;
printf("%c\t%c", *p, s[1]);
}Question 155easy
What will be the output of the following C code?
#include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c;
}
void main()
{
int (*function_pointer)(int, int, int);
function_pointer = mul;
printf("The product of three numbers is:%d",
function_pointer(2, 3, 4));
}Question 156easy
Comment on the output of the following C code.
#include <stdio.h>
int main()
{
char *str = "This" //Line 1
char *ptr = "Program\n"; //Line 2
str = ptr; //Line 3
printf("%s, %s\n", str, ptr); //Line 4
}Advertisement
Question 157easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *a = {"p", "r", "o", "g", "r", "a", "m"};
printf("%s", a);
}Question 158easy
What will be the output of the following C code (run without any command line arguments)?
#include <stdio.h>
int main(int argc, char *argv[])
{
while (argv != NULL)
printf("%s\n", *(argv++));
return 0;
}Question 159easy
Read the following expression?
void (*ptr)(int);Advertisement
Question 160easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p
printf("%p %p", *r, a);
}Question 161easy
What will be the output of the following C code (if run with no options or arguments)?
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("%d\n", argc);
return 0;
}Question 162easy
Comment on the following C statement.
const int *ptr;