1.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char *str = "hello, world\n";
    str[5] = '.';
    printf("%s\n", str);
    return 0;
}

3.
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int a[2][3] = {1, 2, 3, , 4, 5};
    int i = 0, j = 0;
    for (i = 0; i < 2; i++)
    for (j = 0; j < 3; j++)
    printf("%d", a[i][j]);
}

4.
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;
}

6.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 11;
    int *p = &i;
    foo(&p);
    printf("%d ", *p);
}
void foo(int *const *p)
{
    int j = 10;
    *p = &j;
    printf("%d ", **p);
}

7.
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);
}

9.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char *str = "hello, world\n";
    char *strc = "good morning\n";
    strcpy(strc, str);
    printf("%s\n", strc);
    return 0;
}

Read More Section(Pointer)

Each Section contains maximum 100 MCQs question on Pointer. To get more questions visit other sections.