Pointer in C MCQs Exercise I

Ques 1 Pointer


What will be output of following C code ?
#include<stdio.h>
int main( )
{
    int arr[]={10,20};
    int *p=arr;
    ++*p;
    printf("%d %d %d",arr[0],arr[1],*p);
    return 0;
}

A 11 20 11
B 78 33 12
C 13 45 12
D 23 66 11

Ques 2 Pointer


What will be output of following C code ?
#include<stdio.h>
int main( )
{
    int arr[]={10,20};
    int *p=arr;
    *p++;
    printf("%d %d %d",arr[0],arr[1],*p);
    return 0;
}

A 11 20 11
B 11 20 20
C 12 45 12
D 23 66 11

Ques 3 Pointer


What will be output of following C code ?
#include<stdio.h>
int main( )
{
    int k=20;
    void *p==&k;
    printf("%d",*p);
    return 0;
}

A 20
B Address of k
C Compiler Error
D None of these

Ques 4 Pointer


What will be output of following C code ?

void f(int *p,int *q)
{
    p=q;
    *p=2;
}
int i=0,j=0;
int main( )
{
    f(&i,&j);
    printf("%d %d\n",i,j);
    return 0;
}

A 2 2
B 2 1
C 0 1
D 0 2