Pointer MCQs

253 questionsC-ProgramPage 28 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 244easy
What type of initialization is needed for the segment "ptr[3] = '3';" to work?
Question 245easy
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 246easy
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("%s", s.name);
}
Advertisement
Question 247easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int ary[4] = {1, 2, 3, 4};
    int *p = ary + 3;
    printf("%d %d\n", p[-2], ary[*p]);
}
Question 248easy
What will be the output of the following C code?
#include <stdio.h>
void m(int p, int q)
{
    printf("%d %d\n", p, q);
}
void main()
{
    int a = 6, b = 5;
    m(a);
}
Question 249easy
What will be the output of the following C code?
#include <stdio.h>
void f(int (*x)(int));
int myfoo(int);
int (*fooptr)(int);
int ((*foo(int)))(int);
int main()
{
    fooptr = foo(0);
    fooptr(10);
}
int ((*foo(int i)))(int)
{
    return myfoo;
}
int myfoo(int i)
{
    printf("%d\n", i + 1);
}
Advertisement
Question 250easy
Calling a function f with a an array variable a[3] where a is an array, is equivalent to . . . . . . . .
Question 251easy
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[])
{
    printf("%s\n", argv[argc]);
    return 0;
}
Question 252easy
What will be the output of the following C code?
#include <stdio.h>
void f(int);
void (*foo)(void) = f;
int main(int argc, char *argv[])
{
    foo(10);
    return 0;
}
void f(int i)
{
    printf("%d\n", i);
}