Top

Pointers

31.

What will be the output of the program ?

#include

int main()
{
    char *p;
    p="hello";
    printf("%s\n", *&*&p);
    return 0;
}

 

Answer: B

No answer description available for this question.
 

Enter details here

32.

In which header file is the NULL macro defined?

Answer: C

No answer description available for this question.

Enter details here

33.

What is the output of this C code?

void foo(float *);
int main()
{
int i = 10, *p = &i;
foo(&i);
}
void foo(float *p)
{
printf("%f\n", *p);
}

 

Answer: B

No answer description available for this question.
 

Enter details here

34.

What is the output of this C code?

void main()
{
int x = 0;
int *ptr = &x;
printf("%p\n", ptr);
ptr++;
printf("%p\n ", ptr);
}

 

Answer: A

No answer description available for this question.
 

Enter details here

35.

What will be the output of the following C code?

#include 
    int main()
    {
        int i = 97, *p = &i;
        foo(&i);
        printf("%d ", *p);
    }
    void foo(int *p)
    {
        int j = 2;
        p = &j;
        printf("%d ", *p);
    }

 

Answer: A

No answer description available for this question.

Enter details here

36.

What will be the output of the program ?

#include
power(int**);
int main()
{
    int a=5, *aa; /* Address of 'a' is 1000 */
    aa = &a;
    a = power(&aa);
    printf("%d\n", a);
    return 0;
}
power(int **ptr)
{
    int b;
    b = **ptr***ptr;
    return (b);
}

 

Answer: B

No answer description available for this question.
 

Enter details here

37.

What will be the output of the following C code?

#include 
    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);
    }

 

Answer: A

No answer description available for this question.

Enter details here

38.

Which is an indirection operator among the following?

Answer: B

No answer description available for this question.
 

Enter details here

39.

What will be the output of the program ?

#include

int main()
{
    char *str;
    str = "%d\n";
    str++;
    str++;
    printf(str-2, 300);
    return 0;
}

 

Answer: D

No answer description available for this question.
 

Enter details here

40.

What substitution should be made to //-Ref such that ptr1 points to variable C?

int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a;
int **sptr = &ptr1;
//-Ref
}

 

Answer: A

No answer description available for this question.
 

Enter details here

Loading…
Tags: Pointers Questions and Answers || Pointers MCQ Questions and Answers || Pointers GK Questions and Answers || Pointers GK MCQ Questions || Pointers Multiple Choice Questions and Answers || Pointers GK || GK on Pointers || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming