Top

Pointers

71.

Is this a correct way for NULL pointer assignment?

int i=0;
char *q=(char*)i;

 

Answer: B

No answer description available for this question.
 

Enter details here

72.

What is the output of this C code?

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

 

Answer: A

No answer description available for this question.
 

Enter details here

73.

What will be the output of the program ?

#include

int main()
{
    printf("%c\n", 7["IndiaBIX"]);
    return 0;
}

 

Answer: C

No answer description available for this question.
 

Enter details here

74.

If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?

Answer: D

No answer description available for this question.

Enter details here

75.

What will be the output of the program ?

#include

void fun(void *p);
int i;

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

 

Answer:

Enter details here

76.

What is the output of this C code?

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

 

Answer: A

No answer description available for this question.
 

Enter details here

Answer: C

No answer description available for this question.

Enter details here

78.

What will be the output of the program ?

#include

int main()
{
    char str1[] = "India";
    char str2[] = "BIX";
    char *s1 = str1, *s2=str2;
    while(*s1++ = *s2++)
        printf("%s", str1);

    printf("\n");
    return 0;
}

 

Answer: B

No answer description available for this question.
 

Enter details here

Answer: B

No answer description available for this question.
 

Enter details here

80.

What is the output of this C code?

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

 

Answer: B

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