Pointer MCQs

253 questionsC-ProgramPage 23 of 29

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 199easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    void *p;
    int a[4] = {1, 2, 3, 8};
    p = &a[3];
    int *ptr = &a[2];
    int n = p - ptr;
    printf("%d\n", n);
}
Question 200easy
Arguments that take input by user before running a program are called?
Question 201easy
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;
    no = 8;
    printf("%d", no);
}
Advertisement
Question 202easy
Which is an indirection operator among the following?
Question 203easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    char *a[10] = {"hi", "hello", "how"};
    int i = 0;
    for (i = 0;i < 10; i++)
    printf("%s", a[i]);
}
Question 204easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    char *s= "hello";
    char *p = s + 2;
    printf("%c\t%c", *p, s[1]);
}
Advertisement
Question 205easy
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, **p);
}
Question 206easy
What will be the output of the following C code?
#include <stdio.h>
void foo(int (*ary)[3]);
int main()
{
    int ary[2][3];
    foo(ary);
}
void foo(int (*ary)[3])
{
    int i = 10, j = 2, k;
    ary[0] = &i
    ary[1] = &j
    for (k = 0;k < 2; k++)
    printf("%d\n", *ary[k]);
}
Question 207easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char *a[1] = {"hello"};
    printf("%s", a[0]);
    return 0;
}