Top

Pointers

81.

What is the output of this C code?
 

void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf("%d%d%d\n", k, *p, **p);
}

 

Answer: D

No answer description available for this question.
 

Enter details here

82.

What will be the output of the program ?

#include

int main()
{
    char str[20] = "Hello";
    char *const p=str;
    *p='M';
    printf("%s\n", str);
    return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

83.

What will be the output of the following C code?

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

 

Answer: B

No answer description available for this question.

Enter details here

Answer: A

No answer description available for this question.
 

Enter details here

85.

What is the output of this C code?

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

86.

What is the output of this C code?

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

 

Answer: D

No answer description available for this question.
 

Enter details here

87.

What will be the output of the following C code?

#include 
    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

88.

Will the program compile?

#include
int main()
{
    char str[5] = "IndiaBIX";
    return 0;
}

 

Answer: A

C doesn't do array bounds checking at compile time, hence this compiles.

But, the modern compilers like Turbo C++ detects this as 'Error: Too many initializers'.

GCC would give you a warning.

Enter details here

89.

What is the output of this C code?

int *f();
int main()
{
int *p = f();
printf("%d\n", *p);
}
int *f()
{
int j = 10;
return &j;
}

 

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