Pointer MCQs

253 questionsC-ProgramPage 8 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 64easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int *p = (int *)2;
    int *q = (int *)3;
    printf("%d", p + q);
}
Question 65easy
Which of the following statements are true?
P. Pointer to Array
Q. Multi-dimensional array
Question 66easy
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[0], s[1]);
}
Advertisement
Question 67easy
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 (argc--)
    printf("%s\n", argv[argc]);
    return 0;
}
Question 68easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int a[4] = {1, 2, 3, 4};
    int *p = &a[1];
    int *ptr = &a[2];
    ptr = ptr * 1;
    printf("%d\n", *ptr);
}
Question 69easy
What will be the output of the following C code?
#include <stdio.h>
void f(char *k)
{
    k++;
    k[2] = 'm';
}
void main()
{
    char s[] = "hello";
    f(s);
    printf("%c\n", *s);
}
Advertisement
Question 70easy
Which of the following is not possible statically in C?
Question 71easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 10;
    void *p = &i
    printf("%d\n", (int)*p);
    return 0;
}
Question 72easy
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]));
}